Support » Plugin: BuddyPress Activity Privacy » How to set default activity privacy

  • Resolved cpert

    (@cpert)


    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/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author meg@info

    (@megainfo)

    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;
    }
    Thread Starter cpert

    (@cpert)

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

    Thread Starter cpert

    (@cpert)

    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.

    Plugin Author meg@info

    (@megainfo)

    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;
    }
    Thread Starter cpert

    (@cpert)

    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.]

    Thread Starter cpert

    (@cpert)

    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

    Thread Starter cpert

    (@cpert)

    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?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to set default activity privacy’ is closed to new replies.