Hi there,
Currently Buddypress generates a profile page for each user. In my setting (a directory website) this only makes sense for users with role “customer” because other user roles would have submitted a listing. These listing owners essentially have duplicated presence in the website, which does not make sense.
I am currently handling this process manually with Redirection plugin (https://wordpress.org/plugins/redirection/) where I laboriously create a redirection for each member that owns a listing. If the process could be automated then the redirection would be as follows for listing owner roles:
source url: https://example.com/members/(.*)
target url: https://example.com/explore/$1Is there a way to redirect buddypress profile pages for listing owner user roles? I tried using the code suggested here (https://buddydev.com/support/forums/topic/hide-multiple-user-types-from-memberprofile-page/) but had no luck. Please could you help?
Many thanks,
IsabelHi Isabel,
Welcome to BuddyDev forums.Thank you for the question. Please help understand a few thing and I will assist. It should be easily doable.
1. Do you want to redirect from BuddyPress profile to their listing profile or from listing profile to BuddyPress profile?
2. Are you using any plugin for the listing? If yes, which one.
Please let me know and I will assist.
Regards
BrajeshHi Brajesh,
1. I want to redirect from BuddyPress profile to their listing profile (but only for specific user roles)
2. I am using a theme (MyListing) for the listingsThanks so much for your help!!
Isabel
Hi Isabel,
I am sorry, I am not familiar with your theme, so unable to provide an exact answer.I need to know how to determine the listing profile of a user if id or username is given.
I ma posting a sample code in which redirection is commented, Please feel free to adapt it based on how the listing works on your site.
add_action( 'bp_template_redirect', function () { if ( ! bp_is_user() ) { // replace with bp_is_my_profile() to only do it for own profie.e return;// } // Use the id or dimain // bp_displayed_user_id(); // bp_displayed_user_username(); // where do you want to redirect. // $url = ''; // bp_core_redirect( $url ); } );
Hope that helps.
Regards
Brajesh
You must be logged in to reply to this topic.