Skip Navigation

[Resolved] Redirect user to login page with Toolset Access

This thread is resolved. Here is a description of the problem and solution.

Problem:
When a non logged in user tries to access a page or post that is only for logged in users redirect to the login form.

Solution:
I have achieved redirection for non-logged-in users using Access plugin, I have recorded a short video to demonstrate this:
https://drive.google.com/file/d/0B5EmJQ1qcuyqUVVCc1d6RFZSeVk/view?usp=sharing

This is the html code I have used for redirection in Content Template, you can replace the url in this:

<meta http-equiv="refresh" content="0; url=http://example.com/" />
This support ticket is created 7 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 6.84 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 -
- 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 4 replies, has 2 voices.

Last updated by marcB-6 7 years, 1 month ago.

Assisted by: Noman.

Author
Posts
#576012
Screenshot_4.png
Screenshot_3-min.png

When a non logged in user tries to access a page or post that is only for logged in users redirect to the login form.
I have refereed this link : https://toolset.com/forums/topic/redirect-to-a-custom-login-page/ but, it is changing the template not redirecting to the login page.

Please check page url in attached screenshot.

#576056

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Marc,

Thank you for reaching out to us. I believe we can do that with combination of using Toolset Access, Content Template and by adding html redirect code inside the Content Template.

I am going to test this at my end and will share the steps with you shortly.

Thank you

#576060
Screenshot_5.png
Screenshot_15.png

Hi Noman,

I did as mentioned below.
Added shortcode in functions.php

function mycode() {
wp_redirect(home_url('/sign-in/'));
exit;
}
add_shortcode( 'mycode', 'mycode' );

I have used same in content template & registered short code as well in Toolset Settings > Front-end Content > Third-party shortcode arguments. But my content template is not getting saved.

Please check attached screenshot for the same.

Thanks

#576118

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hello Marc,

I have achieved redirection for non-logged-in users using Access plugin, I have recorded a short video to demonstrate this:
https://drive.google.com/file/d/0B5EmJQ1qcuyqUVVCc1d6RFZSeVk/view?usp=sharing

This is the html code I have used for redirection in Content Template, you can replace the url in this:

<meta http-equiv="refresh" content="0; url=<em><u>hidden link</u></em>" /> 

Thank you

#576350

Its working...Thanks Noman!!