WordPress.org

Support

Support » Plugins and Hacks » Page Restrict » [Plugin: Page Restrict] redirect too>>

[Plugin: Page Restrict] redirect too>>

Viewing 3 replies - 1 through 3 (of 3 total)
  • sofar the support…. ill guess

    i would like to know if this can be done too, at present i have created a hyper link on the first page but its not ideal

    I had a similar problem.

    The page restrict form correctly contains an

    <input type="hidden" name="redirect_to" value="' . $_SERVER['REQUEST_URI'] . '" />

    that redirects the user logging in to the original page, okay.

    My problem was registration of new users.

    The page restrict form contains this following code to add a “register” link:

    if ( get_option('users_can_register') )
    $pr_page_content .= '	<a href="' . get_bloginfo ( 'wpurl' ) . '/wp-register.php">'.__('Register','pagerestrict').'</a> | ';

    I modified the plugin to add a register_to parameter to the wp-register URL.

    The problem is that wp-register does NOT forward this redirection variable after the user has completed the registration dialog, so the following “login” page does not redirect ok.

    The solution was to replace the call to wp-register.php by a call to wp-login.php?action=register&redirect_to=…

    I don’t know the difference, but it works!

    So now the plugin code to generate the register link reads:

    if ( get_option('users_can_register') ) {
    	//if the redirect url is not empty, pass this to the register dialog
    	if(strlen(trim($_SERVER['REQUEST_URI']))>0) {
    		$redir="&redirect_to=".$_SERVER['REQUEST_URI'];
    	} else {
    		$redir="";
    	}
    	$pr_page_content .= '	<a href="' . get_bloginfo ( 'wpurl' ) . '/wp-login.php?action=register'.$redir.'">'.__('Register','pagerestrict').'</a> | ';
    }

    and it works.
    It would be nice if the plugin author was ok to integrate this change in the next version of the page restrict plugin… thanks!

    Also note, that I had problems with Theme My login. I choose to delete this plugin, and use the standard wordpress login/register page instead.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Page Restrict] redirect too>>’ is closed to new replies.
Skip to toolbar