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.

About: Garry Schafer

Sorry, I've not written a description yet. I'll get to it soon!


Topics I'm Subscribed To

Viewing 3 topics - 1 through 3 (of 3 total)
Topic Count Last Reply
Quick help! Bypassing restrictions…

By:  Garry Schafer in: Community Forum

voices: 3
replies: 8

3 years, 9 months ago  John Ashcroft

Gift / Coupon Codes for s2member

By:  Angie Gonzalez in: Unofficial Extensions/Hacks

voices: 2
replies: 2

3 years, 10 months ago  Angie Gonzalez

membership single-item and past month package

By:  Garry Schafer in: Community Forum

voices: 2
replies: 5

3 years, 10 months ago  Cristián Lávaque

Viewing 3 topics - 1 through 3 (of 3 total)

Topics I've Started

Viewing 2 topics - 1 through 2 (of 2 total)
Topic Count Last Reply
Quick help! Bypassing restrictions…

By:  Garry Schafer in: Community Forum

voices: 3
replies: 8

3 years, 9 months ago  John Ashcroft

membership single-item and past month package

By:  Garry Schafer in: Community Forum

voices: 2
replies: 5

3 years, 10 months ago  Cristián Lávaque

Viewing 2 topics - 1 through 2 (of 2 total)

My Latest Replies (From Various Topics)

Viewing 8 replies - 1 through 8 (of 8 total)
Author Replies
Author Replies
Posted: Friday Mar 29th, 2013 at 12:51 pm #46073

John – agree about the admin login – I work around that by using two browsers.

In my opinion I’ve got it working exactly the way I want it – it’s all good.

You can also do this easily by the custom capabilities if you’re a programmer – I just didn’t want to go down that route here as I’ve got others setting the posts.

I worked on a site where I was creating bundles to be purchased – you could either purchase a single title or that month’s group of video titles. I just created two buttons for every post – one that would save as a capability ‘single_(postID)’ and the other would get the post date of the post, and would allow purchasing of month_yyyymm — so when a person is logged in I just check to see if a) they have that months capability or b) that single capability. Works great.

Posted: Friday Mar 29th, 2013 at 10:50 am #46064

Thanks – getting there – but actually thought I’d respond as I did find a way.

Added a filter in s2-hacks.php in mu-plugins and all it does is return true:

add_filter(“ws_plugin__s2member_check_post_level_access_excluded”, “__return_true”);

So it’s bypassing any sort of restrictions. Then I’ve got code in the single checking:

function check_if_premium_content($postID){
		$found = false;		
		for($n=0; $n<=2; $n++){
			$p = "level".$n;
			$target = array_unique(preg_split("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][$p."_posts"]));
			if(in_array($postID, $target)){
				$found = $p;
			}
		}

		return $found;
	}

Which I took a bit from your plugin (the select on the post) — now I’m just checking for the postid in the post access, not caring about page or anything.

I can check as a boolean or check on a level. Once I get whether or not it’s protected, I can then check if the current user is logged in and has that level. Just putting it out there in case anyone else wants to know.

By the way – I’m surprised there’s no real built in function to just check the current posts level / protected; you check from the user side (user_can_access) and you have shortcodes/code for displaying differing content to levels, but no quick check for the current content’s level. Would be a nice add.

Posted: Thursday Mar 28th, 2013 at 9:25 pm #46012

Nobody? Even bought pro?

Posted: Thursday Mar 28th, 2013 at 5:04 pm #45998

I’m starting to think Bruce doesn’t love me :(

Posted: Sunday Mar 10th, 2013 at 2:02 pm #44218

Hey there – just curious; this is a way you can create coupons for someone but not really a way that user 1 can buy a certificate that can be gifted to user 2 correct?

Posted: Sunday Mar 10th, 2013 at 12:49 am #44185

Thanks Cristián – we got a lot of it done and working, however one thing — if someone comes in and tries to purchase custom capabilities without first registering it seem to throw an error as it can’t find the user that purchased it – and that makes sense to me. So we need to get people to register before purchasing… so thinking of restricting the videos url and forcing free reg before purchases are made…?

Posted: Friday Mar 8th, 2013 at 4:16 am #44038

Raam – tried contacting you via your website then got lost reading your journeys – also realized I’m very close to to you (central ct) so you’re enjoying the snow…

Anyway I’m reading this: http://www.primothemes.com/forums/viewtopic.php?f=36&t=2599&p=7409&#p7409

and tell me if I’m wrong but the capabilities are just really a lookup table to some capacity; if I’m saving things that are dd_cap(‘access_s2member_ccap_postid_123’) – then in theory once I load in the single and have that single’s post id I can check if the user has that cap, correct? The same would go for in terms of finding a date and just checking if the current video’s pubdate is within a paid-for monthly capability…?

My only uncertainty is how to best deal with membership. At first I was thinking I’d redirect the /videos/ uri but that would mean that one would have to already be a member in order to purchase singles or monthly access; I think instead if I’m correct about the above, could I not have a button that says ‘become a member!’, take them to the purchasing for that membership and upon return I can hide the ‘join’ button by seeing if the membership capability is already in there; as well as checking said users’ membership date.

The only other thing I’d be concerned about is that I’ve read when a user downgrades when they cancel they lose all their capabilies; we want to allow the user access to vids they purchased as a single, as a monthly package, and all the videos that existed during the months of their membership (I need to confirm but I do think it’s easy chunkage, ie if I cancel my membership on 3/3 I get all the videos of March) – I’m thinking upon the downgrade I just save old member data (capabilities) to my own table and also use that to lookup – ie userid for past caps?

Thanks for putting up with me.

Posted: Friday Mar 8th, 2013 at 3:46 am #44035

Actually – here’s what I’m thinking and any advice just to point me to code or tell me if my thinking is sound.

I’m going to just create a normal membership. Upon every post (I’ve created a custom post of ‘hh-videos’, hh being the client’s name. What I’m thinking I’m going to do is that upon every single video load I will — tell me if this is possible:

1) based upon every single of the video I’m going to get the post_id and pubdate; I wlll generate two custom capabilitiy buttons ont he fly of single_%post_id% and montly_%year%_%month%

2) I will first check to see if the user is a member.
2a) If the current post pubdate is later then his membership join I will show the video / download buttons
2b) if the current post date is prior to his membership date then…

3) I will check if the user has the single capability for that item (again single_%post_id%) — if so, video and download

4) if not I will check the monthly package – is the monthly capability his? if so, video/download, if not

Purchase single / purchase monthly buttons.

Is this doable?

Viewing 8 replies - 1 through 8 (of 8 total)

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.