Hey there,
I asked a question in your blog post “Add Extra links to BuddyPress User Profile | https://buddydev.com/buddypress/add-extra-links-to-buddypress-user-profile-menu-buddypress-group-menu/” about how to make the added links just visible for the profile owner.
Brajesh kindly answered with this solution:
if ( ! bp_is_my_profile() ) {
return ;
}But where do I have to put this in the code?
My code was:
add_action( ‘bp_member_options_nav’, ‘buddydev_add_profile_extra_custom_links’ );
function buddydev_add_profile_extra_custom_links() {
?>
<?php
}Could someone help me with this? I don’t know the syntax how to add this if condition.
Thanks!!
Hi Alessio,
Thank you for posting here.Please use the follwing code
/** * Show links to the profile owner */ function buddydev_add_profile_extra_custom_links() { // show only if my profile. if ( ! bp_is_my_profile() ) { return; } ?> <a href="http://google.com" rel="nofollow">Google</a> <a href="https://buddydev.com">BuddyDev :)</a> <?php } add_action( 'bp_member_options_nav', 'buddydev_add_profile_extra_custom_links' );
Hope this helps.
Regards
BrajeshYou are welcome. yes, you are right about wrapping the link in li tags.
Glad it is resolved.
Regards
Brajesh
The topic ‘ [Resolved] Add Extra links to BuddyPress User Profile –> just show to profile owner’ is closed to new replies.