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™

API Scripting for "Teaser"

s2Member Plugin. A Membership plugin for WordPress®.

API Scripting for "Teaser"

Postby SteveS » July 18th, 2010, 9:15 pm

Hi, I am new to writing on this forum, however I've read through it for a few weeks now.

First of, want to say s2Member is an amazing plugin... you guys have done a lot for the community!

I have a question that is related to this topic (http://www.primothemes.com/forums/viewtopic.php?f=4&t=103&p=500&hilit=post+teaser#p500), however I can't seem to figure it out exactly.

I've looked at the code samples and they are exactly what I need, however where do I add them in so that I only show a snippet of my post and they have to register/login to see the rest?

I have Exec-PHP, but don't know exactly how to use it in conjunction with my post.

Here is an example of what I'm trying to do:

When a customer selects http://www.unbreakablewarrior.com, and navigates to the "Blog" section, I want them to only be able to see the following:
"Unbreakable Warrior has recently released a press release:"

Then they would have to login to be able to view the link.

How do I place the PHP code?
User avatar
SteveS
Registered User
Registered User
 
Posts: 1
Joined: July 18, 2010

Re: API Scripting for "Teaser"

Postby Jason Caldwell » July 22nd, 2010, 6:22 am

You would need something like this inside the HTML tab of your Post /or Page.
Code: Select all
This is my article.. here is some text...

<?php if (current_user_can("access_s2member_level1")){ ?>

    Here is the rest of my text, available to Members only!

<?php } else { ?>

    Please pay me 1 million dollars to read the rest :-)
    <a href="<?php echo S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL; ?>">signup now</a>

<?php } ?>

The else condition is optional.
I included it only to improve the example.

Here is another example that ONLY checks if they're a Member.
Code: Select all
This is my article.. here is some text...

<?php if (current_user_can("access_s2member_level1")){ ?>

    Here is the rest of my text, available to Members only!

<?php } ?>

For the benefit of other readers. In order to use s2Member's Advanced Conditionals, you will need to install the Exec-PHP plugin for WordPress. Further documentation on Advanced Conditionals, can be found inside your WP Dashboard, under: s2Member -> API Scripting -> Advanced Conditionals
~ 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


Return to s2Member Plugin

Who is online

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

cron