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.

Creating custom capabilities

Home Forums Community Forum Creating custom capabilities

This topic contains 4 replies, has 3 voices. Last updated by  Brendan Moorehead 4 years, 10 months ago.

Topic Author Topic
Posted: Tuesday Feb 21st, 2012 at 4:30 pm #5897

I am considering upgrading to S2MemberPro, but before I do, I want to know that the free version is robust and works well and is easy enough for me to use (since it’s the foundation of the Pro version) before buying Pro, so I’m wondering if you can tell me where I could find help with this issue (I can’t find anything in the free Knowledge Base or Forum):

If I enter a custom value, such as “uwlpg1″ to the “Require Custom Capabilities?” field on a page, doesn’t that create the custom capability value that I would use in PayPal buttons and custom capability short codes and php codes? Or is there somewhere else that a value is entered in order to generate a custom capability value?

I tried the above method (entering “uwlpg1” in the “Require Custom Capabilities” field on a page), and then entered a short code on the page like this:

[s2If current_user_can("access_s2member_ccap_uwlpg1")]
Content for this capability (e.g. link to a page).
[/s2If]

But I get an error message at the top of a page (Login Welcome Page) where I have several access restrictions. This is the error message:

Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, ‘current_user_can’ was given in /home/content/70/8904870/html/ultimateweightlossprotocol/wp-content/plugins/s2member/includes/classes/sc-if-conds-in.inc.php on line 138

What is the correct way to establish a custom capability value that will work in the short codes? I’ve read over the sections related to custom capabilities in the API Scripting area in S2Member and can’t see what I might be missing. It seems like your documentation on establishing custom capability codes might be either thin or my installation has a bug.

List Of Topic Replies

Viewing 4 replies - 1 through 4 (of 4 total)
Author Replies
Author Replies
Posted: Thursday Feb 23rd, 2012 at 4:08 pm #6171
Staff Member
Requesting tech-support. Not a Pre-Sale question.
Moving to Community Forum so you’ll have a chance to receive assistance.
If you are a Customer, please post this in our Customer Support Forums.
Posted: Friday Feb 24th, 2012 at 10:32 am #6266
David Welch
Username: dwbiz05

First thought, try removing the \”\’s in the current_user_can() function.

I don\’t see any quotes in the example given in s2member aip/scripting examples like this one:

[s2If current_user_can(access_s2member_level1)]
//content here
[/s2If]

Hope that helps,

Dave

EDIT: I just copy/pasted your code in my version and it works fine (without the \”). I don\’t get any errors. It may be a corrupt file or something when you installed it. I suggest re-installing to see if that fixes the problem.

  • This reply was modified 4 years, 10 months ago by  David Welch.
Posted: Friday Feb 24th, 2012 at 12:06 pm #6281

Do you mean uninstall and re-install S2Member? If so, is there a way to back-up the settings, or will I have to recreate them manually?

Posted: Friday Feb 24th, 2012 at 12:16 pm #6282

It sounds like you\’re saying that the short codes should not have quotation marks where I placed them around the custom capabilities portion of the command, and when I looked back at the \”Custom Capabilities (Packages)\” tab, there are several occurrences at the top of the page where quotation marks are used:

Each s2Member Level ( aka: s2Member Role ) provides the Capability current_user_can(\”access_s2member_level0\”), 1, 2, 3, 4, where access_s2member_level[0-4] is the Capability associated with each Role; and Membership Levels provide incremental access ( i.e. Level #4 Members can also access content at Levels 0, 1, 2, and 3 beneath them ).

Capabilities using current_user_can(\”access_s2member_ccap_music\”) and current_user_can(\”access_s2member_ccap_videos\”).

However, when I look at the examples further down the page, it looks like quotation marks are used in php code, but not in the short codes. Is that the case? (that quotation marks ARE used in php code, but not in short code?)

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