Warnings at first login when changing default role for site-owner (3 posts)

  1. hundsim
    Posted 5 years ago #

    This handy code snippet (named whatever and put in mu-plugins folder) effectively changes the role of the account administering a sub-site in a Network (multisite) environment:

    function ds_new_user_meta($blog_id, $user_id) {
     add_user_to_blog($blog_id, $user_id, 'author' );
    add_action( 'wpmu_new_blog', 'ds_new_user_meta', 10, 2 );

    When the newly created user/account for the first time goes to sub-site.example.com/wp-login.php, these two warnings appear on multiple lines:

    Warning: Invalid argument supplied for foreach() in /public_html/wp-includes/query.php on line 1689

    Warning: Cannot modify header information - headers already sent by (output started at /public_html/wp-includes/query.php:1689) in /public_html/wp-login.php on line 353

    If the page is refreshed, the warnings disappear.

  2. First check if you have any blank lines above <?php and below ?>

  3. hundsim
    Posted 5 years ago #

    Nope, no blank lines.

Topic Closed

This topic has been closed to new replies.

About this Topic