Plugin Author
myCred
(@designbymerovingi)
Hey.
Have you tested the “Points for logging in” hook to award points for logins?
The hook will work with a few social media login plugins out there (but not all).
Yea, it works great for users signed up directly on the site but not with Super Socializer.
Plugin Author
myCred
(@designbymerovingi)
Can you link to the plugin in question please?
Plugin Author
myCred
(@designbymerovingi)
Hey.
Ok so this plugin does not fire of the wp_login action hook that WordPress comes with. It means that no other plugin (including myCRED) will be able to detect a successful login.
Try adding the following piece of code to your themes functions.php file:
add_action('wp_ajax_the_champ_user_auth', 'mycred_pro_intercept_login', 1 );
add_action('wp_ajax_nopriv_the_champ_user_auth', 'mycred_pro_intercept_login', 1 );
function mycred_pro_intercept_login() {
if(isset($_POST['error'])){
the_champ_log_error($_POST['error']);
}
if(!isset($_POST['profileData'])){
the_champ_ajax_response(0, 'Invalid request');
}
$profileData = $_POST['profileData'];
$response = the_champ_user_auth($profileData, $_POST['provider']);
// Login was a success
if ( $response['status'] === true ) {
// Fire of the wp_login WordPress action hook since
// this plugin does not.
// This will add support for myCRED and all other plugins
// that might need to know when a user has logged in.
$user_id = get_current_user_id();
$user = get_userdata( $user_id );
do_action( 'wp_login', $user->user_login, $user );
}
the_champ_ajax_response(intval($response['status']), $response['message']);
}
This code should intercept the login process and fire the wp_login hook when a user logs in.
Hello , i have similar problem , if i want to fire of the wp_login action hook for open social plugin https://wordpress.org/plugins/open-social/
how can i do ?
it basically doesn’t work with mycred in social login also
thanks