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.

Simple drip feed content script problem

Home Forums Community Forum Simple drip feed content script problem

This topic contains 9 replies, has 2 voices. Last updated by  Cristián Lávaque 3 years, 9 months ago.

Topic Author Topic
Posted: Thursday Mar 21st, 2013 at 1:24 am #45284
Bruno
Username: brunoedig

Hi,

I’ve been playing around with drip feed content and I just need to sort out one basic thing that I couldn’t reading through s2member instructions.

Example: in the scripting section I can find this:

(i.e.

) will give you a timestamp at which a Member first paid for Level#1 access.

Okie dokie. But I’ve inserted that code in my post and it doesn’t show anything. So I’ve tried inserting a print command to see what happens:

Now it does show the time, but it shows an awkward number like 1360136253. Dunno what that is. Ok, found out that is a unix timestamp. So that’s my first question:

How do I make it show the exact number of days the guy has been registered?

So basically what I wanted was a simple function where I could write how many days he still have till he can see the content. So, say he joined yesterday and the content would be available in 7 days from registration:

This content will be available to you in FUNCTION(7 – REGISTRATION TIME) days.

The function would then translate to 5 in this case.

Not sure how hard it is to do that. I fully understand that this is not part of the plugin itself, so I understand that if this is too hard I should hire someone to do it. But, anyway, I decided to post here in case it wasn’t that hard and someone could sort it out quick and painlessly ;)

BTW, I’ve installed the ezPHP plugin but the PHP code is still showing as a text when I view my post. Dunno what I’m doing wrong. I’ve found a way around with some shortcodes from my theme (Catalyst) but still would be nice to have PHP directly into the posts.

Any idea on how to sort this out? I just added the plugin and activated. Anything else I need to do?

Thanks!

List Of Topic Replies

Viewing 9 replies - 1 through 9 (of 9 total)
Author Replies
Author Replies
Posted: Friday Mar 22nd, 2013 at 8:33 am #45474

Hi Bruno.

So basically what I wanted was a simple function where I could write how many days he still have till he can see the content. So, say he joined yesterday and the content would be available in 7 days from registration:

Maybe something like:

[hilite pre_code]
strtotime('-7 days')) { ?>
First week.

[/hilite]

http://php.net/strtotime

BTW, I’ve installed the ezPHP plugin but the PHP code is still showing as a text when I view my post. Dunno what I’m doing wrong.

Make sure you’re only using the Text tab of the editor and never user the Visual tab when you have PHP code.

Posted: Tuesday Mar 26th, 2013 at 7:43 am #45723
Bruno
Username: brunoedig

Thanks Cristian!

Hummm that will be impossible. WAY too troublesome to only use the text tab to edit my stuff.

Any other way around?

Posted: Tuesday Mar 26th, 2013 at 9:37 am #45744
Posted: Tuesday Apr 2nd, 2013 at 3:01 am #46346
Bruno
Username: brunoedig

http://wordpress.org/extend/plugins/my-shortcodes/ is the way to go! Very cool plugin and it works like a charm!

Posted: Tuesday Apr 2nd, 2013 at 3:42 am #46347

Thanks for the update. I’m glad you solved it. :)

Posted: Tuesday Apr 2nd, 2013 at 3:48 am #46349
Bruno
Username: brunoedig

Well I thought I had solved but it seems I’m doing something wrong =/

I registered a new user today and used the follow command with a shortcode:

<?php if(s2member_paid_registration_time("level2") >= 50){ ?>

Content test!

<?php } ?>

Any user who has paid for level 2 access for less than 50 days SHOULDN’T be able to see that content. But for some reason that’s now what is happening. Access is still available to everyone.

Is there anyhing wrong with my code?

Posted: Tuesday Apr 2nd, 2013 at 4:01 am #46352

[hilite mono]s2member_paid_registration_time[/hilite] will return a timestamp, not number of days. In the conditional I wrote for you some replies ago, you’ll see I used [hilite mono]strtotime[/hilite].

If you want days, then try [hilite mono]S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS[/hilite]. [hilite path]Dashboard -› s2Member® -› API / Scripting -› Content Dripping[/hilite]

Posted: Tuesday Apr 2nd, 2013 at 4:31 am #46353
Bruno
Username: brunoedig

EDIT: forget it, got it now ;)

Thanks!

Posted: Thursday Apr 4th, 2013 at 5:48 am #46573

Great. :)

Viewing 9 replies - 1 through 9 (of 9 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.