Skip to:
Content
Pages
Categories
Search
Top
Bottom

BuddyPress Activity Privacy

Viewing 11 replies - 1 through 11 (of 11 total)

  • meg@info
    Participant

    @megainfo

    hi @scimea,

    Check
    wordpress.org/support/topic/mention-privacy-multi-select-features

    Regards.


    scimea
    Participant

    @scimea

    Thank you very much @megainfo

    It would be great if you are making those updates to BuddyPress Activity Privacy, with @mentionedonly setting or mentioned person could always see the post/message.

    I eagerly await your next update! Do you know when you will be releasing it?


    burakbirer
    Participant

    @burakbirer

    BP Activity Privacy 1.2.1 does not work with the Buddypress latest version 1.9.1.
    Will there be a fix soon?

    Thank you for this great plugin. Hope it works.


    Scott Seitz
    Participant

    @dtc7240

    Hi @megainfo. I really appreciate all the work you’ve put into this much needed plugin! I found one easily rectifiable problem with the snippet of code in the bp_visibility_activity_filter() function you added for the re-inclusion of @mentions.

            // mentioned members can always see the acitivity whatever the privacy level
            if ( $visibility != 'mentionedonly' ){
                $usernames = bp_activity_find_mentions( $activity->content );
                $is_mentioned = array_key_exists( $bp_loggedin_user_id,  (array)$usernames );
    
                if( $is_mentioned )
                    $remove_from_stream = false;
            }

    When there are no @mentions in the content and $usernames returns blank, you cast $usernames as an array in order to keep array_key_exists from complaining. An unfortunate side effect of this turns out to be that (array)$usernames is an array with a single key-value pair of [0] -> ” and $bp_loggedin_user_id is 0 for a non-logged in user, thereby allowing a non-logged in user to see things they shouldn’t.

    It took me a little while to figure all of this out, so please accept my patch as thanks for all your hard work!! I’ve modified my version of your code to the following:

            // mentioned members can always see the acitivity whatever the privacy level
            if ( $visibility != 'mentionedonly' && $remove_from_stream ){
    			$is_mentioned = false;
                $usernames = bp_activity_find_mentions( $activity->content );
    			if ( is_array($usernames) )
    				$is_mentioned = array_key_exists( $bp_loggedin_user_id, $usernames );
    
                if( $is_mentioned )
                    $remove_from_stream = false;
            }

    I also added the && $remove_from_stream to the if statement, because there is no reason to run the additional code if the activity can already be seen.

    I wonder if this is the reason @burakbirer says that Buddypress Activity Privacy 1.2.1 doesn’t work with BuddyPress 1.9.1? Everything else seems to work fine for me in that environment.

    Many thanks,
    Scott


    meg@info
    Participant

    @megainfo

    Hi @dtc7240,

    And many thanks for effort, that was problem and i was fixed it i think last night ( version 1.2.2 ).
    here new code

    // mentioned members can always see the acitivity whatever the privacy level
    if ( $visibility != 'mentionedonly' && $bp_loggedin_user_id && $remove_from_stream ){
    $usernames = bp_activity_find_mentions( $activity->content );
    $is_mentioned = array_key_exists( $bp_loggedin_user_id, (array)$usernames );
    if( $is_mentioned ) {
    $remove_from_stream = false;
    }

    }

    the second check will be applied only for logged in memebers.

    Again, thank you!!

    Regards,
    Mounir


    Scott Seitz
    Participant

    @dtc7240

    Many thanks @megainfo! That will work beautifully! Sorry I didn’t get around to emailing you yesterday afternoon when I first found it and saved you the trouble of tracking it down.

    What are the chances of an administrative control to disable the beautiful new select box? As wonderful as it is, it doesn’t match my other select boxes 🙁

    I really appreciate your efforts!
    Scott


    backyardmech
    Participant

    @backyardmech

    Hello,
    Which php file are you editing for function? I don’t know in which file to look for this function.


    Scott Seitz
    Participant

    @dtc7240

    Hi again Mounir ( @megainfo ). I recently changed the “Logged In Users” label via the en_US.po file and it didn’t change the label in the select boxes. After some investigation, I found that with the addition of the wonderful new admin controls you gave us recently, you store the results of the admin screen changes in the wp_options table and then pull the choices from there instead of from your class. Unfortunately, those stored choices don’t take your text domain into account. I’m sure you can come up with a much better solution than I have temporarily implemented, but here is the filter function I added to correct it for now:

    function po_visibility_levels_filter( $levels ) {
    	
    	foreach( $levels as &$level ) {
    		$label = $level['label'];
    		$level['label'] = __( $label, 'bp-activity-privacy');
    	}
    
    	return $levels;
    }
    add_filter('bp_profile_activity_visibility_levels_filter', 'po_visibility_levels_filter');
    add_filter('bp_groups_activity_visibility_levels_filter', 'po_visibility_levels_filter');
    

    Many thanks again for creating such a much needed plugin!
    Scott


    Scott Seitz
    Participant

    @dtc7240

    Here’s another quick fix Mounir ( @megainfo ). In the current AP version, the .bp-ap-selectbox shows on a streamed comment (not threaded comment) on the user’s own profile where the user has the ability to delete the comment, but not the parent activity. It fortunately has no effect if the user attempts to change it — it just creates some confusion by being there. Can you please add the following argument to the if statement below?

    function bp_update_activitiy_visibility_selectbox() {
        if( bp_activity_user_can_delete() && bp_get_activity_type() == 'activity_update' ) {

    Thank you much,
    Scott


    Scott Seitz
    Participant

    @dtc7240

    Hi Mounir (@megainfo). I stumbled across another php notice when pulling up my members page:

    PHP Notice: Undefined property: stdClass::$activity_count in /Applications/MAMP/htdocs/wordpress/wp-content/plugins/buddypress-activity-privacy/includes/bp-activity-privacy-filters.php on line 114

    Can you please add the second argument to the if statement below in the bp_visibility_activity_filter() function when you have a chance?

            if ( $remove_from_stream && isset($activities->activity_count) ) {
                $activities->activity_count = $activities->activity_count - 1;
                unset( $activities->activities[$key] );
            }

    Thank you very much,
    Scott


    meg@info
    Participant

    @megainfo

    Hi @dtc7240,

    Thank you very mutch for reporting bugs.

    i have added fix on the last version (1.3).
    I just want to mention that i keeped the ability to members to change the visibility of no threaded comment( join group, leave group, ..etc) since this activities concerns it.

    be cargful when you add this tests on your version:
    if( bp_activity_user_can_delete() && bp_get_activity_type() == 'activity_update' ) {

    it’s can stop the plugin to work for others plugins like buddydrive or others ( they use others activity type other than ‘activity_update’).

    I invite you to join the support forum of the plugin for more enhancement and suggestions.

    https://wordpress.org/support/plugin/buddypress-activity-privacy

    Thanks again for the fix.

    Regards,
    Mounir

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘BuddyPress Activity Privacy’ is closed to new replies.
Skip to toolbar