I have added some functions to my function.php
and it works really great. The only problem I see is that when the users Sign Up, its shown twice in "Simple History". That means my function are triggering registration twice?
I am still learning, some help will be highly appreciated.
// URL set USER ROLE
add_action('user_register', 'register_role');
function register_role($user_id, $password="", $meta=array()) {
$userdata = array();
$userdata['ID'] = $user_id;
$userdata['role'] = $_POST['role'];
//only allow if user role is my_role
//allow other roles
if ( ($userdata['role'] == "vip_member") or ($userdata['role'] == "free_member") ) {
wp_update_user($userdata);
}
}
add_action('register_form','show_role_field');
function show_role_field(){ ?>
<p>
<label style="display: block; margin-bottom: 5px;">Role
<select id="role" name="role" class="input">
<option value='vip_member'>VIP Member</option>
<option value='free_member'>Free Member</option>
</select>
</label>
</p>
<?php
}