Community Support Forums — WordPress® ( Users Helping Users ) — 2011-09-05T00:37:26-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=14655 2011-09-05T00:37:26-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14655&p=34027#p34027 <![CDATA[Re: What I desperatly need.]]> http://holistic-living-today.com/detox- ... gar-detox/? That page doesn't seem to even exist, I get a 404.

I'm glad you got it working, though. Well done. :)

You could just protect the pages that require the ccap, using the s2Member meta box in the edit page. Then the hack would not need to check for it and it can just be:

Code:
<?php
add_action 
('template_redirect', 'my_s2_custom_capabilities');
function my_s2_custom_capabilities()
{
    $drips = array(
        7  => array(3, 4, 5),
        14 => array(6, 7, 8),
        21 => array(9, 10, 11),
        28 => array(12),
    );
    foreach ($drips as $drip_day => $drip_pages)
    {
        if (S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS < $drip_day && is_page($drip_pages))
        {
            wp_redirect('http://example.com/not-yet-available-to-you/');
            exit;
        }
    }
}
?>


Let me know if that helps. :)

Statistics: Posted by Cristián Lávaque — September 5th, 2011, 12:37 am


]]>
2011-09-04T12:56:34-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14655&p=33985#p33985 <![CDATA[Re: What I desperatly need.]]>
The last statement the else wpredirect was causing a internal forever loop and not letting anything move forward. I removed the else wpredirect and am now cruising along very nicely

Statistics: Posted by twaycaster — September 4th, 2011, 12:56 pm


]]>
2011-09-03T21:19:45-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14655&p=33937#p33937 <![CDATA[Re: What I desperatly need.]]> HTTP 500
Most likely causes:
•The website is under maintenance.
•The website has a programming error.

What you can try:
Refresh the page.

Go back to the previous page.

More information

Statistics: Posted by twaycaster — September 3rd, 2011, 9:19 pm


]]>
2011-09-03T13:01:23-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14655&p=33885#p33885 <![CDATA[Re: What I desperatly need.]]> Statistics: Posted by twaycaster — September 3rd, 2011, 1:01 pm


]]>
2011-09-03T11:50:58-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14655&p=33879#p33879 <![CDATA[Re: What I desperatly need.]]> http://www.pspad.com/en/download.php

Statistics: Posted by Cristián Lávaque — September 3rd, 2011, 11:50 am


]]>
2011-09-03T11:27:16-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14655&p=33877#p33877 <![CDATA[Re: What I desperatly need.]]>
The minute I remove s2-hacks.php or remove the code from functions.php my website is back up to full speed. I know it is something I am doing wrong, but for the life of me I cannot figure it out.

The only thing I can think of is that I am using word for editing my php, could this be the problem?

Statistics: Posted by twaycaster — September 3rd, 2011, 11:27 am


]]>
2011-09-01T20:40:33-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14655&p=33698#p33698 <![CDATA[Re: What I desperatly need.]]> Thanks for the reply.

Your file has an extra line break at the bottom, right after ?>
Please make sure there are no leading/trailing spaces,tabs,line breaks before or after <?php ?>

If you continue to have trouble, I would double-check that the pages you are redirecting to, are not somehow redirecting the browser again, thereby creating an endless loop of redirections.

Statistics: Posted by Jason Caldwell — September 1st, 2011, 8:40 pm


]]>
2011-09-01T19:25:49-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14655&p=33693#p33693 <![CDATA[Re: What I desperatly need.]]> Statistics: Posted by twaycaster — September 1st, 2011, 7:25 pm


]]>
2011-09-01T17:08:07-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14655&p=33676#p33676 <![CDATA[Re: What I desperatly need.]]>
Code:
http://example.com/not-yet-available-to-you/
http://example.com/signup-for-group-a/

If so, please post the revised PHP file that you're using.

Statistics: Posted by Jason Caldwell — September 1st, 2011, 5:08 pm


]]>
2011-09-01T15:36:00-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14655&p=33670#p33670 <![CDATA[Re: What I desperatly need.]]>
sadly I uploded the file and when I log out I get webpage not available.

http://www.holistic-living-today.com

Please help.

I tried to log in with a test user id and it would not load the page and gave me webpage not available, so I got via FTP and remove the s2-hack.php and viola, website is back up and running, fast and responsive again.

I dunno.

