• Hi,
    I am working on a multisite which is using subdirectories and I have a frontend registration form that works, but every new user that signs up is automatically a contributor. Which is fine for regular registration but I am also allowing users to sign up for a blog/site and that is also done successfully but the user remains a contributor. How can I correct this so that they become admin ( but I do not want them to access the backend ) ??

    As of now I see no options like before under general->settings for setting the user default.

    Any help would be much appreciated. Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    How can I correct this so that they become admin ( but I do not want them to access the backend ) ??

    You have a paradox sir.

    Admins can access the backend.

    What ‘front end’ form are you using?

    Thread Starter MYGM

    (@mygm)

    Hi Thanks for the response.

    Ok I understand what you are saying so let me clarify –

    I have this plugin Marketpress and a front end add on for it which allows users to do everything (manage their products etc. ) on the front end. It is used for ecommerce and in order for a user to have their own ‘store’ they have to create a blog/site. They wont use this blog for nothing other then the functions that are available to them on the front end.

    So I would like to keep it so that only super admins can access the back end. However they need to be an admin so that they can use these store functions on the front end.

    So basically I need them to be admins of their own blog but whenever a user signs up for a blog they do not become admins but instead remain contributors. I hope this makes sense, but if not I can clarify further.

    I really appreciate any help on this.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    You need some very custom work and a lot of it means you need a MarketPress expert. I’m not one 🙂

    In general I can tell you this: you need to get a role manager plugin to make a new role that grants them whatever permissions they need to use MarketPress, without actual admin access.

    I cannot tell you what those permissions are, I have no idea, but that’s what you need to do. Once you have that new role, that’s what you make people.

    Thread Starter MYGM

    (@mygm)

    Ok thanks, I understand but for now though I am looking to resolve this issue – Users that create a new blog/site should be admins of their site but for some reason that doesn’t seem to be happening.

    My other option would be, if I can’t make the above work like it should, then how can I modify the following code to check if a user has a site or not on the network –

    <?php global $wp_roles;
    foreach ( $wp_roles->role_names as $role => $name ) :
    if (current_user_can( $role ) && $role == 'administrator') { ?>
                    <?php if ( class_exists( 'MarketpressFadminWidget' ) ) { ?>
     <?php
     $mp_frontend_settings = get_option( 'mp_frontend_settings' );
     $mp_frontend_settings = unserialize($mp_frontend_settings);
     $adminpage = $mp_frontend_settings['page_id'];
     $permalink = get_permalink($adminpage);
     ?>
    //My Links/Content
    
     <?php } ?>
    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Users that create a new blog/site should be admins of their site but for some reason that doesn’t seem to be happening.

    You have to answer the question I asked before 😉 What front end registration tool are you using?

    Thread Starter MYGM

    (@mygm)

    Im using a custom form –

    <?php
    if(get_option('users_can_register')) {
    //Check whether user registration is enabled by the administrator
    ?>
    
    <?php
    
    if($_POST){
        //We shall SQL escape all inputs
        $username = $wpdb->escape($_REQUEST['username']);
        if(empty($username)) {
            echo "<span style='color:#FF0000'><strong>Error..</strong></span><br /><br />You have to fill in the username.";
            exit();
        }
        $email = $wpdb->escape($_REQUEST['email']);
        if(!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/", $email)) {
            echo "<span style='color:#FF0000'><strong>Error..</strong></span><br /><br />please use a calid e-mailadress.";
            exit();
        }
    
        $pass1 = $wpdb->escape($_REQUEST['pass1']);
    $pass2 = $wpdb->escape($_REQUEST['pass2']);
    if ($pass1 != $pass2){
        echo "<span style='color:#FF0000'><strong>Error..</strong></span><br /><br />please use a passwords don't match.";
            exit();
    
    }
    $random_password = $pass1;
        $status = wp_create_user( $username, $random_password, $email );
        if ( is_wp_error($status) )
            echo "<span style='color:#FF0000'><strong>Feil..</strong></span><br /><br />Username allready exist. please try another one.";
        else {
            $from = get_option('admin_email');
            $headers = 'From: '.$from . "\r\n";
            $subject = "Registration ok!";
            $msg = "Welcome, you are now registered. Here is your username and password.\Info:\Username: $username\Password: $random_password";
            wp_mail( $email, $subject, $msg, $headers );
            echo "<strong>You are now registered. An e-mail is now sent to you with your username and password..";
        }
    
        exit();
    
    }
     else
    {
    //Embed the register form and javascript here
    
    ?>
    
    <div id="result"></div>
    <div style="padding-top:5px;"><h2 style="font-size:16px;color:#06f;">Register</h2></div>
    
    <form id="wp_signup_form" action="" method="post">
    <p><label>Username<br />
    <input type="text" name="username" style="width:250px; margin-bottom:3px;"></label></p>
    <p><label>E-Mail<br />
    <input type="text" name="email" style="width:250px; margin-bottom:3px;"></label></p>
    <p><label>Password<br />
    <input type="password" name="pass1" style="width:250px; margin-bottom:3px;"></label></p>
    <p><label>Repeat Password<br />
    <input type="password" name="pass2" style="width:250px; margin-bottom:3px;"></label></p>
    <br />
    <input type=checkbox name="termsnp">By registering I agree to the terms and policy<br /><br />
    <input type="submit" id="submitbtn" name="submit" value="Register" class="knapp" style="padding:8px;">
    </form>
    <script type="text/javascript">
    $("#submitbtn").click(function() {
    $('#result').html('<img src="<?php bloginfo('template_url'); ?>/images/loader.gif" class="loader" />').fadeIn();
    var input_data = $('#wp_signup_form').serialize();
    $.ajax({
    type: "POST",
    url:  "<?php echo "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>",
    data: input_data,
    success: function(msg){
    $('.loader').remove();
    $('
    <div>').html(msg).appendTo('div#result').hide().fadeIn('slow');
    }
    });
    return false;
    
    });
    </script>
    <?php
    // embedded
    
    }
    ?>
    
    <?php
        }
    ?>
    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Uh. Wow. That form is hugely overly complicated.

    WP has a built in ‘front end’ form: domain.com/wp-signup.php

    And if you want to make your own, you would want to follow directions like this: http://halfelf.org/2012/multisite-registration/

    So you’ve done something weird in your fork there

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Default user role option missing and is not correct for new users’ is closed to new replies.