fbpx

Premium Support Forum

Solve conflict with...
 
Notifications
Clear all

Solve conflict with User Verification Plugin or this script...

Page 1 / 2

wholebiz
Posts: 4
Topic starter
(@wholebiz)
New Member
Joined: 3 months ago

Hi,

I want to use some form of email validation along with LLAR. However, there are conflicts between LLAR and the User Verification plugin, and also with this simple script:

/* Only allow administrators to login */
add_filter( 'authenticate', 'my_admin_check', 100, 1 );

function my_admin_check( $user ) {
    // Make sure this is a real login attempt, without errors
    if ( !is_wp_error($user) ) {
        $user_role = $user->roles[0];
        // add or remove the roles you want to allow/disallow (can be a custom role or regular WordPress roles)
        if ( !in_array( $user_role, array( 'trade_customer' ) ) ){
            return new WP_Error( 'login_failed', __( "Only staff can use this login.", "mysite_domain" ) );
        } else {
            // allow the login
            return $user;   
        }
    } else {
        // We're just loading the login page, not running a login.
        return $user;       
    }
}   

 

When either the User Verification plugin or the above script fire, the scripts prevent the login, but LLAC considers it to be a failed attempt. The LLAC login warning message shows the count of remaining login attemps, but the warning message for the plugin or script never show. Is there a way we can have either the plugin or this script evaluate first?

TBH, I'm leaning toward using the script because I can adjust the settings I need myself. 

Thanks! 

5 Replies
admin
Posts: 52
Admin
(@admin)
Member
Joined: 1 year ago

Hello wholebiz. We will have our dev team look into this and get back to you once we have more information.

Reply
wholebiz
Posts: 4
Topic starter
(@wholebiz)
New Member
Joined: 3 months ago

Thanks!

Reply
admin
Posts: 52
Admin
(@admin)
Member
Joined: 1 year ago

Here's the solution for you:

In the add_filter( 'authenticate', 'my_admin_check', 100, 1 ); line change 100 to 4

Let us know if this worked.

Reply
wholebiz
Posts: 4
Topic starter
(@wholebiz)
New Member
Joined: 3 months ago

Thank you, but I discovered that I need to stick with the User Verification plugin because my membership system, Memberpress, is tightly integrated with that. 

Are you able to help me accommodate User Verification?
https://wordpress.org/plugins/user-verification/

 

Reply
Page 1 / 2