Statistics: Posted by twaycaster — September 1st, 2011, 3:36 pm


]]>
2011-09-01T13:12:34-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14655&p=33645#p33645 <![CDATA[Re: What I desperatly need.]]> s2-hacks.zip

Statistics: Posted by Jason Caldwell — September 1st, 2011, 1:12 pm


]]>
2011-09-01T12:40:18-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14655&p=33642#p33642 <![CDATA[Re: What I desperatly need.]]>
I guess I will have to do some php research and see where I am messing up with the code. I am 99% sure it is the copy and paste that messes up the code and something is not going in the right place. If either of you would like to log onto my site and verify it I would gladly let you.

Statistics: Posted by twaycaster — September 1st, 2011, 12:40 pm


]]>
2011-09-01T01:49:21-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14655&p=33605#p33605 <![CDATA[Re: What I desperatly need.]]> <?php or after the ?>.

You'd have to update the URL with yours, and the page IDs with the actual ones you create for the drips. https://wordpress.org/extend/plugins/wp-show-ids/

I can understand it looks off, here's it's again with the opening curly brackets in their own lines:

Code:
<?php
add_action 
('template_redirect', 'my_s2_custom_capabilities');
function my_s2_custom_capabilities()
{
    $drips = array(
        7  => array(3, 4, 5),
        14 => array(6, 7, 8),
        21 => array(9, 10, 11),
        28 => array(12),
    );
    if (current_user_can('access_s2member_ccap_a'))
    {
        foreach ($drips as $drip_day => $drip_pages)
        {
            if (S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS < $drip_day && is_page($drip_pages))
            {
                wp_redirect('http://example.com/not-yet-available-to-you/');
                exit;
            }
        }
    }
    else
    
{
        wp_redirect('http://example.com/signup-for-group-a/');
        exit;
    }
}
?>


Does that help?

Statistics: Posted by Cristián Lávaque — September 1st, 2011, 1:49 am


]]>
2011-08-31T20:48:55-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14655&p=33554#p33554 <![CDATA[Re: What I desperatly need.]]> Statistics: Posted by Jason Caldwell — August 31st, 2011, 8:48 pm


]]>
2011-08-31T20:18:34-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14655&p=33541#p33541 <![CDATA[Re: What I desperatly need.]]>
I have tried adding both sets of codes as is to functions.php and it has created an error on my site, I am going to add it to s2-hacks.php in the mu-plugins folder but want to verify the code is correct (Other then the websites ofcourse. I know I have to replace those with the sites I am using the code in.

Thanks guys for the help

Trinity

Statistics: Posted by twaycaster — August 31st, 2011, 8:18 pm


]]>
2011-08-30T23:09:10-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14655&p=33472#p33472 <![CDATA[Re: What I desperatly need.]]> Statistics: Posted by Jason Caldwell — August 30th, 2011, 11:09 pm


]]>
2011-08-30T23:04:14-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14655&p=33470#p33470 <![CDATA[Re: What I desperatly need.]]>

Here's a modified version using an array for the drips that'd make it quick to edit them.

Code:
<?php
add_action 
('template_redirect', 'my_s2_custom_capabilities');
function my_s2_custom_capabilities() {
    $drips = array(
        7  => array(3, 4, 5),
        14 => array(6, 7, 8),
        21 => array(9, 10, 11),
        28 => array(12),
    );
    if (current_user_can('access_s2member_ccap_a')) {
        foreach ($drips as $drip_day => $drip_pages) {
            if (S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS < $drip_day && is_page($drip_pages)) {
                wp_redirect('http://example.com/not-yet-available-to-you/');
                exit;
            }
        }
    } else {
        wp_redirect('http://example.com/signup-for-group-a/');
        exit;
    }
}
?>


I hope it helps.

Statistics: Posted by Cristián Lávaque — August 30th, 2011, 11:04 pm


]]>
2011-08-30T18:18:24-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14655&p=33419#p33419 <![CDATA[Re: What I desperatly need.]]> Statistics: Posted by Jason Caldwell — August 30th, 2011, 6:18 pm


]]>
2011-08-30T15:55:47-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14655&p=33381#p33381 <![CDATA[Re: What I desperatly need.]]>
Thank you so much for helping me with this. I had already made up my mind and purchased s2pro last night, this seals the deal and will allow me to develop everything I need with my sites.

Thank you so much

Trinity

