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.

Topic Author Topic
Posted: Saturday Aug 4th, 2012 at 3:07 pm #21157
cassel
Username: cassel

As i am getting ready to create a new package for my Campus students, i want to offer a combined package of the current course (which has the ccaps of “element”) but i also want to include a set of upcoming workshops. Currently, each workshop is accessed through conditional using “wmar2012”, “wmay2012”, etc.

Initially, i thought of giving the ccaps of “workshop” to the students purchasing the package and “workshop” to all the workshops, but then, it would include likely include all the past workshops too, while i only want to include workshops given AFTER they register.

If i am to use the individual ccaps given to each workshop, with the date and such, i cannot see a way to set those to the students, upon registration.

Can you think of a way to offer that?

List Of Topic Replies

Viewing 25 replies - 1 through 25 (of 43 total)
Author Replies
Author Replies
Posted: Tuesday Aug 7th, 2012 at 12:57 am #21305
Raam Dev
Username: Raam
Staff Member

You can simply add the Custom Capabilities to the signup form in the ccaps=”” attribute. If you know there will be 12 workshops this year, you could programmatically (using some PHP) determine which month it currently is and then only add the remaining workshop Custom Capabilities to the signup form (so that way they don’t receive the Custom Capabilities for previous months).

Posted: Tuesday Aug 7th, 2012 at 6:16 am #21340
cassel
Username: cassel

Considering that the workshops are ongoing and their membership is also ongoing, even if i included 12 ccaps, i would be stuck the following year!

Posted: Tuesday Aug 7th, 2012 at 8:13 am #21365
cassel
Username: cassel

As i was driving today, i started thinking (could be dangerous at times) but i am not sure if it can work so i need someone techie enough with coding to tell me if it is possible with s2M.

Is there a way for a conditional to decide if a number is higher than another (i think it can) but then, also recognize a ccap as a value (numerical or alphabetical)?

If it can work (you will have to tell me about that), i thought i could assign the ccaps attributes to the individual workshops with a number (ex: 201201) and have a conditional that would determine something like “if the ccap is higher than the user’s “given ccap”, then the workshop is available”. And the “given ccap” would be determined based on the php idea Raam mentioned earlier.

Is that scenario something possible?

Posted: Wednesday Aug 8th, 2012 at 7:12 am #21468

