Hello 🙂 Sorry for the confusion.
Those links are generated dynamically, so you cannot just make an url to them, but with this function, you can add an empty page in Pages, with each sections name (Activity, Profile, Notifications, Messages, Friends, Groups, Media, Settings) And you can also add extra with a simple change.
Here it is:
Add this to functions.php in child theme
Create a new page with each section name , for example page Profile, page Messages…
function redirect2profile(){
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
if($_SERVER['REQUEST_URI'] == '/profile/' && is_plugin_active('buddypress/bp-loader.php') && is_user_logged_in()){
global $current_user;
wp_redirect( get_bloginfo('url') . '/members/'. $current_user->user_login . '/profile/');
exit();
}
if($_SERVER['REQUEST_URI'] == '/activity/' && is_plugin_active('buddypress/bp-loader.php') && is_user_logged_in()){
global $current_user;
wp_redirect( get_bloginfo('url') . '/members/'. $current_user->user_login . '/activity/');
exit();
}
if($_SERVER['REQUEST_URI'] == '/messages/' && is_plugin_active('buddypress/bp-loader.php') && is_user_logged_in()){
global $current_user;
wp_redirect( get_bloginfo('url') . '/members/'. $current_user->user_login . '/messages/');
exit();
}
if($_SERVER['REQUEST_URI'] == '/notifications/' && is_plugin_active('buddypress/bp-loader.php') && is_user_logged_in()){
global $current_user;
wp_redirect( get_bloginfo('url') . '/members/'. $current_user->user_login . '/notifications/');
exit();
}
if($_SERVER['REQUEST_URI'] == '/friends/' && is_plugin_active('buddypress/bp-loader.php') && is_user_logged_in()){
global $current_user;
wp_redirect( get_bloginfo('url') . '/members/'. $current_user->user_login . '/friends/');
exit();
}
if($_SERVER['REQUEST_URI'] == '/groups/' && is_plugin_active('buddypress/bp-loader.php') && is_user_logged_in()){
global $current_user;
wp_redirect( get_bloginfo('url') . '/members/'. $current_user->user_login . '/groups/');
exit();
}
if($_SERVER['REQUEST_URI'] == '/media/' && is_plugin_active('buddypress/bp-loader.php') && is_user_logged_in()){
global $current_user;
wp_redirect( get_bloginfo('url') . '/members/'. $current_user->user_login . '/media/');
exit();
}
if($_SERVER['REQUEST_URI'] == '/settings/' && is_plugin_active('buddypress/bp-loader.php') && is_user_logged_in()){
global $current_user;
wp_redirect( get_bloginfo('url') . '/members/'. $current_user->user_login . '/settings/');
exit();
}
}
add_action('init', 'redirect2profile');
This functions makes a redirect to those profile parts if a page has the name of it, you can change it as you want, for example:
if($_SERVER['REQUEST_URI'] == '/settings/' && is_plugin_active('buddypress/bp-loader.php') && is_user_logged_in()){
global $current_user;
wp_redirect( get_bloginfo('url') . '/members/'. $current_user->user_login . '/settings/');
exit();
}
This makes that the page that has the slug “settings” will redirect to the logged in user “settings” page.
Just create empty pages for each link and place them in your menu, if you dont want to show those links to not logged in users, use the plugin attached, it lets you have a dinamic menu for logged in/out users
To add more links like “sites” just paste the sample code before the last } of the above code and change the name of the slugs.
SAMPLE CODE
if($_SERVER['REQUEST_URI'] == '/EMPTY-PAGE-SLUG/' && is_plugin_active('buddypress/bp-loader.php') && is_user_logged_in()){
global $current_user;
wp_redirect( get_bloginfo('url') . '/members/'. $current_user->user_login . '/BUDDYPRESS-URL-SLUG/');
exit();
}
To add icons to your new menu links, you can go to Appearance > Menu and choose an icon for them
Or you can use this plugin for already made buddypress menu links but on sidebar as a widget
https://wordpress.org/plugins/buddypress-custom-profile-menu/
Laura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