Tagged: buddypress, button, Directory
Hello Buddypress
– We want to add a “VIEW PROFILE” button on the user’s profile in the buddypress member directory. Which will display the user’s profile page after the click.
– And another button “CONTACT” which will redirect to a specific tab of the user’s profile.
Exactly like the “add as friend” button, “siganle” etc.Can you give us a code for this please?
Hello Ravi,
Thank you for the feedback
the theme: https://themeforest.net/item/rehub-directory-multi-vendor-shop-coupon-affiliate-theme/7646339)
Buddypress version 10.3.0Hello Christian,
Try the following code:
add_action( 'bp_directory_members_actions', function () { $member_id = bp_get_member_user_id(); if ( ! $member_id || ! bp_is_members_directory() ) { return; } $user_domain = bp_core_get_user_domain( $member_id ); if ( bp_is_active( 'xprofile' ) ) { $profile_link = $user_domain . bp_get_profile_slug(); echo sprintf( '<div class="generic-button"><a href="%s">%s</a></div>', esc_url( $profile_link ), esc_html__( 'View Profile' ) ); } echo sprintf( '<div class="generic-button"><a href="%s">%s</a></div>', esc_url( $user_domain ), esc_html__( 'Contact' ) ); } );
Regards
RaviTHANK YOU RAVI,
That’s great.
it’s working fine so far.
The topic ‘ [Resolved] Add button in member directory.’ is closed to new replies.