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.

Another CCAPS question

Home Forums Community Forum Another CCAPS question

This topic contains 43 replies, has 5 voices. Last updated by  Cristián Lávaque 4 years, 4 months ago.

Page 2 Of Topic Replies

Viewing 18 replies - 26 through 43 (of 43 total)
Author Replies
Author Replies
Posted: Friday Aug 17th, 2012 at 9:05 am #22339
cassel
Username: cassel

Considering that membership can be like magazine subscriptions, i am sure it could help others with their sites. Thanks for considering adding it to the “request list” for Jason.

Posted: Friday Aug 17th, 2012 at 1:02 pm #22370
Staff Member
Thanks for the feedback guys! We’re working hard to improve this.
Posted: Sunday Aug 19th, 2012 at 11:16 pm #22518
cassel
Username: cassel

Ok, i think i found a workaround that might work without too heavy coding, but still will rely on something not automatic. Tell me if it makes sense:
– in the shortcode for the “subscription”, i would add a specific ccap for the month. So, today, the shortcode would have a ccaps=”201208″ (i would change it every month)
– since some workshops can still be purchased separately and NOT through a subscription, i would keep the current ccaps like wjan2012, wfeb2012 and so on
– i would have a conditional that would look for ONE condition:
— either the member HAS one of the independant ccaps
— either the member purchased a ccap that is >= than 201208.

Now,
– question 1: is that possible (and logical)?
– question 2: what is the syntax needed to check if the user has a ccap >= than (something)?

Posted: Tuesday Aug 21st, 2012 at 6:42 am #22614

– question 1: is that possible (and logical)?

Yeah, you could do something like that. I haven’t thought out all the details, but the concept is seems fine.

So, today, the shortcode would have a ccaps=”201208″ (i would change it every month)

You can have it update automatically with PHP in the shortcode. http://www.primothemes.com/forums/viewtopic.php?f=36&t=1604

http://php.net/date
[hilite pre_code]

[/hilite]

The [hilite mono]wjan2012[/hilite] format would be tough to compare with higher/lower than. I suggest just [hilite mono]201208[/hilite], [hilite mono]w201208[/hilite] at most.

– question 2: what is the syntax needed to check if the user has a ccap >= than (something)?

[hilite mono]>=[/hilite] is fine, you first need to figure out the dates you’re comparing, though. You need to get all the ccaps the user has, first, and then do the comparison to find one higher than the one required by the page.

Posted: Tuesday Aug 21st, 2012 at 7:00 am #22617
cassel
Username: cassel

The wjan2012 format would be tough to compare with higher/lower than. I suggest just 201208, w201208 at most.

I know, i was thinking outloud. The ccaps with the wjan would be used for something else, not to compare with the date one. I would just keep it so that if someone would buy one particular package, and not the whole continuous serie, i can still use this code to check for that particular ccaps
[s2If current_user_can(access_s2member_ccap_wjan2011)]

You need to get all the ccaps the user has, first, and then do the comparison to find one higher than the one required by the page.

I am just unable to figure out how the syntax would look like. I see snippets with user_can , user_is, and such that are simple true or false conditions. If a member purchases something with a ccap of 201208, how do i write the following conditional:
if the user has a ccaps >= 201205, then show this page

It is that first part of the “if the user has ccaps” because i can only find
[s2If current_user_can(access_s2member_ccap_201205)]

As for automatically changing the date, i might look into it later but manually changing it once a month is not a big deal for now.

  • This reply was modified 4 years, 4 months ago by  cassel.
Posted: Tuesday Aug 21st, 2012 at 8:41 am #22637

I am just unable to figure out how the syntax would look like. I see snippets with user_can , user_is, and such that are simple true or false conditions.

You need a bit of PHP to first get all the ccaps he has, to then compare against the required ccap for the content he’s trying to view.

That PHP is not in the documentation, not sure there’s a function that does it either. http://www.s2member.com/codex/stable/s2member/api_functions/package-summary/

You may need to do a database query to get them. http://codex.wordpress.org/Class_Reference/WP_Query

Posted: Tuesday Aug 21st, 2012 at 8:57 am #22638
cassel
Username: cassel

Hum… i am lost here. You are quoting something that is not in this thread. Then my question (maybe i am not explaining my thought correctly) is simply this:

i can get a conditional that will look if the member has a ccaps or not (even if he has 10) without having to compare each one, right?
can’t i get a conditional to look if the member has a ccaps that is higher (or lower) than something else?

