I am using the plugin BuddyPress on my WordPress site and when the user clicks on their profile they are redirected to the URL "/members/USERNAME/profile/home/". However, I do not want this page to be there and so I would like the profile ‘landing’ page to be the URL "/members/USERNAME/activity/".
I am not experienced with WordPress or PHP but I attempted to code a redirect for this when the user ends up on the ‘home’ page which is placed within my BuddyPress members/single/home.php file within my child theme:
$ redirect_url_home = get_home_url(); $ redirect_url_home_tt = $ redirect_url_home; $ username_redirect_tt = wp_get_current_user(); $ new_redirect_slug = "'/members/'.$ username_redirect_tt->user_login.'/activity/'"; $ redirect_url_home_tt. = $ new_redirect_slug; echo($ redirect_url_home_tt); wp_safe_redirect( $ redirect_url_home_tt );
This code doesn’t work but that was my thinking of how to solve my problem and I’m sure there is an easier/nicer way to do what I would like, maybe even without a coded redirect and within BuddyPress itself? I have tried using their forum/documentation for answers but haven’t had a reply or found anything useful.
As I say I have no experience with this sort of stuff so any help would be greatly appreciated! Also, to add, I cannot link the site as it is currently on a localhost.