Forum Replies Created
-
AuthorPosts
-
Morgane
ParticipantFinnaly I put this code in the function.php file and it works
function redir() { $location = get_site_url() . "/en/membership-login/"; if(!SwpmMemberUtils::is_member_logged_in() && !is_page( array(17117, 17089, 17091, 17119, 17087, 17110) )) { wp_redirect( $location, 301 ); exit; } } add_action( 'template_redirect', 'redir' );Like that members are auto-redirect to login page when they’re not logged. 17117, 17089, … correspond to the ID of login page, registering page, password forget page, …
August 2, 2018 at 7:37 am in reply to: Warning: count(): Parameter must be an array or an object that implements Counta #15107Morgane
ParticipantThank’s for your help !
August 1, 2018 at 3:10 pm in reply to: Warning: count(): Parameter must be an array or an object that implements Counta #15097Morgane
ParticipantNo, I test with several users and it occurs each time.
Version 7.2.5 of PHPMorgane
ParticipantGood afternoon.
It’s “normal” you have this error message, actually the correct URL is https://knowledgecenter.buymanager.biz/en/ (I haven’t create the redirection yet).
And even if I deactivate the plugin, the problem is still here.
N.B. : if you try to go on the site, you won’t see the page
“This page isn’t working
knowledgecenter.buymanager.biz redirected you too many times.
Try clearing your cookies.
ERR_TOO_MANY_REDIRECTS”
because I remove the code/*** Auto redirect a user who isn't logged into the site ***/ add_filter( 'pre_get_posts', 'swpm_auto_redirect_non_members' ); function swpm_auto_redirect_non_members() { if( !SwpmMemberUtils::is_member_logged_in() && (!is_page(17089) || !is_page(17117) || !is_page(17091) || !is_page(17119) || !is_page(17087) || !is_page(17110) ) ) { wp_redirect( 'https://knowledgecenter.buymanager.biz/en/membership-login/' ); exit; }when I’m working on it…
Morgane
Participant
Morgane
ParticipantSorry, I wrote it to fast without thinking :/
If you cannot see the screenshot, here the real message :
“This page isn’t working
knowledgecenter.buymanager.biz redirected you too many times.
Try clearing your cookies.
ERR_TOO_MANY_REDIRECTS”Morgane
ParticipantThank’s for your answer. I tried to code it on my own but it doesn’t work. So I find in the documentation this code :
/*** Auto redirect a user who isn't logged into the site ***/ add_filter( 'pre_get_posts', 'swpm_auto_redirect_non_members' ); function swpm_auto_redirect_non_members() { if( !SwpmMemberUtils::is_member_logged_in() && (!is_page(17089) || !is_page(17117) || !is_page(17091) || !is_page(17119) || !is_page(17087) || !is_page(17110) ) ) { wp_redirect( 'https://knowledgecenter.buymanager.biz/en/membership-login/' ); exit; }But it didn’t work either. It’s wrote that my website is redirect too many time. Do you know why ?
-
AuthorPosts