aleyvic
Forum Replies Created
-
Forum: Plugins
In reply to: [Force Login] Steps to set specific Login & Register pagesKevin, Thanks for your respond. Just to complete the case I want to add an important info: My theme has a custom login and registration pages that override default WP login. They work fine when I deactivate the plugin. It also has “redirect after login” option where I have to choose the page to redirect to.
I just having problems with the redirection that gets stuck in the login page. It allows me to login only in the form but not in the login page (/login/).
Base on this, do you have any suggestion?
regards
Alejandro
Forum: Plugins
In reply to: [Force Login] Steps to set specific Login & Register pagesHi Kevin, I′m progressing with the configurations of the plugin in my theme. I need your help to finish it.
When I try to log in, it redirects to login page and so on. It looks like this: https://satreks.com/login/?redirect_to=https://satreks.com/loginI added to following code:
// Custom Login URL
function my_login_page( $login_url, $redirect ) {
return site_url( ‘/login/?redirect_to=’ . $redirect );
}
add_filter( ‘login_url’, ‘my_login_page’, 10, 2 );// Custom Registration URL
function my_registration_page( $register_url ) {
return site_url( ‘/register/’, ‘login’ );
}
add_filter( ‘register_url’, ‘my_registration_page’, 10, 1 );/**
* Filter Force Login to allow exceptions for specific URLs.
*
* @return array An array of URLs. Must be absolute.
*/
function my_forcelogin_whitelist( $whitelist ) {
$whitelist[] = site_url( ‘/’ );
$whitelist[] = site_url( ‘/login/’ );
$whitelist[] = site_url( ‘/register/’ );
return $whitelist;
}
add_filter(‘v_forcelogin_whitelist’, ‘my_forcelogin_whitelist’, 10, 1);function custom_wp_redirect_admin_locations() {
global $wp_rewrite;
if ( ! ( is_404() && $wp_rewrite->using_permalinks() ) )
return;$admins = array(
home_url( ‘wp-admin’, ‘relative’ ),
home_url( ‘dashboard’, ‘relative’ ),
home_url( ‘admin’, ‘relative’ ),
site_url( ‘dashboard’, ‘relative’ ),
site_url( ‘admin’, ‘relative’ ),
);
if ( in_array( untrailingslashit( $_SERVER[‘REQUEST_URI’] ), $admins ) ) {
wp_redirect( admin_url() );
exit;
}$logins = array(
home_url( ‘wp-login.php’, ‘relative’ )
);
if ( in_array( untrailingslashit( $_SERVER[‘REQUEST_URI’] ), $logins ) ) {
wp_redirect( site_url( ‘wp-login.php’, ‘login’ ) );
exit;
}
}function remove_default_login_redirect() {
remove_action(‘template_redirect’, ‘wp_redirect_admin_locations’, 1000);
add_action( ‘template_redirect’, ‘custom_wp_redirect_admin_locations’, 1000 );
}add_action(‘init’,’remove_default_login_redirect’);
Do you know What is missing?
thanks
Ale
Forum: Plugins
In reply to: [Force Login] Steps to set specific Login & Register pagesHi Kevin,
I used both alternatives and do not work. I changed the login url and also use the code you gave me. For this second alternative I have a question: Do I need to introduce anything within the code?Any suggestion?
thanks
Ale
Forum: Plugins
In reply to: [Force Login] Steps to set specific Login & Register pagesThanks Kevin. I will try.
I have the “too many trial error” in Chrone. Is that because of the custom registration page or because itherbplugins getting conflict with forcelogin plugin?
Thanks
Ale