The MU forums have moved to WordPress.org

DON'T add_user_to_blog() (8 posts)

  1. plaverty
    Member
    Posted 14 years ago #

    When a new user account is created from the admin's dashboard, I see in the code that the form's action is "wpmu-edit.php?action=adduser". So I found wp-admin/wpmu-edit.php and the case that matches adduser. It simply has this line in there:

    add_user_to_blog('1', $user_id, 'subscriber');

    which I then switched to:

    // add_user_to_blog('1', $user_id, 'subscriber');

    Then saved, and went back and created a new user account from the admin's dashboard. The new user still got access to a blog, the default one. I don't want new users to get access to any blogs when they first get a new account, I want them to have to go fill out the form to get one. Any ideas on this one and how to shut it down?

  2. andrea_r
    Moderator
    Posted 14 years ago #

    When a user is added to the system, they are attached to the main as a *subscriber only*. This is so they have a user dashboard for things like changing their password. You can set up a dashboard blog under Site Admin -> Option if you don't want them off the main blog.

    In the early days, this was how MU was set up, and it caused all kinds of other issues (and complaints).

    To repeat: even if they are added as a subscriber to the main (or dashboard) blog, they can't actually *do* anything but look at their profile. that's it.

    You may also be interested in this plugin, which forces them to sign up as a user first, and then get a blog:
    http://wpmututorials.com/plugins/socialpress-user-signup-plugin/

  3. tdjcbe
    Member
    Posted 14 years ago #

    if you don't want them off the main blog

    Just to throw this in, if you do go the dashboard blog route outside of the main blog, give it a theme with an index.php file containing a redirect either back to the main blog or to the /wp-admin/. Else you'll get folks wondering why they can't post to that dashboard blog, getting confused, etc.

  4. andrea_r
    Moderator
    Posted 14 years ago #

    Sounds like a post in the making...

  5. vlm
    Member
    Posted 14 years ago #

    tdjcbe, would you be willing to explain your suggestion more fully? (As Andrea said, a post in the making. :):)

    Thank you kindly,
    Elchanan

  6. plaverty
    Member
    Posted 14 years ago #

    Thanks Andrea. The part about being a subscriber only made the little light go on for me. I think what I'll do is to make that blog be a tutorial/FAQ blog for the server, so every new user will have access to that, and then also be able to request a new blog of their own, or explain why they can't see/access some other private blogs and how to get access to them.

    Thanks.

  7. andrea_r
    Moderator
    Posted 14 years ago #

    If you name the blog dashboard they can't see the front end of the blog, it redirects to the admin or login area.

    Try naming one support or something and let me know how that works out.

  8. tdjcbe
    Member
    Posted 14 years ago #

    Actually Andrea said in another thread that the redirect is already occurring without the need for a theme.

    All we did previously was create a simple theme with two files. The style.css file just had the comment header, enough to tell wordpress that it was a theme.

    All the index.php file had was a redirect to the site's home page.

    <meta http-equiv="refresh" content="1;
    url=http://mymuinstall.tld/">

    or to the dashboards wp-admin.

    <meta http-equiv="refresh" content="1;
    url=http://dashboard.mymuinstall.tld/wp-admin/">

    Plus the other html, body and whatnot tags. Nothing else important though. Just the filler.

About this Topic