Statistics: Posted by twaycaster — August 30th, 2011, 3:55 pm


]]>
2011-08-30T13:53:23-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14655&p=33355#p33355 <![CDATA[Re: What I desperatly need.]]> Thanks for the heads up on this thread.
twaycaster wrote:
ccap: group A
at registration Group A gets access to pages 1 2 and 3
at 7 days, they are dripped access to pages 3 4 and 5
at 14 days they are dripped access to pages 6 7 and 8
at 21 days they are dripped access to pages 9 10 and 11
at 28 days they are dripped access to page 12
You might do something like this inside the functions.php file for your WordPress theme.
Code:
<?php
add_action 
("template_redirect", "my_s2_custom_capabilities");

function my_s2_custom_capabilities ()
    {
        if (current_user_can ("access_s2member_ccap_a"))
            {
                if (is_page (array (1, 2, 3)))
                    {
                        // Do nothing. They DO have access to these Pages.
                    }
                else if (is_page (array (3, 4, 5)) && S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS < 7)
                    {
                        // These Pages are NOT yet available.
                        wp_redirect ("http://example.com/not-yet-available-to-you/") . exit ();
                    }
                else if (is_page (array (6, 7, 8)) && S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS < 14)
                    {
                        // These Pages are NOT yet available.
                        wp_redirect ("http://example.com/not-yet-available-to-you/") . exit ();
                    }
                else if (is_page (array (9, 10, 11)) && S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS < 21)
                    {
                        // These Pages are NOT yet available.
                        wp_redirect ("http://example.com/not-yet-available-to-you/") . exit ();
                    }
                else if (is_page (12) && S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS < 28)
                    {
                        // These Pages are NOT yet available.
                        wp_redirect ("http://example.com/not-yet-available-to-you/") . exit ();
                    }
            }
        else /* Else they do NOT have access to this Custom Capability at all. */
            {
                // You have no access to group A.
                wp_redirect ("http://example.com/signup-for-group-a/") . exit ();
            }
    }
?>
You could also place this code inside: /wp-content/mu-plugins/s2-hacks.php
( whichever is easier for you ).

Statistics: Posted by Jason Caldwell — August 30th, 2011, 1:53 pm


]]>
2011-08-29T17:39:29-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14655&p=33289#p33289 <![CDATA[Re: What I desperatly need.]]> Statistics: Posted by twaycaster — August 29th, 2011, 5:39 pm


]]>
2011-08-29T17:35:48-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14655&p=33288#p33288 <![CDATA[Re: What I desperatly need.]]>
Well, if you want to check all pages from a single place (like functions.php, instead of in each page), you can have an array of page IDs to check in the condition for each drip.

Does that help?

Statistics: Posted by Cristián Lávaque — August 29th, 2011, 5:35 pm


]]>
2011-08-29T11:41:00-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14655&p=33235#p33235 <![CDATA[Re: What I desperatly need.]]>
I am actually pretty decent at coding, but I look at this and I wonder, can I add all the conditionals in function.php? including dripping?

The only thing is I do not see any example on how to list pages to be dripped. that is my biggest confusion.

Statistics: Posted by twaycaster — August 29th, 2011, 11:41 am


]]>
2011-08-29T11:31:26-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14655&p=33234#p33234 <![CDATA[Re: What I desperatly need.]]>
twaycaster wrote:
With ccaps, the code he uses is different then the code under s2member / scripting


That's because there are several ways to write the codes for the conditions. In the ccaps video he gives an more advanced example of a condition in PHP in one of the theme's files.

All of them, the ones in the videos or the ones in the Scripting API's docs, are just examples that you can copy or modify if you know what you're doing. Since that seemed to confuse you, I assumed you're not very experienced with coding and is why I suggested you look for help from a developer.

The simpler way to use conditionals is with shortcodes, but these too require a logic similar to coding PHP. WP Admin -> s2Member -> API / Scripting -> Simple/Shortcode Conditionals

twaycaster wrote:
and in dripping, I do not see where I put in which pages to drip when.


There isn't a Content Dripping are in your admin side where you manage content dripping at the moment. You drip the content using the conditionals right where the content you want to drip is. So in a page that has content to be shown after 2 weeks, right there you add the condition that checks if the user has been one for more than two weeks before showing the content to him.

I hope that helps.

Statistics: Posted by Cristián Lávaque — August 29th, 2011, 11:31 am


]]>
2011-08-25T08:39:51-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14655&p=32877#p32877 <![CDATA[Re: What I desperatly need.]]>
:(

Statistics: Posted by twaycaster — August 25th, 2011, 8:39 am


]]>