The MU forums have moved to

login help (2 posts)

  1. kitmobley
    Posted 14 years ago #

    I'm trying to figure out where to put some code that tests to see if user exists or not on another db in the wordpress mu login.

    I have the code already written, just having some trouble trying to find where to place it in wordpress.

    For example. someone enters login info, runs my code, if my code returns good then login to wp, if not then die.

  2. error
    Posted 14 years ago #

    The best place to hook in is the authenticate filter. $user is the user's object, if it exists, $username is the user's username that they typed in, and the same for $password.

    function mycode($user, $username, $password) {
        // do something during user authentication
        return $user;
        // or maybe you have a problem with the user?
        return new WP_Error('invalid_username', sprintf(__('<strong>ERROR</strong>: Invalid username. <a href="%s" title="Password Lost and Found">Lost your password</a>?'), site_url('wp-login.php?action=lostpassword', 'login')));
    add_filter("authenticate", "mycode", 10, 3);

About this Topic