WordPress.org

Ready to get started?Download WordPress

Forums

BuddyPress Activity Privacy
[resolved] How to set default activity privacy level (10 posts)

  1. CreativeDan
    Member
    Posted 1 year ago #

    Question: Is there any way to set a default security level for users' activity stream posts, like "Logged-in users only", so people don't have to be forced to set it manually every time?

    If so, please let me know. I'd be most grateful.

    http://wordpress.org/extend/plugins/buddypress-activity-privacy/

  2. meg@info
    Member
    Plugin Author

    Posted 1 year ago #

    Hi @CreativeDan,

    Yes, you can do it and easly by adding this code to your functions.php of your current theme.

    add_filter('bp_profile_activity_visibility_levels_filter', 'bp_make_logged_in_as_default_privacy_level', 10, 1);
        add_filter('groups_activity_visibility_levels', 'bp_make_logged_in_as_default_privacy_level', 10, 1);
        function bp_make_logged_in_as_default_privacy_level( $visibility_levels ) {
            $visibility_levels['public']['default'] = false;
            $visibility_levels['loggedin']['default'] = true;
            return $visibility_levels;
        }
  3. ljmac
    Member
    Posted 1 year ago #

    Hi meg@info,

    You're certainly a great contributor to the BuddyPress community!

    I'm after something similar to this, but based on user roles e.g.

    1) Subscribers are forced to only be able to post updates to their friends

    2) Higher level roles are able to post universal updates, as per BP's default behaviour

    This would mean the site works like Facebook for normal users, but admins, authors etc. will still be able to post public announcements.

    Is this possible?

  4. meg@info
    Member
    Plugin Author

    Posted 1 year ago #

    Hi @ljmac,

    You can do (1) and (2) by adding code that check the role of the current, and depending the role of the current user just add the corresponding filter.

    it just explain code

    If (im-subscriber){
      add_filter('bp_profile_activity_visibility_levels_filter', 'bp_subscribers_privacy_level', 10, 1);
    
    } elseif(i-have-Higher level roles){
      add_filter('bp_profile_activity_visibility_levels_filter', 'bp_higher_level_roles_privacy_level', 10, 1);
    }
    
    function bp_higher_level_roles_privacy_level( $visibility_levels ) {
       //add or unset new capability levels (like http://wordpress.org/support/topic/how-to-set-default-activity-privacy-level?replies=3#post-4218789)
      ...
    .. .
      return $visibility_levels;
    }
    
    function bp_subscribers_privacy_level( $visibility_levels ) {
            unset($visibility_levels['public']);
             ...
    . ... other unsets
    ...
            return $visibility_levels;
    }
  5. ljmac
    Member
    Posted 1 year ago #

    Thanks meg@info! I take it this code can be added to bp-custom.php?

    I'll probably come to grips with this next week - I'll let you know if I need any further help then.

  6. Dsvay
    Member
    Posted 1 year ago #

    Dear author of this awesome plugin. I have tested your plugin but when I set the status for only loggin users, other non login people can still see the status. Please help me solve this issue. Thanks.

  7. CreativeDan
    Member
    Posted 1 year ago #

    Thanks for getting back to me, and sorry for my delayed reply.
    Where should I input the code you suggested, specifically?
    My website's theme is not natively compatible with BuddyPress,
    but I do have the latest version of BuddyPress.

    A specific outline of what to do would be very helpful, thanks.

    I'm still somewhat new to WordPress,
    and still only a novice at programming,
    so apologies for my lack of comprehension.

  8. Number_6
    Member
    Posted 1 year ago #

    In the folder of your theme is a file called "functions.php". Put the suggested code right after the last line of that file.

  9. granville
    Member
    Posted 9 months ago #

    Hi @megainfo

    Great plugin thanks - I've used the code you provided above to change the default visibility to "friends only" and all is good...except these three activity updates:
    1. "user" became a registered member;
    2. "user" changed their profile picture;
    3. "user" and "user" are now friends

    still appear to all users, rather than just the "user"'s friends.

    Please can you tell me how I can make these three updates "friends only" also?

    Many thanks

    G

  10. granville
    Member
    Posted 9 months ago #

    My apologies - I've just seen that this thread is marked as resolved. So please ignore my previous comment and I'll start a new thread with the same question. Thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic