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.

s2member content drip php code not working

Home Forums Community Forum s2member content drip php code not working

This topic contains 6 replies, has 2 voices. Last updated by  Raam Dev 4 years, 3 months ago.

Topic Author Topic
Posted: Thursday Sep 20th, 2012 at 3:34 pm #25988
Paul Foster
Username: PAFoster

I’m using the ‘PHP Execution’

<?php if(S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS >= 30){ ?>
    Drip content to Members that started paying you at least 30 days ago.
<?php } ?>

 

This results in

= 30){ ?>

being printed on the page, and thus the code not working.

it’s something to do with the ‘greater than’ sign, since using the ‘less than’ sign doesn’t show on the page, though can’t be used for content dripping.

I’ve tried escaping it using \ but that doesn’t make any difference.

Any ideas?

List Of Topic Replies

Viewing 6 replies - 1 through 6 (of 6 total)
Author Replies
Author Replies
Posted: Thursday Sep 20th, 2012 at 11:25 pm #26015
Raam Dev
Username: Raam
Staff Member

Are you using the HTML Editor in WordPress? (The Visual Editor must never be used when using any type of PHP execution plugin.)

What happens if you put the following on a page?

<?php echo 'My code sample.'; ?>

And what about this?

<?php if(2 > 1) { echo '2 is greater than 1'; } ?>

It sounds to me like you either have a problem with the PHP Execution plugin not working properly (which could be caused by a plugin conflict) or you have a strange server configuration that is messing with the way PHP Execution works.

Posted: Friday Sep 21st, 2012 at 4:27 am #26025
Paul Foster
Username: PAFoster

Hi Ramm,

That works.

<?php if(2 > 1) { ?> <strong>echo '2 is greater than 1';</strong> <?php } ?>

also works.

Which means there must be some thing odd in the HTML of my content I guess.

Any idea what I should be looking for?

Posted: Friday Sep 21st, 2012 at 4:52 am #26028
Paul Foster
Username: PAFoster

Hi Ramm,

Atfer more testing…

This works…

<?php if (1 > 2) { ?> <strong>2 is greater than 1</strong> <?php } else { ?> <em>1 is not greater than 2</em> <?php } ?>

This Doesn’t…



<?php if(S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS >= 7){ ?>

    TESTING DRIPPING

<?php } else { ?>
<strong>Sorry, [s2Get constant="S2MEMBER_CURRENT_USER_FIRST_NAME" /]</strong>

<em>You do not have access to this unit yet.</em>

If you think this may be an error then please <a href="/contact-us/" title="Contact Us Page">contact us.</a>
<?php } ?>

I get

= 7){ ?>  

printed on the page and both parts of the html print.

======================

Furthermore….

I’ve now put the code into this reply below without the code tags, and the same thing happens here on your site. It executes the php, or rather tries to…

= 7){ ?>

    TESTING DRIPPING

Sorry, [s2Get constant="S2MEMBER_CURRENT_USER_FIRST_NAME" /]

You do not have access to this unit yet.

If you think this may be an error then please contact us.

Posted: Monday Sep 24th, 2012 at 6:44 am #26275
Raam Dev
Username: Raam
Staff Member

It looks like maybe your WordPress install is having trouble using the s2Member constants (i.e., S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS). The next step is to disable all other plugins except s2Member and see if it works then. If that doesn’t fix it, I suggest also trying to switch to the default WordPress theme (e.g., TwentyEleven).

These code samples work (I’m personally using them on my own site), so the problem is somewhere with your site or server configuration. We just need to keep narrowing it down until we figure out where the problem is.

Posted: Friday Oct 5th, 2012 at 11:55 am #27583
Paul Foster
Username: PAFoster

Very odd things going on, but yes it does work (of course, lol). It seems that something extra was getting in when I cut and pasted – I have no idea what. I have been able to get the exact results I want now, but at one stage had the same code twice on the same page – the first didn’t work, the second did. Very odd, but at least I know it can happen and all I need to do is delete the code (even the page, once I have copied the content) and start again.

Thanks for your help Raam!

PAF :)

Posted: Monday Oct 8th, 2012 at 2:53 am #27767
Raam Dev
Username: Raam
Staff Member

Thanks for the update, Paul. Glad to hear you got it working. :)

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.