Hello TML Admin,
Please suggest me a solution for this, actually I have preapred my whole site with the use of theme my login plugin. Currently all user registers will go for moderation, please suggest me a solution to bypass the subscribers..
Thanks in advance
Sunil
Hello,
I found the solution, put a dropdown on register-form.php like :
<p>
<label for="role<?php $template->the_instance(); ?>"><?php _e( 'Role', 'theme-my-login' ) ?></label>
<select id="role<?php $template->the_instance(); ?>" name="role">
<option value="author">Author</option>
<option value="subscriber">Subscriber</option>
</select>
</p>
then put a function in function.php like :
function set_role_on_registration( $user_id ) {
//$role = sanitize_text_field( $_POST['role'] );
$role = $_POST['role'];
if ( in_array( $role, array( $role, 'bprofessional' ) ) )
add_user_meta( $user_id, 'pending_role', $role );
}
add_action( 'tml_new_user_registered', 'set_role_on_registration' );
then go to plugins/theme-my-login/modules/user-moderation/admin/user-moderation-admin.php and find user_row_actions function. Find case ‘admin’ : and put the below code in between start of case and its break; like :
$c_u_r = get_user_meta($user_object->ID, 'pending_role', true);
// Add "Approve" link
if($c_u_r != 'subscriber'){
$actions['approve-user'] = sprintf( '<a href="%1$s">%2$s</a>',
add_query_arg( 'wp_http_referer',
urlencode( esc_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ),
wp_nonce_url( "users.php?action=approve&user=$user_object->ID", 'approve-user' )
),
__('Approve', 'theme-my-login' )
);
}else{
if ( ! self::approve_user( $user_object->ID ) )
wp_die( __( 'You can’t edit that user.' ) );
}
Now the user moderation will not work for the users which registers asa subscriber. Modify the code and use it in your own way.
This may help some one.
Thanks
Sunil
has exactly the same problem. But i want to moderate only users registered as “Contributor” & auto approve subscribers..
But it isn’t good to modify plugin files directly..
TML, need a solution 🙂