Group Mods

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

Hidden blog posts from private blogs in sidewide activity stream (18 posts)

Started 2 years, 4 months ago by: Anja Fokker

  • Profile picture of Anja Fokker Anja Fokker said 2 years, 4 months ago:

    Some users/groups want to have a private blog, only visible for the registered blog users. That works fine with the mu-plugin: ds_private_blog and the plugin: absolute-privacy. But the problem is: the blog posts from the private blogs will be shown in the sitewide activity stream. Ok, if you want to visit the blog, or read the article, you have first to login.
    But is it possible to hide blog posts(and comments) of private blogs from the sidewide activity stream?

    How can I do this?

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

    I’m not sure how those plugins in particular work, but here’s a solution that worked for me with the plugin More Privacy Options: http://buddypress.org/forums/topic/more-privacy-options-private-blogs-and-activity-streams

    The same principle can probably be applied to your case. Figure out how your plugins are recording fine-grained privacy options, and then adjust the code at the above link to match.

  • Profile picture of Anja Fokker Anja Fokker said 2 years, 4 months ago:

    I have tried as well with plugins disabled as abled (and in combinations therof), unfortunately it does not work for me.

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

    Did you try making the change to bp-blogs-classes.php described in the link I gave you? It will only take affect with new blog posts – you’ll have to delete the old unwanted activity items manually.

    Try making the change to bp-blogs-classes.php, and then post a new entry to a private blog to see if the change has worked.

  • Profile picture of Anja Fokker Anja Fokker said 2 years, 4 months ago:

    Yes I did:
    In buddypress/bp-blogs/bp-blogs-classes.php
    I repleaced rule nr. 267:
    if ( !(int)$wpdb->get_var( $wpdb->prepare( “SELECT DISTINCT public FROM {$wpdb->base_prefix}blogs WHERE blog_id = %d”, $blog_id ) ) )
    in
    if ( $wpdb->get_var( $wpdb->prepare( “SELECT DISTINCT public FROM {$wpdb->base_prefix}blogs WHERE blog_id = %d”, $blog_id ) ) < 1 )

    After that I cleared up in the database manually the table: wp_bp_activity_user_activity_cached
    I deleted existing blogs and groups and started again: (don’t fear, this is just a testsite)
    Created a new invisible group with a blog.

    Blog settings: (with the mu-plugin more privacy options) I only want the blog visible for logged in users and registrated on this blog (or something, I translated it into Dutch).

    I created a new blogpost. Then I logged out. After that the first rules of the blogpost are still visible in the activity stream. I can not read the whole blogpost, because I first have to login to the site to see the whole post on that blog.

    Maybe I did something wrong with the code?

    I’m using WordPressMU 2.8.6 and Buddypress 1.1.3

    Thanks for your time you’ll spend to me.

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

    Hi Afoka –

    Your post reminded me that I had to change this hack a bit in BP 1.1.3. Here are the notes I made for myself at the time. Let me know if they make sense, and if you can make them work:
    ===

    In wp-content/plugins/buddypress/bp-blogs.php:
    - function bp_blogs_record_post has two cases, one for new posts and one for edited posts. Change

    if ( (int)get_blog_option( $blog_id, 'blog_public' ) ) {

    to

    $is_blog_public = get_blog_option( $blog_id, 'blog_public' ); //added
    
    //if ( (int)get_blog_option( $blog_id, ‘blog_public’ ) ) {
    
    if ( $is_blog_public > 0 ) { // changed to account for More Privacy Options

    in both of the cases.
    - functions bp_blogs_record_comment and bp_blogs_approve_comment. Replace
    if ( (int)get_blog_option( $recorded_comment->blog_id, 'blog_public' ) ) {

    with

    $is_blog_public = get_blog_option( $recorded_comment->blog_id, 'blog_public' ); //added
    
    //if ( (int)get_blog_option( $recorded_comment→blog_id, ‘blog_public’ ) ) {
    
    if ( $is_blog_public > 0 ) { // changed to account for More Privacy Options
  • Profile picture of abcde666 abcde666 said 2 years, 4 months ago:

    I guess this is worth a TRAC-ticket ?

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

    Maybe, Erich73 – the only thing is that this problem is caused by incompatibility with another plugin. I’m not sure what the policy is on accommodating other plugins. Maybe More Privacy Options is enough of a no-brainer for BP communities that it’d be OK?

  • Profile picture of Anja Fokker Anja Fokker said 2 years, 4 months ago:

    Hi Boone,

    YeZZ, YeZZ, YeZZ it works!! I could kiss you for this!
    Thank you so much.
    With regards Anja (afoka)

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

    Hooray!

  • I used a different approach for our BuddyPress using a BuddyPress filter to exclude all private Blogs activities from showing up:

    http://blogs.zmml.uni-bremen.de/olio/2010/01/12/activity-privacy-plugin-for-buddypress/

  • Profile picture of Anja Fokker Anja Fokker said 2 years ago:

    @Boone Gorges, well I do have the same problem in BuddyPress 1.2.3 . I can find the rule in /bp-blogs/bp-blogs-classes, but……
    the file bp-activity (in the root of BuddyPress) changed so much, that i don’t know where to find the rules like you’ve discribed.
    Will you help me again? Or maybe you know if there is a plugin for it?

    With regards Anja (afoka)

  • Profile picture of Boone Gorges Boone Gorges said 2 years ago:

    In bp-blogs.php, change 379 from
    if ( (int)get_blog_option( $blog_id, 'blog_public' ) || !bp_core_is_multisite() ) {
    to
    if ( (get_blog_option( $blog_id, 'blog_public' ) > 0 || !bp_core_is_multisite() ) {

    Also, change 427 from
    if ( (int)get_blog_option( $recorded_comment->blog_id, 'blog_public' ) || !bp_core_is_multisite() ) {
    to
    if ( (get_blog_option( $recorded_comment->blog_id, 'blog_public' ) > 0 || !bp_core_is_multisite() ) {

    I haven’t tested this but it should work.

  • Profile picture of Anja Fokker Anja Fokker said 2 years ago:

    Strange… In both cases if I change the rules (379 and 427), is this the result:

    Parse error: syntax error, unexpected ‘{‘ in betawordpresswp-contentpluginsbuddypressbp-blogs.php on line 379
    Parse error: syntax error, unexpected ‘{‘ in betawordpresswp-contentpluginsbuddypressbp-blogs.php on line 427

    ————————————————

    I have also as before changed the rule In buddypress/bp-blogs/bp-blogs-classes.php
    if ( !(int)$wpdb->get_var( $wpdb->prepare( “SELECT DISTINCT public FROM {$wpdb->base_prefix}blogs WHERE blog_id = %d”, $blog_id ) ) )
    in
    if ( $wpdb->get_var( $wpdb->prepare( “SELECT DISTINCT public FROM {$wpdb->base_prefix}blogs WHERE blog_id = %d”, $blog_id ) ) < 1 )

  • Profile picture of Boone Gorges Boone Gorges said 2 years ago:

    Oops, yeah, you’ll need to remove the parenthesis before get_blog_option in both of those.

    I don’t know about the blog class thing. Try without changing it and see what happens.