Skip to:
Content
Pages
Categories
Search
Top
Bottom

Hidden blog posts from private blogs in sidewide activity stream

  • @afoka

    Participant

    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?

Viewing 17 replies - 1 through 17 (of 17 total)
  • @boonebgorges

    Keymaster

    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: https://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.

    @afoka

    Participant

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

    @boonebgorges

    Keymaster

    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.

    @afoka

    Participant

    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.

    @boonebgorges

    Keymaster

    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

    @erich73

    Participant

    I guess this is worth a TRAC-ticket ?

    @boonebgorges

    Keymaster

    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?

    @afoka

    Participant

    Hi Boone,

    YeZZ, YeZZ, YeZZ it works!! I could kiss you for this!

    Thank you so much.

    With regards Anja (afoka)

    @boonebgorges

    Keymaster

    Hooray!

    @ooster

    Participant

    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/

    @afoka

    Participant

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

    @boonebgorges

    Keymaster

    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.

    @afoka

    Participant

    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 )

    @boonebgorges

    Keymaster

    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.

    @afoka

    Participant

    YEZZ, it works again. Thanks for your help again!
    The only things what are needed:

    In the root of BuddyPress (version 1.2.3):
    In bp-blogs.php, change rule 379 of
    if ( (int)get_blog_option( $blog_id, ‘blog_public’ ) || !bp_core_is_multisite() ) {
    IN:
    if (get_blog_option( $blog_id, ‘blog_public’ ) > 0 || !bp_core_is_multisite() ) {

    and change rule 427 from
    if ( (int)get_blog_option( $recorded_comment->blog_id, ‘blog_public’ ) || !bp_core_is_multisite() ) {
    IN:
    if (get_blog_option( $recorded_comment->blog_id, ‘blog_public’ ) > 0 || !bp_core_is_multisite() ) {

    and the MU plugin:
    ds_private_blog.php: http://wpmudev.org/project/More-Privacy-Options

    With regards Anja(afoka)

    @boonebgorges

    Keymaster

    Happy to hear that it works!

    @afoka

    Participant

    And for the users of BuddyPress version 1.2.4:
    I have also tested it with 1.2.4 and it’s still working great.

Viewing 17 replies - 1 through 17 (of 17 total)
  • The topic ‘Hidden blog posts from private blogs in sidewide activity stream’ is closed to new replies.
Skip to toolbar