-
Author
-
September 27, 2017 at 12:04 #174917
ahodhellysar
ParticipantHello,
I need help please to achieve the following:
1- my social network website is based on privacy , the member user id is a random generated number “11 numbers” exactly .. so that they can’t find each others without having each others ID ..
what i need is , in the default search in the theme , i want to exclude searching members with anything but the user id , to not search by the display name .. only user id , which it’s a numeric value and it’s 11 numbers
2- i need to extend the live notification function , i’m using many buddypress extensions like events and todolist ..
would you give me hints to how to add extra notifications to it .. where should i start .. and which files i should work on
3- in the activity page shortcode “screenshot 1 “ , how to remove the highlighted items .. the network is based on privacy as i mentioned , so the user shouldn’t see non friends activities .
For this page , i want to show the user friends and the joined groups activities and hide everything else includes the user personal activities .. i’m trying to achieve something near to facebook feeds
4- how to add second level in submenus like this in the “screenshot 2”
5- in buddypress pages , when using content generated by ajax , the page height stay fixed and doesn’t scroll automatically .. i must resize the window or doing any action in the page so the page “browser” scrollbar appear
Thanks in advance ..
September 28, 2017 at 08:17 #175046Laura
ModeratorHello, 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 solutionSeptember 28, 2017 at 19:18 #175105Radu
ModeratorHi,
1. You can control the search context frmo wp-admin -> theme options -> header options

2. This is the responsible file for the notifications menu item : /Applications/XAMPP/htdocs/kleo/wp-content/themes/kleo/lib/plugin-buddypress/menu-notifications.php
3. Use those CSS’s
COPY CODE#buddypress div.item-list-tabs#subnav ul li#activity-all { display: none; } select#activity-filter-by option[value=new_member] { display: none; }The css will be added to wp-admin -> theme options -> General settings -> Quick CSS
4. Look at this video frmo this time : https://youtu.be/A6h0hHATCyM?t=1m46s just pull the menu in the right side one step.
5. If you have modified templates or other changes it can be a cause and you shhoudl recall the KLEO.main.init(); js function to re-init and calculate the with and height of the window including the new content added via AJAX
Cheers
R.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionSeptember 29, 2017 at 01:16 #175128ahodhellysar
ParticipantHi radu ,
1- i’m already know this , but this is not what i need ,, i need to limit search members to only numeric values .. what i try to do is preventing users to find each others by names .. i know it gonna require custom coding and there’s no ready solution for it .. all what i need from you is giving me hints about this code , and where to place it , which files i should work on.3- i don’t want to hide them , i want to disable it .. hide the filters and show all friends and joined groups activities
September 29, 2017 at 16:00 #175160ahodhellysar
Participant1- i just want the user search member by user_login .. which it’s a unique random number for each user .. i don’t want them to search member by anything else , not the display name neither the nicename .. only user_login and maybe the email too
September 29, 2017 at 17:39 #175191Radu
ModeratorHi,
To restrict the search only to numbers just add the next code to wp-content/themes/kleo-child/functions.php
CODE : https://pastebin.com/raw/jaH6m9cB
NOTE : Child theme needs to be installed and activated.
To remove ALL MEMBERS from there you will have to copy his file :
wp-content/themes/kleo/buddypress/activity/index.php
to
/wp-content/themes/kleo-child/buddypress/activity/index.phpThen in child theme remove the next line (see screenshot)

To remove MEMBERS filter from there, copy this file :
/wp-content/themes/kleo/buddypress/members/index.php
to
/wp-content/themes/kleo-child/buddypress/members/index.phpand see the screenshot

