Make Profile link, link to the BuddyPress profile instead of the WordPress dashboard? [closed]

I am using the plugin Sidebar Login for BuddyPress which enables users to insert a login box in the sidebar which in turn produces three links: Dashboard, Profile, and Logout.

My issue is that the Profile link, links to the WordPress dashboard. I would like it to link to the actual BuddyPress profile page. Is there any way I can change something in sidebar-login.php or admin.php to remedy this problem?

I have pasted sidebar-login.php here: http://pastebin.com/V2v1t4gm

I have pasted admin.php here: http://pastebin.com/6KjxeZ3h

1 Answer
1

There are two ways to do that:

From the plugin settings page

On the “Loggedin Links” option, the second anchor tag is pointing to WordPress profile by default: '<a href="http://yoursite.com/wp-admin/profile.php">Profile</a>'. You have to update this to point to Buddypress profile page, to do so, you need to know what is the members domain that Buddypress is using, by default it will be http://yoursite.com/members/username/, but it can be different if you have chosen another page to display the members directory from Buddypress settings Settings -> Buddypress -> Pages. To be sure just visit your profile and copy the browser URL, and then paste it in the href attribute of the Profile anchor tag, and then replace your username with %USERNAME% so that the anchor will become:

<a href="http://yoursite.com/members/%USERNAME%/">Profile</a>

Just edit this according to your settings.

Edit the plugin file (not recommended)

If you wish to edit the plugin file to dynamically get the user profile page link, add the following line of code after line 96 (just before echo the logout link) on sidebar-login.php:

echo '<li class="page_item"><a href="'.bp_core_get_user_domain($user_ID).'">'.__('Profile').'</a></li>';

Make sure to remove the Profile link from the Loggedin Links field of the settings page of the plugin so that you wont have double profile links on your widget. This way is not recommended because you will loose your modifications on plugin update and you will have to re-edit the file on each update of the plugin.

Leave a Comment