-
Author
-
January 24, 2017 at 14:10 #150579itsdanpriceParticipant
Hi Guys,
LOVE KLEO. Amazing theme and the backbone of a project I’m working on.
I have an issue that I’m hoping you can help with.
My aim: I want to add member search to the user profile page.
What I’ve done so far:
I’ve added a new sub tab to the user profile page my friends and private messages using custom code (see below) –
My first idea was to add the members directory page directly there calling the template file – but this resulted in some strange behaviour like breaking the original directory page and the search not working, I then created a new member directory using the code but the search persisted in not working properly.
Instead I’ve added a BP Profile search shortcode as the sub tab – this works great, for some users – other users are just getting a reloaded page with no error messages. (It should redirect to the members directory).
I’ve been experimenting with it and strangely if you search for a user in the system it then works. With others they can search for whatever and it works straight away.
Any chance you can give me some help with this? Ideally it would be to have the member directory as a subtab of my friends – or to get BP profile search behaving consistently?
I’ve added a screen shot of my BP Profile Search settings and here is what I added to bp-custom.php to create the subtab on the profile page:
function add_animal_tabs() {
global $bp;
bp_core_new_subnav_item( array(
‘name’ => ‘Find Members you know’,
‘slug’ => ‘search-friends’,
‘parent_url’ => trailingslashit( bp_displayed_user_domain() . ‘friends’ ),
‘parent_slug’ => ‘friends’,
‘screen_function’ => ‘friends_screen’,
‘position’ => 100,
‘user_has_access’ => bp_is_my_profile()
) );
bp_core_new_subnav_item( array(
‘name’ => ‘Find Members you know’,
‘slug’ => ‘search-friends’,
‘parent_url’ => trailingslashit( bp_displayed_user_domain() . ‘messages’ ),
‘parent_slug’ => ‘messages’,
‘screen_function’ => ‘friends_screen’,
‘position’ => 400,
‘user_has_access’ => bp_is_my_profile()
) );
}
add_action( ‘bp_setup_nav’, ‘add_animal_tabs’, 100 );
function friends_screen() {
add_action( ‘bp_template_title’, ‘friends_screen_title’ );
add_action( ‘bp_template_content’, ‘friends_screen_content’ );
bp_core_load_template( apply_filters( ‘bp_core_template_plugin’, ‘members/single/plugins’ ) );
}
function friends_screen_title() {
echo ‘Find Members you may know<br/>’;
}
function friends_screen_content() {
bp_get_template_part( ‘members/new’ );
exit();
}
I’ve added admin access for you guys, any help or guidance you can give would be excellent!
Attachments:
You must be logged in to view attached files.January 25, 2017 at 07:32 #150690LauraModeratorHello, will assign the ticket to a higher support level who can help and advise you in your query.
Thanks! ?Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura 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 🙂
January 25, 2017 at 11:07 #150726itsdanpriceParticipantThanks Laura –
Just a quick note I’ve disabled the short code for the time being as users need to use the functionality, so I have a simple link to the members directory.January 25, 2017 at 18:53 #150788RaduModeratorHi,
From what I see the code logic is ok but I cannot investigate/run/debug the code because this it’s something custom that cannot be covered by the support service.
This guide shows you how to register new tab on members page: https://buddypress.org/support/topic/adding-new-profile-tab-content/ then on screen functions you should call the member’s directory template as you did but something, not works, check with attention again.
Cheers
R.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
The forum ‘Plugins questions’ is closed to new topics and replies.