WordPress.org

Ready to get started?Download WordPress

Forums

WP Signon and set user via custom login SSO (Single-Sign-On) (3 posts)

  1. TeckniX
    Member
    Posted 3 years ago #

    I'm currently using the Function/API calls to wordpress in order to get my custom login to work.

    I'm basically tying a regular php login, with the wordpress login. I'm using the following actions:

    $creds = array();
    $creds['user_login'] = $username;
    $creds['user_password'] = $password;
    $creds['remember'] = true;
    $user = wp_signon( $creds, false );
    wp_set_current_user($user->ID);

    This all seems to work well as just about all wp cookie settings are created:

    Array
    (
        [wp-settings-1] => editor=html&uploader=1&align=none&m1=o
        [wp-settings-time-1] => 1307032216
        [wp-settings-time-2] => 1307046336
        [wp-settings-2] => m3=o&m5=c&m1=c
        [wordpress_test_cookie] => WP Cookie check
    )

    Obviously there's a bug somewhere as the full wordpress login looks like this:

    Array
    (
        [wp-settings-1] => editor=html&uploader=1&align=none&m1=o
        [wp-settings-time-1] => 1307032216
        [wp-settings-time-2] => 1307046336
        [wp-settings-2] => m3=o&m5=c&m1=c
        [wordpress_test_cookie] => WP Cookie check
        [wordpress_logged_in_1307046336asdadasdasdsadasdas] => my_user|1307046336|asdadasiodjasdiasjasdasdsa
    )

    The 'wordpress_logged_in' part is what allows the user to view the admin bar and not have to worry about logging in once again.

    My question is how do you get wordpress to correctly create a correct login session via the api/function reference?

    The above code should work per the documentations, but obviously doesn't.

  2. TeckniX
    Member
    Posted 3 years ago #

    No one uses a custom login and can help with this??

  3. TeckniX
    Member
    Posted 3 years ago #

    Looking through some of the code and whatnot - Unless you call the above plugins from the directory of wordpress none of the cookies are setup correctly.
    Everything is hard-coded in wordpress yet it doesn't do that.
    Same thing happens when you call logout.

    Defeats the purpose of the functions if you can only call them from within wordpress. Oh wait people only live with wordpress code!

Topic Closed

This topic has been closed to new replies.

About this Topic