Community Support Forums — WordPress® ( Users Helping Users ) — 2011-09-10T20:11:50-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=14376 2011-09-10T20:11:50-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14376&p=34534#p34534 <![CDATA[Re: Conditional redirect to another page]]> Statistics: Posted by Bruce C — September 10th, 2011, 8:11 pm


]]>
2011-09-10T17:18:27-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14376&p=34518#p34518 <![CDATA[Re: Conditional redirect to another page]]> Statistics: Posted by cassel — September 10th, 2011, 5:18 pm


]]>
2011-09-10T03:47:44-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14376&p=34472#p34472 <![CDATA[Re: Conditional redirect to another page]]> Gremlins???

Statistics: Posted by cassel — September 10th, 2011, 3:47 am


]]>
2011-09-09T22:51:17-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14376&p=34442#p34442 <![CDATA[Re: Conditional redirect to another page]]>
You're missing the beginning quote on your first URL


This fixes it:

Code:
    <?php if (current_user_can('access_s2member_ccap_element') && !current_user_can('administrator')){ ?><script type="text/javascript">window.location = 'http://scrapbookcampus.com/element-creation-index/';</script><?php } else {?><?php } ?>

Statistics: Posted by Bruce C — September 9th, 2011, 10:51 pm


]]>
2011-09-09T20:58:30-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14376&p=34432#p34432 <![CDATA[Re: Conditional redirect to another page]]>
I have the sales page here: http://scrapbookcampus.com/register-ele ... -with-psp/ (for non registered members) and the index page here: http://scrapbookcampus.com/element-creation-index/ (for the registered members).

On the sales page, i put this:
Code:
<?php if (current_user_can('access_s2member_ccap_element') && !current_user_can('administrator')){ ?><script type="text/javascript">window.location = http://scrapbookcampus.com/element-creation-index/';</script><?php } else {?><?php } ?>


and on the index page, i put this:
Code:
<?php if (!current_user_can('access_s2member_ccap_element') && !current_user_can('administrator')){ ?><script type="text/javascript">window.location = 'http://scrapbookcampus.com/register-element-tutorials-with-psp/';</script><?php } else {?><?php } ?>


If i am a logged in member without proper ccaps access, i get redirected from the index to the registration page.
If i am logged in as a registered member with access to the ccaps "element" i am NOT redirected from the registration page to the Index page.
Am i missing something? Is there a little detail missing in the code?

Statistics: Posted by cassel — September 9th, 2011, 8:58 pm


]]>
2011-08-14T12:55:23-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14376&p=30769#p30769 <![CDATA[Re: Conditional redirect to another page]]>
Other than that, nope.

Statistics: Posted by Bruce C — August 14th, 2011, 12:55 pm


]]>
2011-08-14T12:47:58-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14376&p=30768#p30768 <![CDATA[Re: Conditional redirect to another page]]>
Do you know if there is any central place to list various codes like this on this forum? I am sure others would love to use something like that.

Statistics: Posted by cassel — August 14th, 2011, 12:47 pm


]]>
2011-08-14T12:44:49-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14376&p=30767#p30767 <![CDATA[Re: Conditional redirect to another page]]> :D

Statistics: Posted by Bruce C — August 14th, 2011, 12:44 pm


]]>
2011-08-14T12:41:42-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14376&p=30766#p30766 <![CDATA[Re: Conditional redirect to another page]]>
For the sale page, i used this code:
Code:
<?php if (current_user_can('access_s2member_ccap_basic') && !current_user_can('administrator')){ ?><script type="text/javascript">window.location = 'http://scrapbookcampus.com/welcome-to-the-basic-scrapping-course/';</script><?php } else {?><?php } ?>


and for the student page, i used:
Code:
<?php if (!current_user_can('access_s2member_ccap_basic') && !current_user_can('administrator')){ ?><script type="text/javascript">window.location = 'http://scrapbookcampus.com/register-basic-scrap-course-with-psp/';</script><?php } else {?><?php } ?>


Now, i was able to simply put the code in the Headway theme HTML leaf and NOT in the WP page, which made it easier to manipulate. I am pretty sure i will reuse that coding in future pages!!!
Thanks.

Statistics: Posted by cassel — August 14th, 2011, 12:41 pm


]]>
2011-08-14T12:33:50-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14376&p=30765#p30765 <![CDATA[Re: Conditional redirect to another page]]> Statistics: Posted by Bruce C — August 14th, 2011, 12:33 pm


]]>
2011-08-14T12:27:21-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14376&p=30764#p30764 <![CDATA[Re: Conditional redirect to another page]]>
If nothing else, it MIGHT be a compromise. However, i will look at putting all the page content in the content leaf instead of an html leaf. That might work in including the code on top.

I'll let you know
(but why it works in one way and not the other is beyond me!)

Statistics: Posted by cassel — August 14th, 2011, 12:27 pm


]]>
2011-08-14T12:22:56-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14376&p=30763#p30763 <![CDATA[Re: Conditional redirect to another page]]>
Anyway, you could try to use the JavaScript code again, but make sure it's at the top of the page. I'm guessing you put it at the bottom since the code was down there.

