• Resolved madmax4ever

    (@madmax4ever)


    I’m using your plugin and it’s really awesome!

    But recently I had users that registered then authenticated through different social networks (i.e. FB, Insta…) but were using different mails for each. Thus, they created different accounts and came to me to get only one, so I migrated their elements from different accounts to only one.
    But now I’d like to lock the accounts not to be used (a customer already forgot which social login he was supported to use and logged and used again a previous one, so I had to migrate again his elements…).

    I’ve already done it for WP classic login (ID or Email / Password), but it seems that the social login mechanism you provide doesn’t work the same.
    Do you offer any filter I could use to return my account status checking (enabled/disabled) and return it to your plugin so that it doesn’t grant access to any disabled account?

    That would be great.

    • This topic was modified 4 years, 1 month ago by madmax4ever.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Heateor Support

    (@heateor)

    Thanks for the compliment.
    You can add following code in the functions.php file or use it as a standalone plugin:

    /**
     * Check if user-account is disabled
     */
    function heateor_ss_account_check( $userId, $profileData, $socialId, $update ) {
    	if ( $userId == 1 ) {
    		the_champ_close_login_popup( home_url() . '?disabled=1' );
    		die;
    	}
    }
    add_action( 'the_champ_login_user', 'heateor_ss_account_check', 10, 4 );

    You can run checks on the $userId and put the url where you want to redirect user if their account is disabled, in the the_champ_close_login_popup function.

    Thread Starter madmax4ever

    (@madmax4ever)

    Thank you very much.
    That did the trick.
    Now I’m looking for a way to display an error on my login page, to behave as when a direct login attempt fails.
    Any advice?

    Once again: great plugin, and thanks for your support!

    Plugin Author Heateor Support

    (@heateor)

    Great.
    You can do something like following.

    /**
     * Show users a message if their account is disabled
     */
    function heateor_ss_user_disabled_msg() {
        if ( isset( $_GET['disabled'] ) ) {
            ?>
            <script type="text/javascript">
                alert('Your account has been deactivated');
            </script>
            <?php
        }
    }
    add_action( 'wp_head', 'heateor_ss_user_disabled_msg', 1 );
    Thread Starter madmax4ever

    (@madmax4ever)

    Thanks for your reply! ??

    Plugin Author Heateor Support

    (@heateor)

    No problem ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Any filter to deny login?’ is closed to new replies.