Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

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

  • 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


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

    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


    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


    Scott Seitz
    Participant

    @dtc7240

    Thanks so much for documenting this rcain. I’m set up in a local server development environment (obviously not advertising to search engines) and was trying to figure out why the WP comments were not showing up in the BP activity stream! You just saved me a lot of time!!

Viewing 6 replies - 1 through 6 (of 6 total)
Skip to toolbar