WordPress.org

Ready to get started?Download WordPress

Forums

calling wp_loging (1 post)

  1. blackc2004
    Member
    Posted 6 years ago #

    Hi there. I am trying to integrate with ZenCart so that when someone logs into Zencart it also logs them into WordPress. I have made it so that registration between the two work, but I cannot get the wp_login to work.

    It seems to just die without an error. Here's my code:
    `function update (&$callingClass, $notifier, $paramsArray) {
    global $db;

    $email = $_POST['email_address'];
    $user_id = username_exists($email);
    if (!$user_id) {
    $user_id = email_exists($email);
    }
    if (!$user_id) {
    if ($_POST['password'] == '') {
    $user_pass = wp_generate_password();
    } else {
    $user_pass = $_POST['password'];
    }
    $user_id = wp_create_user( $email, $user_pass, $email );
    update_usermeta($user_id,'first_name',$_POST['firstname']);
    update_usermeta($user_id,'last_name',$_POST['lastname']);
    wp_new_user_notification($user_id, $user_pass);

    $user = wp_authenticate($email, $user_pass);

    if ( !is_wp_error($user) )
    return true;
    }
    }`

Topic Closed

This topic has been closed to new replies.

About this Topic