Support » Plugin: LoginWP (Formerly Peter's Login Redirect) » [Plugin: Peter's Login Redirect] Peter's Login Redirect error "Missing argument 3 for

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi

    I had the same problem and I managed to remove the error by going to line 396 of the file and deleting the last argument in the “redirect_wrapper”, which was $user.

    So line 396 was:

    function redirect_wrapper( $redirect_to, $requested_redirect_to, $user )

    and is now:

    function redirect_wrapper( $redirect_to, $requested_redirect_to )

    I can’t say for sure if this is going to cause any problems with redirects based on users, but the error message is gone.

    Cheers

    Hi,

    Regarding the “WordPress Login :: Red Rokk Widget Collection” plugin, looks like it needs to pass the third parameter as per the login_redirect hook expectations:

    http://plugins.trac.wordpress.org/browser/login-widget-red-rokk-widget-collection/trunk/login.php?rev=593031#L1526

    You’ll see that it does it properly here:
    http://plugins.trac.wordpress.org/browser/login-widget-red-rokk-widget-collection/trunk/login.php?rev=593031#L1220

    I wouldn’t recommend taking out the last argument in the redirect_wrapper function, but instead fixing any function(s) that aren’t providing it.

    So which file specifically needs to be changed and what code?

    Hi, I suggest asking the author of the Red Rokk plugin to define the $user object, and then add the $user object as the third parameter of the function call on line 1526 of login.php. They’ll have to best determine the exact call to define the object, as they are most familiar with the surrounding code.

    Hi!
    I finished writing a couple of lines in a function, so it will work correctly?

    Before:

    function redirect_wrapper( $redirect_to, $requested_redirect_to, $user )
    {

    After:

    function redirect_wrapper( $redirect_to, $requested_redirect_to, $user = NULL )
    {
    	if ($user === NULL) {
    		$user = wp_get_current_user();
    	}

    Thanks for sharing. Does that work in your environment? It might not if the user account hasn’t yet been initialized at that step. wp-login.php get the user account like this:

    $user = wp_signon(”, $secure_cookie);

    Any plugins implementing a custom login process should grab the user outside of the redirect process and pass it to the login_redirect filter.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Peter's Login Redirect] Peter's Login Redirect error "Missing argument 3 for’ is closed to new replies.