I have managed to create a plugin which creates a unique number on registration. However, now it comes to having the player login into their front end control panel. So far I am using the following as an example:

<form action="" method="post">
        Player id: <input name="log" type="text" />
        Password: <input name="pwd" type="password" />
        <input type="submit" value="Login" />
        <input type="hidden" name="action" value="my_login_action" />

How do I login with only the player ID and password?

I don't want to login with email or username. Bare in mind, this is for a front end dashboard as well, so I think I'm using the wrong code:

add_action( 'init', function() {    
    // Not the login request?
    if ( ! isset( $_POST['action'] ) || $_POST['action'] !== 'my_login_action' )

    // See the Codex for wp_signon()
    $result = wp_signon();

    if ( is_wp_error( $result ) )
        wp_die( 'Login failed. Wrong password or user name?' );

    // Redirect back to the requested page if login was successful    
    header( 'Location: ' . $_SERVER['REQUEST_URI'] );
} );
  • I'd guess that you would need to do a user query for the user with matching player ID, then use the resulting username with the password to log them in.
    – Milo
    Commented Oct 19, 2015 at 2:06
  • @Milo and others I found a really need plugin that does what I need admincolumns.com/documentation Commented Oct 19, 2015 at 9:07


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.