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™

PostAccess Restrictions without redirect and without login

s2Member Plugin. A Membership plugin for WordPress®.

PostAccess Restrictions without redirect and without login

Postby InfoKing » January 10th, 2012, 5:33 pm

Hi! Thanks for great plugin! I want to buy the pro-version, but first I need your help! :?
I want to show only the_excerpt from each post and hide the_content. I want to place the paypal-button directly to the post-template (see below), the user should not be redirected to the options-page! To see the entire post, the user should use BuyNow. Than he should have access only to this one post. I think that might work like this:

Code: Select all
<?php if (current_user_can("access_s2member_ccap_1")){ ?>
        <?php the_content(); ?>
<?php } else { ?>
        <?php the_excerpt(); ?>
        <p>Bitte kauf diesen Artikel, um den Inhalt zu sehen</p>
        <!-- PayPal BuyNow Button Code -->
<?php } ?>

So that he can only see this one post, I have to create for each post one ccap, right? Not pretty, but might work.
But now comes the big problem: I want that the user must not register!
Is this only possible if I use Specific Post Restrictions? But then the user will be redirected and i dont want to redirect. :(

I've seen something like this in the Plugin EasyPayPal.
Usage:
[paybutton]{Item Name*}|{Item Number*}|{Amount*}|{Currency Code}|{Subscription Days}|{Hidden Text}[/paybutton]*Required
Simple Pay Now (No Login Required)
http://www.voiceoftech.com/swhitley/?page_id=129

How is it possible with S2Member?

Sorry for the bad English. I hope you can help! :)
User avatar
InfoKing
Registered User
Registered User
 
Posts: 4
Joined: January 10, 2012

Re: PostAccess Restrictions without redirect and without log

Postby Raam Dev » January 11th, 2012, 2:52 pm

Hi InfoKing,

If you don't want the user to register, you should use Specific Post/Page "Buy Now" buttons. You don't use Custom Capabilities (ccaps) for this. You will need to generate the code one time for each post/page that you want to sell. Once you generate the button code, you can put that code into your page template.

Here's the process:

1) Protect the page in s2Member by going to WP Admin -> s2Member -> Restriction Options -> Specific Post/Page Access Restrictions
2) Go to WP Admin -> s2Member -> PayPal Buttons -> PayPal Specific Post/Page (Buy Now) Buttons
3) Select the page that you protected in Step 1 and set the price/description options
4) Click 'Generate Button Code'
5) Copy the 'Resulting PayPal Button Code' (NOT the shortcode, the shortcode won't work in your PHP page template)
6) Add the button code to your page template where the PayPal button should show up.

When a user clicks on that button, they will be sent to PayPal. Once they finish paying, they will immediately be transferred back to the protected page where they will have full access to it. They will also receive an email with an access link to view the page (good for 72 hours by default).
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: PostAccess Restrictions without redirect and without log

Postby InfoKing » January 11th, 2012, 4:18 pm

Hi Raam, thanks for your answer!
Yes, that's fine. But if I use "Specific Post/Page Access Restrictions", how can I show a part of the post for someone who has not bought?
I need something like that code, but for Specific Post/Page Access Restrictions!
Code: Select all
<?php if (current_user_can("access_s2member_ccap_1")){ ?>
    Some content for Members who has bought this post. For example the_content
<?php } else { ?>
    Some public content. For example the_excerpt
<?php } ?>

Do you understand my problem?

Maybe I could use ws_plugin__s2member_sp_access in the page template to detect if the visitor has bought the post and show different content??
User avatar
InfoKing
Registered User
Registered User
 
Posts: 4
Joined: January 10, 2012

Re: PostAccess Restrictions without redirect and without log

Postby Jason Caldwell » January 15th, 2012, 12:22 am

Thanks for the heads up on this thread. While there currently is no API Function for this, as you've already discovered, there is an underlying class method which can be used accomplish what you need here.

Code: Select all
<?php
$post_or_page_id 
= get_the_ID();
if(
c_ws_plugin__s2member_sp_access::sp_access($post_or_page_id, "read-only"))
    {
        // The current visitor has Specific Post/Page Access to this Post/Page.
    }
?>


Code: Select all
<?php
if(c_ws_plugin__s2member_sp_access::sp_access(123, "read-only"))
    {
        // The current visitor has Specific Post/Page Access to Post ID #123.
    }
?>
~ 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: PostAccess Restrictions without redirect and without log

Postby InfoKing » January 17th, 2012, 5:09 pm

This works fantastic! Thank you so much! :)
User avatar
InfoKing
Registered User
Registered User
 
Posts: 4
Joined: January 10, 2012

Re: PostAccess Restrictions without redirect and without log

Postby Raam Dev » January 18th, 2012, 1:23 pm

Thank you for the update! Glad to hear it worked! :)
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011


Return to s2Member Plugin

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron