Skip to content

Instantly share code, notes, and snippets.

@robertuniqid
Last active June 14, 2019 11:15
Show Gist options
  • Save robertuniqid/b598797253aabc21d823f22aa842e2c1 to your computer and use it in GitHub Desktop.
Save robertuniqid/b598797253aabc21d823f22aa842e2c1 to your computer and use it in GitHub Desktop.
eLearnCommerce - Get Autologin Token
<?php
$salt = wpep_get_setting( 'auto-login-link-salt' );
$user_token = get_user_meta( $user_id, WPEP_USER_META_AUTO_LOGIN_TOKEN, true );
if( $user_token === '' || $regenerate_tokens ) {
$user_token = sha1( $salt . wpep_generate_random_token( 32 ) );
update_user_meta( $user_id, WPEP_USER_META_AUTO_LOGIN_TOKEN, $user_token );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment