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™

Temporary Access Links

s2Member Plugin. A Membership plugin for WordPress®.

Temporary Access Links

Postby fx_keith » November 21st, 2011, 1:03 pm

Hi, I'm trying to provide temporary access links S2member protected pages to outside users (reviewers, journalists, etc). I have posts that are restricted by category/user levels, but I would also like the ability to generate expiring links to those same pages.

I though I could solve it by tapping into the 'Specific Post/Page Access' functionality. Specifically 'c_ws_plugin__s2member_sp_access::sp_access_link_gen' to provide me with the expiring link. But since the posts are also under the user access restrictions, the links require the users to be logged in as well. I know the documentation warns about that, but I'd really like to get around it. Are there any other ways I can bypass the access restrictions in this scenario?
User avatar
fx_keith
Experienced User
Experienced User
 
Posts: 6
Joined: November 21, 2011

Re: Temporary Access Links

Postby Jason Caldwell » November 22nd, 2011, 6:10 pm

Thanks for the heads up on this thread.

It will be very difficult to avoid all aspects of s2Member's protection and Alternative View Restrictions in this regard. However, if you are generating links that point directly to the Permalinks for these Posts/Pages via Specific Post/Page Access, you might do something like this.

Create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
Code: Select all
<?php

add_filter 
("ws_plugin__s2member_check_post_level_access_excluded", "my_s2_exclusions");
add_filter ("ws_plugin__s2member_check_page_level_access_excluded", "my_s2_exclusions");

/* Now build the function. */ function my_s2_exclusions ($s2_says = FALSE)
    {
        global $post; /* Global ```$post`` object reference. */
        /**/
        if (!empty ($post->ID) && c_ws_plugin__s2member_sp_access::sp_access ($post->ID, "read-only"))
            return /* Exclude it, because it's allowed by Specific Post/Page Restrictions. */ ($my_s2_says = true);
        /**/
        return /* Otherwise return whatever s2Member says. */ $s2_says;
    }
?>
* This provides for temporary exclusions of User Level Restrictions whenever a specific Post/Page ID is explicitly allowed via s2Member Specific Post/Page Access Restrictions. I think this is what you're after.
~ 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: Temporary Access Links

Postby fx_keith » November 28th, 2011, 2:59 pm

That's great Jason. Thanks.
Unfortunately, I'm getting a redirect to signup page before that action even fires. I have it rolled up into a plugin, so maybe it's an execution order type thing. I'm looking into what's causing the redirect right now.
User avatar
fx_keith
Experienced User
Experienced User
 
Posts: 6
Joined: November 21, 2011

Re: Temporary Access Links

Postby fx_keith » November 28th, 2011, 4:30 pm

My bad. I was using it on a post, not a page. Action should have been 'ws_plugin__s2member_check_post_level_access_excluded'. Thanks.
User avatar
fx_keith
Experienced User
Experienced User
 
Posts: 6
Joined: November 21, 2011


Return to s2Member Plugin

Who is online

Users browsing this forum: Bing [Bot], Exabot [Bot] and 3 guests

cron