BuddyDev

Search

BuddyPress Recent Profile Visitors Plugin _ What if 2 roles

  • Participant
    Level: Master
    Posts: 213
    smart life on #12025

    Hi,

    https://buddydev.com/plugins/recent-visitors-for-buddypress-profile/

    1) I used user role, which some user has 2 roles
    Example: I dis-record for user role A
    But this user has 2 roles: Role A + Role B
    ==> Will this user will be available hidden in visited?

    2) What is coded should i use to hidden someone by user_id1; user_id2?
    This user has only 1 roleA, but they are specical users i would like to hidden only. Not apply for all user in this role

    Thanks

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #12029

    Hi Julia,
    Can you please help me understand your question.

    If You need more control than settings, It is doable. we have a lot of hooks available for the same.

    For example, to disable visit recording by a user, we have a hook “visitor_is_visit_recordable” that we can use.

    Please let me know the details and I will assist you with the code.

    Thank you
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #12030

    Also, to answer your first question

    We check if the user has a role, so if a user has 2 roles and one of those role matches, It will be recordable.

    Thank you
    Brajesh

  • Participant
    Level: Master
    Posts: 213
    smart life on #12035

    About visitor_is_visit_recordable

    What is complete code to disabled record for user-id1 & user-id2 please. Sorry i’m not coder.

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #12037

    No problem.
    You can put this code

    
    
    /**
     * Disable recording for some users. These users will not appear in list from now onwards.
     *
     * @param bool $is_enabled is recording enabled.
     * @param int  $user_id the user id we are checking for.
     *
     * @return bool
     */
    function buddydev_custom_disable_visitor_recording( $is_enabled, $user_id ) {
    
    	$disabled_user_ids = array( 1, 2 ); // add the user ids here.
    
    	if ( in_array( $user_id, $disabled_user_ids ) ) {
    		$is_enabled = false;
    	}
    
    	return $is_enabled;
    }
    
    add_action( 'visitor_is_visit_recordable', 'buddydev_custom_disable_visitor_recording', 10, 2 );
    
    

    In your theme’s functions.php or in the bp-custom.php.

    If you are uncomfortable with it, please drop me an email with ftp details and I will do it for you.

    Thank you
    Brajesh

  • Participant
    Level: Master
    Posts: 213
    smart life on #12040

    Do you mean i create child-theme/buddypress/bp-custom.php to add for code?

  • Participant
    Level: Master
    Posts: 213
    smart life on #12042

    Hi Please also give me same function code used for plugin: Stealth Mode for Site admin

    Thanks

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #12048

    Please put the above code in your child-theme/functions.php.

    Also, can you please clarify this?

    
    Hi Please also give me same function code used for plugin: Stealth Mode for Site admin
    

    Thank you
    Brajesh

  • Participant
    Level: Master
    Posts: 213
    smart life on #12051

    Hi,

    We also have similar record plugin basic on activity, i would like hidden it for some specical users too. ” Stealth Mode for Site admin” plugin.

    So how to enable “Stealth Mode” For user-ids1, user-ids2?

    Thanks

    • This reply was modified 6 years, 11 months ago by smart life.
  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #12054

    The plugin is aimed for site admins only. So if you have more than one site admin, they can use it.

    Even better, do you use Profile Visibility Manager? If yes, I will suggest avoid the stealth mode and just set the user has hidden from everywhere in the visibility manager.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved