WordPress.org

Ready to get started?Download WordPress

Forums

Peter's Login Redirect
Peter's Login Redirect error "Missing argument 3 for (7 posts)

  1. gammax500
    Member
    Posted 2 years ago #

    Warning: Missing argument 3 for redirect_wrapper() in .../public_html/wp-content/plugins/peters-login-redirect/wplogin_redirect.php on line 396. I have a few other plugins installed that may (or not!) be causing a conflict. The one I think may be a problem is plugin: WordPress Login :: Red Rokk Widget Collection.

    http://wordpress.org/extend/plugins/peters-login-redirect/

  2. Diarmuid
    Member
    Posted 2 years ago #

    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

  3. Peter
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  4. bentyla
    Member
    Posted 1 year ago #

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

  5. Peter
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  6. Nord001
    Member
    Posted 1 year ago #

    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();
    	}
  7. Peter
    Member
    Plugin Author

    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic