PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

What I desperatly need.

s2Member Plugin. A Membership plugin for WordPress®.

What I desperatly need.

Postby twaycaster » August 23rd, 2011, 8:20 am

I watch the videos for custom capabilies and the video code is totally different from the code under the api/scripting -- advanced conditionals.

I need a code from advanced conditionals and content dripping all wrapped up in one, That way it all works together.

can someone please help me with this, either tell me which code to use (the one from the video, or the stuff under the conditionals page) and if it is the stuff in the page can someone please give me the basics on where to put it and implement it.

and where in the world to put the content dripping code, as well as how to specify which pages to drip at each increment.

Thanks

Trinity
User avatar
twaycaster
Registered User
Registered User
 
Posts: 24
Joined: August 17, 2011

Re: What I desperatly need.

Postby Cristián Lávaque » August 23rd, 2011, 6:15 pm

You specify the page that drips because it's the page you add the condition to. What are the conditions you want for your page? What level/ccap and time after payment?
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: What I desperatly need.

Postby twaycaster » August 23rd, 2011, 7:11 pm

I need this

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

I have looked at all the examples I could find and I just do not understand how to do it, I need someone to give me a sample code that resembles the basics I what I need to use to put it all together.

I would like to be able to place the code in the function.php page and let it go site wide instead of doing independant pages. (I saw that in the advanced conditionals video.)
User avatar
twaycaster
Registered User
Registered User
 
Posts: 24
Joined: August 17, 2011

Re: What I desperatly need.

Postby Cristián Lávaque » August 23rd, 2011, 11:33 pm

I believe you mean the Custom Capabilities video, the second segment. http://youtu.be/h7zBH938VbA

The explanation Jason gives there to add the customization is pretty clear, I don't think I can say it better easily.

Now, to add the content dripping to that, just add it using PHP conditions as shown in its documentation in combination with a tag as he shows for the ccaps. WP Admin -> s2Member -> API / Scripting -> Content Dripping

The tag is what lets you identify which post/page to apply that condition to. If you don't want to use tags to identify the posts, then you'll have to use the conditionals in the posts themselves.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: What I desperatly need.

Postby twaycaster » August 24th, 2011, 7:31 am

With ccaps, the code he uses is different then the code under s2member / scripting

and in dripping, I do not see where I put in which pages to drip when.
User avatar
twaycaster
Registered User
Registered User
 
Posts: 24
Joined: August 17, 2011

Re: What I desperatly need.

Postby Cristián Lávaque » August 25th, 2011, 12:51 am

Maybe you can get a freelance developer to help you. You can try jobs.wordpress.net, oDesk.com or eLance.com.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: What I desperatly need.

Postby twaycaster » August 25th, 2011, 8:39 am

Thats a shame, I figured with this huge community someone would have already worked out some base code for this. I will go outside of the support forums and check with a freelancer then.

:(
User avatar
twaycaster
Registered User
Registered User
 
Posts: 24
Joined: August 17, 2011

Re: What I desperatly need.

Postby Cristián Lávaque » August 29th, 2011, 11:31 am

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.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: What I desperatly need.

Postby twaycaster » August 29th, 2011, 11:41 am

Thanks so much for your reply,

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.
User avatar
twaycaster
Registered User
Registered User
 
Posts: 24
Joined: August 17, 2011

Re: What I desperatly need.

Postby Cristián Lávaque » August 29th, 2011, 5:35 pm

Ah, I see now what you mean.

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?
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: What I desperatly need.

Postby twaycaster » August 29th, 2011, 5:39 pm

Can u give a example of where to put the page ids in the code
User avatar
twaycaster
Registered User
Registered User
 
Posts: 24
Joined: August 17, 2011

Re: What I desperatly need.

Postby Jason Caldwell » August 30th, 2011, 1:53 pm

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: Select all
<?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 ).
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: What I desperatly need.

Postby twaycaster » August 30th, 2011, 3:55 pm

Oh Jason!! you are my hero.

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
User avatar
twaycaster
Registered User
Registered User
 
Posts: 24
Joined: August 17, 2011

Re: What I desperatly need.

Postby Jason Caldwell » August 30th, 2011, 6:18 pm

You are VERY welcome. Thanks for your purchase too!
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: What I desperatly need.

Postby Cristián Lávaque » August 30th, 2011, 11:04 pm

Thanks, Jason. :)

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

Code: Select all
<?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.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: What I desperatly need.

Postby Jason Caldwell » August 30th, 2011, 11:09 pm

Very nice!
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: What I desperatly need.

Postby twaycaster » August 31st, 2011, 8:18 pm

Looking at the last code posted by Chris, are all the marks in the correct placements? they just seem off from all the other code I have seen.

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
User avatar
twaycaster
Registered User
Registered User
 
Posts: 24
Joined: August 17, 2011

Re: What I desperatly need.

Postby Jason Caldwell » August 31st, 2011, 8:48 pm

Hi Trinity. Yes, they both look good from this end. What's the error that you got?
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: What I desperatly need.

Postby Cristián Lávaque » September 1st, 2011, 1:49 am

Make sure you have no spaces or empty lines before the <?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: Select all
<?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?
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: What I desperatly need.

Postby twaycaster » September 1st, 2011, 12:40 pm

anytime I use either of these codes, I either get a error 500 website not available or a generic error this site is under maintenence or cannot connect to the server. the minute I remove the code, it goes back to working correctly.

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.
User avatar
twaycaster
Registered User
Registered User
 
Posts: 24
Joined: August 17, 2011

Re: What I desperatly need.

Postby Jason Caldwell » September 1st, 2011, 1:12 pm

I'm putting the file together for you. Please unzip the attached file, and upload s2-hacks.php to your /wp-content/mu-plugins/ directory. If you still have an error, please post the full error message and we'll have a look for you.
s2-hacks.zip
(519 Bytes) Downloaded 20 times
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: What I desperatly need.

Postby twaycaster » September 1st, 2011, 3:36 pm

Thanks Jason;

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.
User avatar
twaycaster
Registered User
Registered User
 
Posts: 24
Joined: August 17, 2011

Re: What I desperatly need.

Postby Jason Caldwell » September 1st, 2011, 5:08 pm

Did you change the redirection URLs in the code sample?
Code: Select all
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.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: What I desperatly need.

Postby twaycaster » September 1st, 2011, 7:25 pm

Here you go, I have changed over everything I was supposed to and this was the finished product. The minute I upload this my website becomes super sluggish and if I log out it flips to webpage not available, and no pages will load.
Attachments
s2-hacks.rar
(693 Bytes) Downloaded 11 times
User avatar
twaycaster
Registered User
Registered User
 
Posts: 24
Joined: August 17, 2011

Re: What I desperatly need.

Postby Jason Caldwell » September 1st, 2011, 8:40 pm

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.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Next

Return to s2Member Plugin

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron