latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Custom redirection for restricted contents

Home Forums Community Forum Custom redirection for restricted contents

This topic contains 6 replies, has 2 voices. Last updated by  Eduan 3 years, 9 months ago.

Topic Author Topic
Posted: Monday Mar 25th, 2013 at 1:36 am #45626

Currently I am using 3 levels of memberships,free(0-level) and level-1 and level-2……Each level of members can’t see other’s content…like level 1 can’t view level-0 content..to do that I used shortcode conditionals [s2If current_user_is(s2member_level0)]…..

Now my question is following:-

If a member at Level-1 want to view level-0’s page,I want to redirected them to any of my other page…Similarly,if a member at any level want to view the page that is restricted to other level,then he will be redirected to a predefined page…..I want to do that…Kindly tell me how can I do that?

List Of Topic Replies

Viewing 6 replies - 1 through 6 (of 6 total)
Author Replies
Author Replies
Posted: Tuesday Mar 26th, 2013 at 10:05 am #45754
Eduan
Username: Eduan
Moderator

Hello Prasenjit,

You can accomplish that using the conditionals you are using, along with some JavaScript to cause the redirection.

However, since you don’t want each level to see what other levels have, I suggest you start using custom capabilities instead: Video » s2Member (Custom Capabilities)

– Eduan

Posted: Saturday Mar 30th, 2013 at 12:39 am #46121

Hello Eduan,

Thanks for replying……… As of now I am using short code conditionals [s2If current_user_is(s2member_level0)] to restrict content from one level to another….Can you please tell me those javascript which cause my desired redirection…

My requirement is follows- If a member at Level-1 want to view level-0′s page,I want to redirected them to any of my other page…Similarly,if a member at any level want to view the page that is restricted to other level,then he will be redirected to a predefined page

Posted: Saturday Mar 30th, 2013 at 11:20 am #46144
Eduan
Username: Eduan
Moderator

The JavaScript to cause the redirections that you want would be the following:

<script type="text/javascript">
window.location = "http://url.to-redirect-to.com/";
</script>

You would put that in between conditionals so that it only redirects if the user doesn’t have the necessary access. :)

– Eduan

Posted: Saturday Mar 30th, 2013 at 1:28 pm #46150

Thanks a lot for replying….

Actually I don’t know much about coding..and I put that conditionals [s2If current_user_is(s2member_level0)] simply on my wordpress text editor….but most probably that javascript won’t work on the wordpress text editor…..Can you please tell me where to exactly put that code?….Which file I have to edit?

Posted: Tuesday Apr 2nd, 2013 at 1:07 am #46342

Hello,

Anybody please reply to my last question…..

Posted: Tuesday Apr 2nd, 2013 at 3:57 pm #46410
Eduan
Username: Eduan
Moderator

Hello Prasenjit,

You can’t do that in the WordPress visual editor, you need to make sure it’s in the text editor, and once you put it in the text editor you can’t go back to the visual editor or it’ll break.

– Eduan

Viewing 6 replies - 1 through 6 (of 6 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.