• Resolved Alex Stine

    (@alexstine)


    Hello,

    I would like to insert a link to the BuddyPress profile in the User Links section. It seems that this would not be possible since you can’t enter PHP there. Could you please tell me which template I need to edit to add this link for all users or add this functionality in the plugin?

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Alex Stine

    (@alexstine)

    If you need this function now, here is a dirty way of accomplishing the goal.
    1. Create a page named “View Profile” or whatever you might want it to be named.
    2. Be sure to copy the permalink. In my example, my permalink was “profile”.
    3. While on the edit page screen, grab the numerical ID of the page from the address bar. An example might look like this.
    https://example.com/wp-admin/post.php?post=412&action=edit
    In the address above, you can see that “412” is the page ID.
    4. Open your site via FTP and navigate to /wp-content/themes/THEME-NAME/.
    5. Create a file with a .php extension. It could have any name such as “tml-redirect.php”.
    6. Open the file and add the following code to it.

    <?php
    /*Template Name: BuddyPress Redirect TML
    Author: Alex Stine*/
    if (is_page(434) ) {
    wp_redirect( '/members/' . bp_core_get_username( bp_loggedin_user_id() ) );
    exit;
    }
    ?>

    7. Save the file.
    8. Back on the page you created, be sure to select the Page Template name that we just added. Then Update/Publish the page. This ensures that we have two checks. One page with a page template attached to it, and one if statement.
    9. Drop your permalink of the page you created in TML > User Links and when a user visits the link, they will be redirected to their BuddyPress profile page.

    Hope this helps anyone else looking for a temporary solution.

    Plugin Author Jeff Farthing

    (@jfarthing84)

    Use the Custom User Links module with the %user_login% variable.

    Thread Starter Alex Stine

    (@alexstine)

    Almost there, left out a bit of important detail. You cannot just use “%user_login%”. You must still write it in link format such as the example below.
    https://example.com/members/%user_login%/

    At least that is the only way it would work on my site. I can see now that the redirect was a bit overly complicated. ??

    @jfarthing84, you might consider adding some more information about variables and usage on the FAQ. Might help others. ??

    Thanks for the great plugin and solution. Marking resolved.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add BuddyPress Profile Link’ is closed to new replies.