Group Mods

  • Profile picture of @mercime
  • Profile picture of r-a-y
  • Profile picture of hnla

More Privacy Options, private blogs, and activity streams (4 posts)

Started 2 years, 6 months ago by: Boone Gorges

  • Profile picture of Boone Gorges Boone Gorges said 2 years, 6 months ago:

    I’m using More Privacy Options to allow users to fine-tune the privacy settings on their blogs. It works by creating three new privacy settings and assigning them to values -1, -2, -3 in wp_blogs ‘public’. BuddyPress only puts a new blog post in the activity streams if the privacy value is an integer, which works fine if you’re only dealing with WPMU’s default values of 1 for public and 0 for private, but having the additional values from More Privacy Options screws things up.

    I changed a line in /bp-blogs/bp-blogs-classes.php to keep this from happening. In the function is_hidden(), replace
    $wpdb->prepare( "SELECT DISTINCT public FROM {$wpdb->base_prefix}blogs WHERE blog_id = %d", $blog_id ) ) )
    with
    if ( $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT public FROM {$wpdb->base_prefix}blogs WHERE blog_id = %d", $blog_id ) ) < 1 )
    In other words, instead of ignoring blog entries with a non-integer privacy value, ignore all blog entries whose privacy value is less than 1.

    Because this problem arises from a plugin conflict, I’m not sure if it qualifies as patch-worthy in BP trunk. But I hope it will be useful to someone out there.

  • Profile picture of Jugoretz jugoretz said 2 years, 6 months ago:

    This does look useful to me, at least! But I want to confirm before I make the change.

    My line 267 in bp-blogs-classes.php currently reads
    if ( !(int)$wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT public FROM {$wpdb->base_prefix}blogs WHERE blog_id = %d", $blog_id ) ) )

    So you’re saying I should just replace
    $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT public FROM {$wpdb->base_prefix}blogs WHERE blog_id = %d", $blog_id ) ) )
    within that line? Or the whole line?

  • Profile picture of Boone Gorges Boone Gorges said 2 years, 6 months ago:

    You’ve got to replace the whole line. (Or just back out !(int) at the beginning of the if statement and replace it with 1 >, which amounts to the same thing.) Let me know how it works.

  • Profile picture of Arghagain Arghagain said 2 years, 5 months ago:

    Has anyone confirm that this work yet?