WordPress.org

Ready to get started?Download WordPress

Forums

Forcing a Login (1 post)

  1. andrewhouse
    Member
    Posted 2 years ago #

    Hi, thanks for reading...

    First of all, I'm not much of a PHP developer, but I've been told what is causing the issue in my code. I have a revised plugin whose function is to take the values from a form submit (name and email) and send it to the admin of the site via email. The site visitor sees this form on pages that the admin specifies as "secure". Once the visitor submits the form, the content of the page is unlocked via a refresh. Here is the part of the code that has the issues:

    wp_set_current_user($user_id, $user_login);
    wp_set_auth_cookie($user_id);
    do_action('wp_login', $user_login);
    sleep(5);

    I've been told that everything here is fine, EXCEPT that the script is not logging in the user before the refresh. Is there a line of code that I can put here to make this work? I've attached the plugin if you need a more in-depth look.

    Thanks again for any assistance. And I apologize if I didn't follow any part of the posting protocol properly.

Topic Closed

This topic has been closed to new replies.

About this Topic