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.

Changing Page Level Restriction

Home Forums Community Forum Changing Page Level Restriction

This topic contains 0 replies, has 1 voice. Last updated by  aly ielts 4 years, 6 months ago.

Topic Author Topic
Posted: Wednesday Jul 11th, 2012 at 12:11 am #18856
aly ielts
Username: klc

How is one to programatically change Page Level Restriction for a page.

UseCase:
Automating process of creating custom pages for users by using custom capabilities
(as per tutorial: http://www.s2member.com/videos/716DC24E7E347DC2/ )

So far:
I’ve managed to create the page with the correct slug and custom cap and also add the custom cap to the new user (using the registration hook).

The last stumbling block is being able to assign
Page Level Restriction = Require Level 0 or higher.

Currently it is defaulting to “blank” and the newly created user can’t access their page until i manually update their page with “requires level 0 or higher”.

This information is stored in the options for S2member under page restrictions.
I’ve figured out how to access the pages that have Level 0 assigned to them via:

$GLOBALS['WS_PLUGIN__']['s2member']['o'][level0_pages] 

I’ve tried adding the new page ID to the comma delimited string from above but the change isn’t persisted to the DB and subsequently doesn’t work. I also tried a method call that i thought might update the s2Member options.

$GLOBALS['WS_PLUGIN__']['s2member']['o'][level0_pages] = $GLOBALS['WS_PLUGIN__']['s2member']['o'][level0_pages] . "," . $my_post_id;
ws_plugin__s2member_configure_options_and_their_defaults(); 

I imagine this isn’t as hard as i’m making it.
Would love to be pointed in the right direction.

Btw loving the plugin so far.

Cheers

ps:
I’m using:
Wordpress 3.4.0
s2Member version: 120622

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.