Subscribers become Authors after Upgrade? / Mass Update of Users?

I have a site with ~30K users, and the vast majority have role 'subscriber' on the main blog. After upgrading from WPMU 2.9.2 to WordPress 3.0.1 I noticed that all 30,0000 users are appearing in the main blog’s “Author” dropdown in post-new.php. (Well, that is if it manages to load without crashing the browser…).

To clarify: the users all still have subscriber-level access, but are included in “Author” dropdown.

Read More

Before I go diving down in to the guts of /wp-admin/, has anyone else seen this? Does anyone know if this behavior is an intentional change in WordPress?

Thanks,
Bethany

Related posts

Leave a Reply

1 comment

  1. Hi @Bee:

    I have no idea why this happened. But if I understand your problem correctly you need to set these user records back to being 'subscriber' instead of 'author', right?

    Normally I would not recommend direct SQL update like this but given the nature of the problem and it being a one-time thing I think it will be okay.

    But first BACK UP YOUR DATABASE before you try any of this.

    Here’s the SQL to run based on what I know of the internals of WordPress and also based on this support question (this assumes that the prefix for your main tables is 'wp' and also assumes you are okay to set all users assigned to with 'author' back to subscriber and manually make any corrections using the WordPress admin console.) So if you know how to run this SQL from a SQL query tool, go for it:

    UPDATE 
      wp_usermeta 
    SET 
      meta_value='a:1:{s:10:"subscriber";s:1:"1";}'
    WHERE 1=1
      AND meta_key='wp_capabilities' 
      AND meta_value LIKE '%author%'
    

    If you are not comfortable with running SQL from a query tools then you can drop this into the root of your website (call it /update-users.php or similar) and then run it by calling the URL http://example.com/update-users.php from your browser (replacing http://example.com with your actual site domain, of course):

    <?php
    include "wp-load.php";
    global $wpdb;
    $sql =<<<SQL
    UDPATE
      wp_usermeta
    SET
      meta_value='a:1:{s:10:"subscriber";s:1:"1";}'
    WHERE 1=1
      AND meta_key='wp_capabilities'
      AND meta_value LIKE '%author%'
    SQL;
    $wpdb->query($sql);
    echo 'Done!';
    

    P.S. Please report back to us on your success, or if you need more help.