EDIT: I just checked your page. It looks like you might have forgotten the beginning <?php

Statistics: Posted by Bruce C — August 14th, 2011, 12:22 pm


]]>
2011-08-14T12:16:59-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14376&p=30762#p30762 <![CDATA[Re: Conditional redirect to another page]]>
EDIt: i formatted the code as you posted it, and it does not change. I do not get the redirect anymore from the course listing to the sales page if NOT logged in.

It is just odd that it works fine in one direction and not in the other one.

Statistics: Posted by cassel — August 14th, 2011, 12:16 pm


]]>
2011-08-14T12:06:29-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14376&p=30761#p30761 <![CDATA[Re: Conditional redirect to another page]]> Statistics: Posted by Bruce C — August 14th, 2011, 12:06 pm


]]>
2011-08-14T12:04:16-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14376&p=30760#p30760 <![CDATA[Re: Conditional redirect to another page]]>
However, in order to use it, you cannot use shortcode equivalents.
Code:
<?php
if (!current_user_can('access_s2member_ccap_basic') && !current_user_can('administrator'))
{
header( 'Location: http://scrapbookcampus.com/register-basic-scrap-course-with-psp/' ) ;
}
else
{}
?>


This way doesn't have the <head> code in it. This way the page will not view first. However, it will take just a bit longer to load.

Statistics: Posted by Bruce C — August 14th, 2011, 12:04 pm


]]>
2011-08-14T11:46:40-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14376&p=30757#p30757 <![CDATA[Re: Conditional redirect to another page]]>
Then, for the placeholder, any suggestion on how to avoid it?

Do you think using the other code that had the <head> in it would work better?

For the php edit, how would that impact other redirects i might want to use? I think it works out great to redirect the visitor to the matching sales page! Maybe something to integrate easier in the s2Member in future versions.

Statistics: Posted by cassel — August 14th, 2011, 11:46 am


]]>
2011-08-14T11:36:55-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14376&p=30755#p30755 <![CDATA[Re: Conditional redirect to another page]]>
It looks like that placeholder code is either duplicated, or not needed. Those shortcodes can do weird things sometimes (lol)

Statistics: Posted by Bruce C — August 14th, 2011, 11:36 am


]]>
2011-08-14T11:09:15-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14376&p=30753#p30753 <![CDATA[Re: Conditional redirect to another page]]>
Do you see that?

Also, at the very bottom of that page, i see some coding displayed so maybe i forgot something in the syntax or something like that.

Statistics: Posted by cassel — August 14th, 2011, 11:09 am


]]>
2011-08-14T11:03:37-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14376&p=30752#p30752 <![CDATA[Re: Conditional redirect to another page]]> Statistics: Posted by Bruce C — August 14th, 2011, 11:03 am


]]>
2011-08-14T11:03:00-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14376&p=30751#p30751 <![CDATA[Re: Conditional redirect to another page]]> Statistics: Posted by cassel — August 14th, 2011, 11:03 am


]]>
2011-08-14T10:53:51-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14376&p=30749#p30749 <![CDATA[Re: Conditional redirect to another page]]> Are you saying you get a never-ending loop whenever you put the code on the non-sales-pitch page?

Statistics: Posted by Bruce C — August 14th, 2011, 10:53 am


]]>
2011-08-14T10:35:22-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14376&p=30747#p30747 <![CDATA[Re: Conditional redirect to another page]]> http://scrapbookcampus.com) and i am logged in as an authorized member (Member1/Member1), and i clilck on the Basic Scrap Course box or the Basic Scrap in the navigation, i will get redirected, but it seems to be caught in a loop of redirecting all the time.

I just used the code up there, as is, i removed all the permission limitation (level and ccaps) so that only the redirect would be in effect. What did i do wrong?

EDIT: let me know when you come back and want to check that page so i can reset it like this. For now, i will put it back in a way that i know will leave access to the students.

Statistics: Posted by cassel — August 14th, 2011, 10:35 am


]]>
2011-08-13T23:08:08-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14376&p=30730#p30730 <![CDATA[Re: Conditional redirect to another page]]>
BUT.... this time i was using the code inside a leaf and not inside a PAGE in WP. Maybe that is the problem. I will do more tests tomorrow and i will get back to you!

Statistics: Posted by cassel — August 13th, 2011, 11:08 pm


]]>
2011-08-13T23:04:17-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14376&p=30728#p30728 <![CDATA[Re: Conditional redirect to another page]]>
Code:
[s2If !current_user_can(access_s2member_ccap_basic)]
<script type="text/javascript"> window.location = 'http://scrapbookcampus.com/register-basic-scrap-course-with-psp/';</script>
[/s2If]
[s2If current_user_can(access_s2member_ccap_basic)]
[/s2If]


Otherwise, I don't know what the problem could be.

Statistics: Posted by Bruce C — August 13th, 2011, 11:04 pm


]]>
2011-08-13T23:01:02-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14376&p=30727#p30727 <![CDATA[Re: Conditional redirect to another page]]> Statistics: Posted by cassel — August 13th, 2011, 11:01 pm


]]>