Hello,
I have been using the great plugin https://buddydev.com/plugins/bp-featured-members/ and i am trying to set the bp_members_suggestions_query_args return only $args with featured members.
I have been trying to set the code snippet here https://buddydev.com/support/forums/topic/hide-current-logged-in-user-and-admin/ to give this result but with no luck.
How can i get only the featured user from
$excluded = get_users( array( 'role' => 'subscriber', 'fields' => 'ID' ) );
?I have changed the code
function buddydev_filter_buddypress_auto_complete_ids( $args ) { $user_ids = isset( $args['include'] ) ? $args['include'] : array(); if ( $user_ids && ! is_array( $user_ids ) ) { $user_ids = wp_parse_id_list( $user_ids ); } $included= get_users( array( '_is_featured' => 1, 'fields' => 'ID' ) ); $args['include'] = array_merge( $included, $user_ids ); return $args; } add_filter( 'bp_members_suggestions_query_args', 'buddydev_filter_buddypress_auto_complete_ids' );
but doesn’t work.
Could anyone give me a help on that please?
Hello,
Thank you for posting. Try the following code and let me know if it works or not.
/** * Modify member suggestion query args * * @param array $args Suggestion query args. * * @return mixed */ function buddydev_filter_buddypress_auto_complete_ids( $args ) { if ( ! function_exists( 'bp_featured_members' ) ) { return $args; } $args['meta_key'] = '_is_featured'; return $args; } add_filter( 'bp_members_suggestions_query_args', 'buddydev_filter_buddypress_auto_complete_ids' );
Regards
RaviThank you so much Ravi for your help 🙂
Yes the code worked just fine.
How can i exlcude from the results the current user, so that he doesn’t have the option to find him self?
I have tried something like that
function buddydev_filter_buddypress_auto_complete_ids( $args ) { if ( ! function_exists( 'bp_featured_members' ) ) { return $args; } if ( is_user_logged_in() ) { $excluded = get_current_user_id(); } $args['meta_key'] = '_is_featured'; return $args; } add_filter( 'bp_members_suggestions_query_args', 'buddydev_filter_buddypress_auto_complete_ids' );
Hello,
Thank you for the acknowledgment. Please try the following code:
function buddydev_filter_buddypress_auto_complete_ids( $args ) { if ( ! function_exists( 'bp_featured_members' ) ) { return $args; } if ( is_user_logged_in() ) { $args['excluded'] = get_current_user_id(); } $args['meta_key'] = '_is_featured'; return $args; } add_filter( 'bp_members_suggestions_query_args', 'buddydev_filter_buddypress_auto_complete_ids' );
Do let me know if it works or not.
Regards
RaviYes Ravi.This worked perfect 🙂 thank you for your help.
Just another very quick general BP question. What would be the correct hook to send a one time confirmation email to the user when his account passed the authentication process(upon registration we send an email with a link, the user authenticate his account and then he can login). Would it be
bp_core_activated_user
orbp_core_signup_user
or something else? We need to send the one time email after the user authenticated (no need to necessary login).Thank you for your time
Hello,
Thank You for the acknowledgment. I am glad that I could help. ‘bp_core_activate_user’ is called only once at the time of account activation. You can also send an email at the first user login attempt. For the first login check please refer to the following link:
https://buddydev.com/support/forums/topic/code-adjustment/#post-37469
Regards
Ravi
The topic ‘ [Resolved] Return in bp_members_suggestions_query_args only bp featured members’ is closed to new replies.