WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. cpert
    Member
    Posted 10 months ago #

    Hi.

    I'd like to set the default privacy to "My Friends" and tried to make changes to the code example given in previous thread, but I wasn't able to guess at the right combination of $visibility_levels to get it to work.

    --------------------
    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;
    }
    ----------------------
    PS. I'm using the bp-default theme and adding the code to the bottom of it's functions.php file.

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

  2. meg@info
    Member
    Plugin Author

    Posted 10 months ago #

    Hi,

    this code set loggedIn as default privacy, if you want to set friends as default privacy just replace 'loggedin' by 'friends'

    this is an updated code :

    add_filter('bp_profile_activity_visibility_levels_filter', 'bp_make_friends_as_default_privacy_level', 10, 1);
    add_filter('groups_activity_visibility_levels', 'bp_make_friends_as_default_privacy_level', 10, 1);
    function bp_make_friends_as_default_privacy_level( $visibility_levels ) {
    $visibility_levels['public']['default'] = false;
    $visibility_levels['friends']['default'] = true;
    return $visibility_levels;
    }
  3. cpert
    Member
    Posted 10 months ago #

    Thanks for the prompt response.. I'll try it and let you know how it works.
    Cheers!

  4. cpert
    Member
    Posted 10 months ago #

    Hi.

    I paste the code at the very bottom of the functions.php file in the bp-default directory and save it. When I test it, I see messages flash briefly at the top of the screen echoing something about the 'add_filter' lines. But, the drop down behavior isn't changing.

    (should I send you the entire file?)

    Thanks so much for your help.

  5. meg@info
    Member
    Plugin Author

    Posted 10 months ago #

    Hi,

    sorry i was forget to add bp_ to 'groups_activity_visibility_levels'

    here a correct code :

    add_filter('bp_profile_activity_visibility_levels_filter', 'bp_make_friends_as_default_privacy_level', 10, 1);
    add_filter('bp_groups_activity_visibility_levels', 'bp_make_friends_as_default_privacy_level', 10, 1);
    function bp_make_friends_as_default_privacy_level( $visibility_levels ) {
    $visibility_levels['public']['default'] = false;
    $visibility_levels['friends']['default'] = true;
    return $visibility_levels;
    }
  6. cpert
    Member
    Posted 10 months ago #

    Thanks.
    Sorry. I add the new code, it still doesn't seem to have the desired effect. I'm hoping the default (My Friends) would be selected in the list.
    An other alternative is to set it so only My Friends, My Friends in Group, and Group Members show in the list.
    The site I'm working on is called MyDoops.com.

    Here is the bottom of the Functions.php file in the bp-default theme directory.

    ... code above

    function bp_dtheme_remove_nojs_body_class() {
    ?><script type="text/javascript">//<![CDATA[
    (function(){var c=document.body.className;c=c.replace(/no-js/,'js');document.body.className=c;})();
    //]]></script>
    <?php
    }
    add_action( 'bp_before_header', 'bp_dtheme_remove_nojs_body_class' );
    
    ?>
    add_filter('bp_profile_activity_visibility_levels_filter', 'bp_make_friends_as_default_privacy_level', 10, 1);
    add_filter('bp_groups_activity_visibility_levels', 'bp_make_friends_as_default_privacy_level', 10, 1);
    function bp_make_friends_as_default_privacy_level( $visibility_levels ) {
    $visibility_levels['public']['default'] = false;
    $visibility_levels['friends']['default'] = true;
    return $visibility_levels;
    }

    ..end of file

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

  7. cpert
    Member
    Posted 10 months ago #

    I haven't been able to get the code change to take affect.
    Should I send a copy of the entire functions.php file?

    Thanks.
    Calvin

  8. cpert
    Member
    Posted 9 months ago #

    Hi Meg.

    Is there a way we can re-open this question? I made the changes you suggested and wasn't able to get it working. (see last reply).

    Should I send a copy of the entire functions.php file for you to look at?

Reply

You must log in to post.

About this Plugin

About this Topic