Yeah, you can do number comparisons like that if your ccaps are numbers like that one, e.g.: [hilite mono]$ccap_date < 201201[/hilite]. (That particular example may not make sense for the actual condition you need, but it shows you how the lower/higher than comparison could be.

Posted: Wednesday Aug 8th, 2012 at 12:32 pm #21530
cassel
Username: cassel

Great. This opens up more possibilities.

So the CCAPS can be called 201207 and be treated like a number! Brilliant.
Thanks.

Posted: Wednesday Aug 8th, 2012 at 1:25 pm #21534
cassel
Username: cassel

Ok that is simple, but i cannot figure out where to put what.
– where is the $ccap_date set?
– what format is that $ccap_date so i can choose the ccaps of the individual workshops to make sense to how it is reading it.
– how is that modifying the shortcode for the button/pro-form?

Posted: Thursday Aug 9th, 2012 at 4:37 am #21603

The $ccap_date var was just an example name, it’s not one that exists, you’d create it with the same format to which you’re comparing it to, i.e. YYYYMM, e.g. 201201.

Posted: Thursday Aug 9th, 2012 at 8:42 am #21621
cassel
Username: cassel

I am pretty sure i saw someone post the simple code to extract the date of the transaction, but i cannot find it. Could someone direct me to it please?

Posted: Friday Aug 10th, 2012 at 5:31 am #21683
Posted: Friday Aug 10th, 2012 at 5:46 am #21686
cassel
Username: cassel

That might do, once i figure out how to use that, but i had seen a post/thread where the code was explained (like where to use what you just pointed me to). Any idea?

Posted: Saturday Aug 11th, 2012 at 2:39 am #21747

No, I’m not sure I know what thread you are referring to. But the documentation there tells you what you need to know, although it’s not a tutorial.

Posted: Saturday Aug 11th, 2012 at 7:56 am #21764
cassel
Username: cassel

Then, may i ask a quick explanation for those codes? Where do i use them? In a hack file? in a conditional directly?

Posted: Monday Aug 13th, 2012 at 7:09 pm #21918

You can use them in either one: a hack or your post, it’ll depend on what you’re implementing.

Posted: Monday Aug 13th, 2012 at 7:21 pm #21920
cassel
Username: cassel

I am still unclear, so if you are still patient, could you clarify for me?

Is the time of transaction related to a particular transaction (say one member makes two separate purchases)?
I see it can be associated with reaching a level with this:

$time = s2member_paid_registration_time ("level1"); # first "paid" registration or upgrade time at Level#1.

Can a time of purchase be somehow associated with a ccap?
Are they in that format (like 20120811) by default or do i have to convert it somehow?

  • This reply was modified 4 years, 4 months ago by  cassel.
  • This reply was modified 4 years, 4 months ago by  cassel.
Posted: Monday Aug 13th, 2012 at 8:12 pm #21930

No, ccaps don’t have a time stored by s2Member (yet), if I remember correctly, only Level payment times are stored. But you can generate the ccap names using that date format. Your time checks would need to be implemented by your code, getting the date from the name’s string, it’s not something s2Member does.

Posted: Monday Aug 13th, 2012 at 8:22 pm #21934
cassel
Username: cassel

But you can generate the ccap names using that date format. Your time checks would need to be implemented by your code, getting the date from the name’s string,

???? would you mind translating this in plain English for poor ol’ me? Could you give me an example? (or more than one?)

Posted: Tuesday Aug 14th, 2012 at 10:00 am #21992
Eduan
Username: Eduan
Moderator

Hello Cassel,

I believe what he means with date format is the naming format for ccaps, which would be for example 20120814, which represents today’s date in the following format: YearMonthDay all together.

And the rest simply means that your code would read that special date format.

So your code would be able to recognize this:
20120814

And know that you’re referring to today with that ccap name.

Is this good? Or do you prefer a couple more examples?

Posted: Tuesday Aug 14th, 2012 at 10:43 am #22003
cassel
Username: cassel

I think i was not clear in explaining what i am looking for. I’ll try again.

I have various workshops, and they have each a ccap of wjan2012, wfeb2012 and so on. I CAN change that if needed.

I want someone who might want to purchase the “workshop membership” to be able to get all the workshops AFTER they make that particular purchase. So if somone buys the package today, he would have the workshops starting from September and on, but someone who would buy the package in November, would have only December an after.

I can change the ccaps for the workshops to match the date format. That i am ok with it. But how do i retrieve the date of the purchase of THAT specific package and not when the customer made the first purchase on my site, or when they first registered, and so on. I just need to find a way to have a date on the specific transaction for this package only.

Is that possible?

Posted: Wednesday Aug 15th, 2012 at 8:26 am #22077

It may be possible with some hacking, but it’s not something that s2Member does by default.

You’d have to protect pages with a hack, rather than the s2Member box with the ccaps field in the post/page edit form. And the hack would have to check what ccaps the user has, get the date from that, and then compare it with the date the post/page is protected with.

This is more advanced than what you’ve done so far, but you could figure it out, just as you did the conditionals and other PHP. The ccustom capabilities video has a hack example with conditionals and ccaps that may give you some ideas. Video » s2Member (Custom Capabilities)

Posted: Wednesday Aug 15th, 2012 at 8:59 am #22089
cassel
Username: cassel

You say “get the date from that”. It means that the date of a specific transaction for a specific member IS stored somewhere? (any idea where?)

You’d have to protect pages with a hack

Can that by dynamic so that different purchases at different time, will protect different pages? If so, i can find a way to retrieve the date for the particular user/purchase, and have some conditionals like you explained above, with a sign, right?

If we can figure out some code for that, i am sure others will be able to benefit from it. A bit like any subscription where someone can only read the magazines released AFTER they paid, whenever that is.

  • This reply was modified 4 years, 4 months ago by  cassel.
Posted: Thursday Aug 16th, 2012 at 7:13 am #22193

You say “get the date from that”. It means that the date of a specific transaction for a specific member IS stored somewhere? (any idea where?)

I meant getting it from the ccap, if you name them with the date in them. So if the ccap is [hilite mono]w201202[/hilite] (Feb ’12), you’d have to get the date from that string using one of the string PHP functions, probably substr. http://php.net/substr

I’m not sure what your code should be like, it’d have to be worked out for your needs. I’m afraid I can’t develop this customization for you, so if you really need it, you could post the job in jobs.wordpress.net.

Posted: Thursday Aug 16th, 2012 at 9:27 am #22232
cassel
Username: cassel

OK i will just be very specific: can the date of a specific transaction be retrieved? I can deal with the rest, the conditionals and such. I just want to know (if it exists) where is the time of a specific transaction.

Posted: Thursday Aug 16th, 2012 at 10:44 pm #22294

No, in the current s2Member there isn’t a time saved for each transaction, unless you save them yourself using the Payment Notification with a script for that. [hilite path]Dashboard -› s2Member® -› API / Notifications -› Payment Notifications[/hilite]

Posted: Thursday Aug 16th, 2012 at 10:47 pm #22295
cassel
Username: cassel

Not what i wished for an answer, but very clear. I’ll go for a workaround then. Thanks for your patience.

Posted: Friday Aug 17th, 2012 at 8:49 am #22334

Oh, no problem. Glad to help if I can.

I’m sorry those times aren’t logged yet. I’ll take it as a request and let Jason know.

Viewing 25 replies - 1 through 25 (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.