Support » Plugin: Broadcast » Share only to one specific blog

  • naturfreundeschweiz

    (@naturfreundeschweiz)


    We have a multisite with around 11 sites. One of them is our main site and the others sub-sites. We have the custom post type “activities” and the sub-sites should be able to share/push/broadcast their activities to our main site but not to each other.
    Or even better: only to each other if we specifically allow it.

    Would that be possible with this Plugin? I installed it on a test site and while it works perfectly I cannot seem to only set one blog as the “main-child”. I looked at the adons but there are many and on first glance none seem to target my issue.

    Thank you vermy much in advance

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author edward_plainview

    (@edward_plainview)

    I think your use case would be best solved not giving users access to each others blogs, and some code snippets. Like these two, for example:

    https://broadcast.plainviewplugins.com/snippet/add-access-to-a-blog/
    https://broadcast.plainviewplugins.com/snippet/remove-access-to-a-blog/

    Removing the user’s write access to other blogs you can do without any add-ons. 🙂

    naturfreundeschweiz

    (@naturfreundeschweiz)

    Thank you very much for the quick answer!

    This seems to be exactly what I need thanks. But I seem to have trouble when I want to remove more than one blog (since I only want to show my “main-blog”).

    I tried something like this so it would remove new blogs automatically.

    $blog_count = get_blog_count();
    for ($i = 2; $i <= $blog_count; $i++){
         $action->blogs->forget( $i );
    }

    I also tried to just remove them individually like this

    $action->blogs->forget( 2 );
    $action->blogs->forget( 3 );

    But with either solution I don’t get to broadcast anything anymore. So sorry for the bother but how would I go about to remove all blogs but the first for every user?

    Plugin Author edward_plainview

    (@edward_plainview)

    First, is no “first” blog for any user. Blogs are not ordered at all, other than by date of creation.

    Second, you can’t just forgot 2 or 3 if those are not the blog ID numbers. You have to forget the exact blog IDs in order for them to disappear.

    Try foreaching the $action->blogs array and removing the IDs found in there.

    naturfreundeschweiz

    (@naturfreundeschweiz)

    Thank you for the answer. I’m aware of that but my test-blogs do have the ID’s 1, 2 and 3 (see the screenshot here)

    So I can try with the array but the result in terms of ID’s should be the same. I write tomorrow as soon as I have tested it.

    Thanks very much for the support =)

    naturfreundeschweiz

    (@naturfreundeschweiz)

    Sorry for the late return. I was a bit occupied the last days but tried several things – unfortunately none of which worked. I’m pretty sure it’s my error but I have no idea what I am doing wrong and I would hate to search for a different solution as broadcast would be perfect in any other way.

    So I’m just hoping for a bit of help from anybody =)

    I have a test-site with four blogs (ID’s 1, 2, 3 and 5). The users from blog 2, 3 and 5 are only allowed to broadcast/share their posts to blog 1.
    So I tried removing the access to blog. For example the following:

    function my_threewp_broadcast_get_user_writable_blogs( $action ) {
    $action->blogs->forget( 2 );
    $action->blogs->forget( 3 );
    add_action( 'threewp_broadcast_get_user_writable_blogs', 'my_threewp_broadcast_get_user_writable_blogs', 200 );

    It works perfectly. From each blog-backend I can only choose blog 1 and 5 to broadcast. But as soon as I add the last blog to forget:
    $action->blogs->forget( 5 );

    It doesn’t work anymore. I’m unable to broadcast any post from any blog-backend. Does anybody have an idea why that is or how I could work around that?

    Plugin Author edward_plainview

    (@edward_plainview)

    Hm. Very weird. The broadcast box not appearing is due to the user not having any access to any blogs, but all users from 2 3 and 5 should have access to 1, right?

    If the users of blogs 2 3 and 5 have access to at least 1, then the Broadcast meta box should be visible.

    naturfreundeschweiz

    (@naturfreundeschweiz)

    Exactly my “final” code ist just this:

    $action->blogs->forget( 2 );
    $action->blogs->forget( 3 );
    $action->blogs->forget( 5 );

    This should have left blog 1 open to everybody but the broadcast box is not appearing. I also tried to add access specifically for 1 but it doesn’t change anything.

    Plugin Author edward_plainview

    (@edward_plainview)

    Weird. Could you e-mail me at info@plainviewplugins.com so I can take a look for myself?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Share only to one specific blog’ is closed to new replies.