And i thought i had a simple solution!

Posted: Wednesday Aug 22nd, 2012 at 7:24 am #22711

Sorry about my quote, I obviously didn’t copy your post when I hit the button, so I pasted what I had in the clipboard from before and didn’t notice it. I fixed it now.

can’t i get a conditional to look if the member has a ccaps that is higher (or lower) than something else?

No, custom capabilities don’t have the incremental access Levels have, and when a page is protected by a ccap, that ccap specifically is what’s looked for in the user’s access.

So, in order to check what you want, you’d have to check every ccap the user has to find one higher. Or, you could give existing users new ccaps as they become available, then their accounts will have each specific ccap for the pages they have access to.

Posted: Wednesday Aug 22nd, 2012 at 8:23 am #22731
cassel
Username: cassel

Thanks. I guess i’ll have to find another way around. I am afraid it is above my knowledge and my cost me too much to ask my programmer to do it. :(

Posted: Thursday Aug 23rd, 2012 at 5:20 am #22812

Right, I can understand that. I’ll see what I can come up with to help you, but I’ve suggested what I could think of so far.

Are you needing this yesterday or is it for something you have in mind doing in a future date, but still not in a rush?

Posted: Thursday Aug 23rd, 2012 at 6:33 am #22823
cassel
Username: cassel

Well, maybe not yesterday, but probably tomorrow! It is a feature i would like to have to offer a “gold membership” to my members to incorporate more content in one “deal”.

Maybe the programmer could do it for free if his previous plugin (the one i sent an email about) brings him $. But i cannot really count on that.

  • This reply was modified 4 years, 4 months ago by  cassel.
Posted: Friday Aug 24th, 2012 at 7:39 am #22944

Got ya.

Well, I don’t want to raise your interest in the new s2Member, since you’ve already waited this long, but it may be able to do what you describe here: give the user one ccap, and then create child ccaps, which give new access to the user with the parent one.

That’s why I asked about how urgent it is. Jason is still working on this, but he is close to beta for testing now, and I’ll try to have you in the testers team, if you want to. But no date for it yet, don’t know it myself.

If you don’t want to wait, which is understandable, you may want your developer to look into it based on the suggestions I made earlier in this thread, or any new ideas he may have.

Posted: Friday Aug 24th, 2012 at 8:28 am #22955
cassel
Username: cassel

This is a bit of catch 22: if i get my developper to work on that and he succeeds, then i get a beta version (or simply the next version) and it does the same, i might end up having to redo the settings, possibly differently. I am not sure how the changes the developper would do, would survive the upgrade??? What do you think?

Posted: Friday Aug 24th, 2012 at 9:53 am #22969

The changes he creates most probably won’t work without a migration to the new s2Member. They’d work in the mean time, and then you’d have to set things up with the new approach.

It all comes down to how urgent this is for you. That’s what it’d come down to if I were in your shoes: if urgent I’d use a hack asap, if not then I’d wait.

I could not have mentioned this feature in the new s2Member, particularly because I don’t have a solid date, but I thought you should know about it as part of deciding whether to create the hack now or not.

Posted: Monday Sep 3rd, 2012 at 8:39 am #23934
cassel
Username: cassel

I got this working now with the help of the developper. He added a command to the php version of the paypal button code that will add a ccap corresponding to the time of the transaction, added a hack in the hack file (don’t ask me to explain, i could not) that will read a function that will be added to any conditional in a shortcode.

What it does is the possibility of having a user buy a subscription and give him access to content created (or assigned to a time) after that purchase, no matter when they buy the subscription.

Now working on some clear documentation (he is from Bulgaria and his English is not fluent). The package will be made available to those interested. Contact me at cassel at creationcassel dot com if you are interested.

Posted: Tuesday Sep 4th, 2012 at 5:48 am #24014

Nice job! That’s the route I’d have taken for a hack, storing the time in a ccap the user gets. Thanks for the update, I’m glad you got it working. :)

Posted: Tuesday Sep 4th, 2012 at 11:03 am #24036
cassel
Username: cassel

And the good thing is that the ccap that is “extracted” from the transaction will not interfere with the other ccaps. And then, the conditionals can be used in shortcodes just like any other.

Posted: Wednesday Sep 5th, 2012 at 4:19 am #24130

:)

Viewing 18 replies - 26 through 43 (of 43 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.