Cheers
R.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionSeptember 29, 2017 at 23:17 #175217ahodhellysar
ParticipantThanks for your code, but it doesn’t help much unfortunately.
1 – i just need to prevent searching by names , and allow search “MEMBERS” only by the user_login .. as you see in screenshot below , it doesn’t find results because almost it search by the name not the user_login
https://snag.gy/NQ6HIG.jpgso i think it would be better to use another method , to just make it search by the user_login , not any other meta
2 – in your code , as i understand it , you redirect any non numeric values in “url/?s” to 404 page .. but i still want search by name in other context like groups and posts etc
3 – and what about the live search form results .. how to prevent it , because it still can search by name
https://snag.gy/at3nhL.jpg4 – now the live search form populate results before pressing enter .. then i press enter to go to the results page .. but what about mobiles and tabs .. doesn’t this form miss a submit button?
October 2, 2017 at 16:39 #175426Radu
ModeratorHi,
1. Actually there on the results page, it’s displayed the default search page from WordPress where that will not search through members, only CPT’s.
You will have to perform the member search from the yourdomain.com/members/ and you will have to add the next code to functions.php file from child theme to permit only numeric values to be typed in the member search form.COPY CODEfunction bp_directory_members_search_form_only_number($query_arg) { $query_arg = bp_core_get_component_search_query_arg( 'members' ); if ( ! empty( $_REQUEST[ $query_arg ] ) ) { $search_value = stripslashes( $_REQUEST[ $query_arg ] ); } else { $search_value = bp_get_search_default_text( 'members' ); } $search_form_html = '<form action="" method="get" id="search-members-form"> <label for="members_search"><input type="number" name="' . esc_attr( $query_arg ) . '" id="members_search" placeholder="'. esc_attr( $search_value ) .'" /></label> <input type="submit" id="members_search_submit" name="members_search_submit" value="' . __( 'Search', 'buddypress' ) . '" /> </form>'; return $search_form_html; } add_filter('bp_directory_members_search_form', bp_directory_members_search_form_only_number);To can build the visible username of a user you can try this plugin https://wordpress.org/plugins/buddypress-real-names/
2. I see in this case there should be developed advanced searching rules by detecting if you are performing group search or member or any another context… I don’t have a quick solution for that, it maybe needs of a professional developer to achieve that.
4. After you press enter you will be driven to default wp search page, that’s how it was built… the member search and advanced member search can be performed from http://yoursite.com/members/
Cheers
R.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionOctober 2, 2017 at 23:21 #175483ahodhellysar
Participant1 – so the live search is separated of the default wordpress search page..so it’s all depends in how fast the search results fire before the user press enter .. the problem is , there’s a lag , about 2 3 seconds before the results appear , they aren’t instantly appearing .. the user input the search query and nothing happens instantly , he wait 2 seconds till the results fire .. and through this 2 second waiting , there’s no any sign that’s something performing , no loading circle like this in your demo
watch the video :
what i need is to know how to speed the live search performance and to show a preloading icon like this in your demo
2 – i have solved the search member by only numeric value by editing this line in the theme function file .. line 621
COPY CODEif ( function_exists( 'bp_is_active' ) && is_numeric( $search_string ) && ( $context == "any" || in_array( "members", $context ) ) ) { $members = bp_core_get_users( array( 'search_terms' => $search_string, 'per_page' => $defaults['numberposts'], 'populate_extras' => false, ) ); }now the search get members only if the search string is a numeric value .
but still there’s a problem , that’s if the user will use the member search page , or will use a direct link .
what i need is , a similar code to this you provided before , to redirect or get the 404 not found page if the $search_string is not numeric in the member search page ..bp_get_members_directory_permalink() . "?s=" . $search_string3- about the default search page “domainname.come/s?=” i think i need a search plugin for it .. would you advice me any good plugin support buddypress ?
October 4, 2017 at 15:50 #175661Radu
ModeratorHi,
1.
The search results depends by your internet connection and most important by your server performance, if your server it’s slow the results will show later. On our demo it takes less than 1 second to display the results and the loader icon its there by default. To can give you some advices show the the url of your website to test.
2. Isinde if function exists add a new condition
COPY CODEif ( function_exists( 'bp_is_active' ) && is_numeric( $search_string ) && ( $context == "any" || in_array( "members", $context ) ) ) { if(is_numeric($search_string)) { //your previous condition } else if(!is_numeric($search_string)) { $wp_query->set_404(); status_header(404); get_template_part(404); exit(); }3. You can test one of those plugins: https://wordpress.org/plugins/search/buddypress+search/
You can start with BuddyPress global search.
Cheers
RHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
The forum ‘General questions’ is closed to new topics and replies.