Skip to:
Content
Pages
Categories
Search
Top
Bottom

Plugin request: Removing "create a blog" options


  • elemsee
    Participant

    @elemsee

    I’ve done a fair bit of searching without finding an answer, so please excuse me if this is asked and done with.

    I wish for our members to be able to participate in blogs that only the site admins have created. Thusly, the option for users to create blogs is turned off in the WP admin.

    However, the “create a blog” option still exists in 3 places in Buddy Press:

    My Account > Blogs > Create a Blog

    My Blogs > Create a Blog!

    (member page) > Blogs > Create a Blog

    Clicking any of these takes the user to a “Blog registration is currently disabled” message… I feel this makes us look as if we forgot something or made an error.

    I’d LIKE to be able to remove these “create a blog” references, at the very least, if not limiting users altogether. I’ve tried following Burt’s advice in “Limit Blog Creation to Admins,” but must confess that that level of php work is as yet beyond me. (http://buddypress.org/forums/topic/limit-blog-creation-to-admins)

    Has anyone thought of a solution for this or can think of a way to accomplish it without needing to manually edit a lot of php?

    Thank you guys, any answer would be appreciated.

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

  • takuya
    Participant

    @takuya

    You’ll just need to comment out a few lines from admin bar. Search this forum (as well as Google) “admin bar” etc to find out more.


    elemsee
    Participant

    @elemsee

    Thank you socialpreneur. Originally I was hoping to accomplish the “limit to admins” feature, but I’ll settle for this. I’d only found info about hiding the admin bar, but I’ll take another look. The admin bar is not the only place where “create a blog” appears, but perhaps that is addressed in tandem to the admin bar issue.

    It would be easier all around if it was a feature that could be turned on and off, but in absence of that, I’ll take this!


    elemsee
    Participant

    @elemsee

    Yeah, my lack of PHP understanding is really getting in my way. I’m trying though.

    Commenting out the following just renders the site blank:

    echo '<li' . $alt . '>';
    echo '<a href="' . $bp->loggedin_user->domain . $bp->blogs->slug . '/create-a-blog">' . __('Create a Blog!', 'buddypress') . '</a>';
    echo '</li>';

    https://codex.buddypress.org/how-to-guides/modifying-the-buddypress-admin-bar/

    This tutorial doesn’t tell me how to identify the lines that specifically refer to “create a blog,” nor would it tell me, obviously, where/how to remove the “create a blog” option which appears on the Member’s profile page.

    The tutorial it refers to is the one I’ve been messing around with all day with no satisfying results. :/

    There seems to be no where listed how to identify the items to comment out, as they must be so obvious to a more skilled person.

    Keeping looking….


    Jeff Sayre
    Participant

    @jeffsayre

    Has anyone thought of a solution for this or can think of a way to accomplish it without needing to manually edit a lot of php?

    This is already easy to accomplish in the BuddyPress admin menu. Log into WPMU’s backend as Site Admin. Go to the BuddyPress menu grouping. Select “Component Setup > Blog Tracking” and disable the Blogs component.

    When you reload BuddyPress in your browser, you will see that the “Blogs” menu option under the “My Account” menu and the “My Blogs” menu are now gone. Also, members will not have the option to create blogs from their page.


    Jomark
    Participant

    @jomark

    I was looking for this in the code. Now I know it is just too easy by just disabling it at the buddypress admin. Thanks.


    Jason Giedymin
    Participant

    @jason_jm

    I posted something similar on trac around 8-22 with a patch

    https://trac.buddypress.org/ticket/933


    Jeff Sayre
    Participant

    @jeffsayre

    @JasonG

    I agree that it makes sense for BP to first check to see if blog creation has been disabled in WPMU’s backend, and if it has, to automatically disable the BP Blog menu options.


    elemsee
    Participant

    @elemsee

    @Jeff, yes, but it sounds as if your solution removes blogs from the bar altogether. We plan to make subscribers members of blogs that the Admins set up, just prevent them from creating their own blogs. Subscribers should be able to see the other blogs they’ve been added to.

    If I’m understanding the trac ticket, I agree when disabling blog creation in WPMU, the option should disappear from BuddyPress. That was our original hope, but alas no.

    Seeing the “create” option and being directed to a page that says “Sorry, no can do” doesn’t convey a user-friendly atmosphere, I think.

    @jason Your patch sounds as if it might achieve what I’m hoping. I’m earnestly studying my “Learn PHP the quick and easy way” book, so I’ll see if I can properly add this to bp_core-adminbar without … well, without screwing it up. :)

    Thank you so much for answering


    Jeff Sayre
    Participant

    @jeffsayre

    @elemsee

    but it sounds as if your solution removes blogs from the bar altogether. We plan to make subscribers members of blogs that the Admins set up…

    You have BuddyPress installed, I assume. So why don’t you give it a try–disabled the blog tracking and see what happens. It does exactly what you’re looking for. It prevents your members (users) from being able to create their own blogs. It does not hide the existing Admin blogs from them.

    If you have more than one Admin-created blog, you can place additional buttons, or fancy menus, to those Admin-based blogs.

    Unless you change the default behavior, WPMU by default makes all new users subscribers to the primary site blog (Blog ID number 1), which is the Admin blog. If you try out my suggestion, you will see that the “Blog” button is still visible. It takes users to the Admin-created blog. Only the “Blogs” button disappears for sight as it is a link to all user-created blogs, not the Admin blog.


    elemsee
    Participant

    @elemsee

    Jeff, thank you. I have tried out that option and it doesn’t do what I’d like.

    We, the admins, have set up a primary blog for our organization, as well as “user blogs:” cookbook.oursite.com; travel.oursite.com; etc. Some users will have posting access, others will not. We want user/contributors to have access to those blogs through the admin bar. We also want user-comments reflected on member “activity” pages. We simply do not want members to *create* blogs.

    In component setup, “blog tracking” is responsible for “Tracks blogs, blog posts and blogs comments for a user across a WPMU installation.”

    Disabling blog tracking as you’ve suggested does the following:

    — Removes “blogs” as an admin bar option. Yes, this removes “create a blog” but also removes access to any of the other blogs a user/contributor has permission to post to. It is removed for user/contributors and admins alike.

    — Removes the option from admin bar and member page to access the dashboard or write a new post for blogs you have posting permission — again for both user/contributors and admins.

    — Removes comment tracking: comments any user makes are no longer posted to the “activity” area.

    Respectfully, because I do appreciate anyone taking the time to answer, this is not the solution I’m looking for. Even if I decided to follow this route, and simply ask user/contributors to use the wp-login page — disabling blog tracking also disables comment tracking, which is a function I’d like to keep.

    Sorry for the tl;dr-esque response.


    elemsee
    Participant

    @elemsee

    @jason

    I tried your patch, editing the code in /core/bp-core-adminbar.php to:

    $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : '';

    if ( bp_blog_signup_enabled() ) {
    echo '<li' . $alt . '>';
    echo '<a href="' . $bp->loggedin_user->domain . $bp->blogs->slug . '/create-a-blog">' . __('Create a Blog!', 'buddypress') . '</a>';
    echo '</li>';
    }

    echo '</ul>';
    echo '</li>';
    }

    Does this look correct?

    If so, in layman’s terms, what should the outcome be (I want to be sure it matches up with what I’m seeing.)

    Thanks :)

    Already committed the patch to fix this.


    Jason Giedymin
    Participant

    @jason_jm

    Thanks!

    One less thing to compare (Mu+BP+BB)press to Anahita with when they launch.

    I can smell the write-ups now…

    …Right now would be a great time to release Channels for BB…


    elemsee
    Participant

    @elemsee

    If that means what I hope it does, I offer myself as a life-long fan :)

    And can now gratefully retire from hunting where I can edit the text “Blog registration is currently disabled”


    elemsee
    Participant

    @elemsee

    Patched bp-core-adminbar.php with:

    if ( bp_blog_signup_enabled() ) {
    echo '<li' . $alt . '>';
    echo '<a href="' . $bp->loggedin_user->domain . $bp->blogs->slug . '/create-a-blog">' . __('Create a Blog!', 'buddypress') . '</a>';
    echo '</li>';
    }

    line 171-176

    With “Only user account can be created” enabled.

    “Create a blog” still appears in admin bar and on member page.

    Tested as user without any posting permissions; blog contributor; admin.


    Jason Giedymin
    Participant

    @jason_jm

    I just tested this again and I’m not seeing what your seeing.

    Try clearing out your cache, and restart your server.

    Then re-try.


    elemsee
    Participant

    @elemsee

    Thank you, Jason. I’ve cleared my cache, as well as had two other people try this (restarting server not an option, unless my host can be asked to do so….)

    Let me walk through what I’ve done:

    • In wpmu site admin, “Only user account can be created” is enabled.
    • Within bp-core-adminbar.php, I replaced this code:

    echo '<li' . $alt . '>';
    echo '<a>loggedin_user->domain . $bp->blogs->slug . '/create-a-blog">' . __('Create a Blog!', 'buddypress') . '</a>';
    echo '';

    • With this code from the patch:

    if ( bp_blog_signup_enabled() ) {
    echo '<li' . $alt . '>';
    echo '<a>loggedin_user->domain . $bp->blogs->slug . '/create-a-blog">' . __('Create a Blog!', 'buddypress') . '</a>';
    echo '';
    }

    • Saved and re-uploaded to buddypress/bp-core
    • We created a new subscriber account to test. New user sees:

    — “My Account” in admin bar, with “Create a blog” on flyout

    — “You haven’t created any blogs yet, create one” on [profile] > Blogs > My Blogs

    — “Blog registration is currently disabled” on [profile] > Blogs > Create a Blog

    All “Create a blog” references should be gone, no?

    Any obvious misstep?


    Jason Giedymin
    Participant

    @jason_jm

    The patch will only remove the ‘Create a blog’ link which shows up in the buddybar, if blog creation has been disabled from within WPMU. Thats all really.


    elemsee
    Participant

    @elemsee

    Ok, but still. Leaving the member page issue aside, my question was/is: I’m trying to apply your patch. Is there something I’ve done wrong in the steps I outlined above that is resulting with the “create a blog” link NOT being removed from [the Buddy Bar]?

    I’ve cleared cache, I’ve used different computers, I’ve asked other people to check — the “create a blog” link remains. So I must be doing something wrong.

    I’d really like to be able to resolve this problem after a week or more of trying to uncover a solution. It seems to me it only makes sense that if user blog creation is disabled in WPMU that *all* instances of “create a blog” should logically disappear in BP.

    :S


    Jason Giedymin
    Participant

    @jason_jm

    I believe something could be wrong with your implementation.

    The link should be removed with the code from the patch.

    Make sure that if your using supercache to clear it or disable it to test.


    elemsee
    Participant

    @elemsee

    sigh

    I:

    — installed BP through wpmu plugin admin without any error messages.

    — have not altered any directories, save for moving bp-themes to wp-content as instructed in setup instructions.

    — have not touched any php files, save for bp-core-adminbar.php

    — have only added the code above.

    — am not using supercache.

    — have cleared computer cache three times.

    I’m going to have to find another solution. Maybe find the language “create a blog” and “blog registration has been disabled” and make it say something else. Thank you for your help, though.

    In the meantime, can someone either a) address my original question and create a plugin (not that I’m demanding someone do work for me) or b) add something to the BP admin where you can turn off “create a blog” instances, or c) any other solution that I am clearly not well-versed enough to think of.

    thanks.


    elemsee
    Participant

    @elemsee

    I ultimately contacted a developer friend who sorted out what to do.

    All instances of “create a blog” are now gone, including the one on the Member page.

    Thanks for trying to help.


    Nick Watson
    Participant

    @nickbwatson

    I know you’ve solved the problem but I recently used this as a solution, this code removes the Blogs button from both your “My Account” menu in the admin bar, and the Blogs button in your profile navigation.

    Put this code in your bp-custom.php file:

    function remove_blog_buttons(){
    remove_action( 'bp_setup_nav', 'bp_blogs_setup_nav' );
    remove_action( 'admin_menu', 'bp_blogs_setup_nav' );
    }
    add_action('plugins_loaded','remove_blog_buttons');

    I hope this helps

Viewing 23 replies - 1 through 23 (of 23 total)
  • The topic ‘Plugin request: Removing "create a blog" options’ is closed to new replies.
Skip to toolbar