• In the wsl_process_login_create_wp_user function, the following lines…

    if( apply_filters( ‘wsl_hook_process_login_alter_userdata’, $userdata, $provider, $hybridauth_user_profile ) ){
    $userdata = apply_filters( ‘wsl_hook_process_login_alter_userdata’, $userdata, $provider, $hybridauth_user_profile );
    }

    …actually call the functions hooked to wsl_hook_process_login_alter_userdata twice.

    You could use…

    if( has_filter( ‘wsl_hook_process_login_alter_userdata’) ){
    $userdata = apply_filters( ‘wsl_hook_process_login_alter_userdata’, $userdata, $provider, $hybridauth_user_profile );
    }

    … but I believe the best way to do what this is attempting (unless I am misunderstanding), is to to do this…

    $userdata = apply_filters( ‘wsl_hook_process_login_alter_userdata’, $userdata, $provider, $hybridauth_user_profile );

    … without an if() condition. If no filters are attached to the hook, the $userdata will pass through untouched.

    Also..

    I’d like to be able to redirect the user at the end of the login process based on certain conditions, but the hookable action at the end of wsl_process_login_authenticate_wp_user is not sufficient because it does not pass the $redirect_to variable.

    I’d recommend a filter…

    $redirect_to = apply_filters( ‘wsl_hook_process_login_alter_redirect’, $redirect_to, $userdata, $provider, $hybridauth_user_profile );

    Or you could just pass the $redirect_to variable as an additional parameter on the wsl_hook_process_login_before_redirect action.

    http://ww.wp.xz.cn/extend/plugins/wordpress-social-login/

The topic ‘Suggested improvements to wsl.authentication.php’ is closed to new replies.