add_action('login_form', 'wdm_login_form_role');
function wdm_login_form_role()
{
?>
<p><label for="user_role">Role<br>
<select name="role" style="flaot:left;width:100%;margin-bottom:10px;padding: 10px;">
<option value="publishers">Publishers</option>
<option value="advertisers">Advertisers</option>
</select></label>
<p>
<?php
}
add_filter('wp_authenticate_user','wdm_validate_login_role',10,2);
function wdm_validate_login_role($user, $password) {
$ruser= get_user_by('login',$_POST['log']);
if($ruser){
if($ruser->roles[0]==$_POST['role']){
return $user;
}
else{
return null;
}
}
}
function wdm_login_form_role()
{
?>
<p><label for="user_role">Role<br>
<select name="role" style="flaot:left;width:100%;margin-bottom:10px;padding: 10px;">
<option value="publishers">Publishers</option>
<option value="advertisers">Advertisers</option>
</select></label>
<p>
<?php
}
add_filter('wp_authenticate_user','wdm_validate_login_role',10,2);
function wdm_validate_login_role($user, $password) {
$ruser= get_user_by('login',$_POST['log']);
if($ruser){
if($ruser->roles[0]==$_POST['role']){
return $user;
}
else{
return null;
}
}
}
No comments:
Post a Comment