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.

custom capabilities not working

Home Forums Community Forum custom capabilities not working

This topic contains 1 reply, has 2 voices. Last updated by  Jason (Lead Developer) 3 years, 10 months ago.

Topic Author Topic
Posted: Monday Feb 18th, 2013 at 7:53 pm #42375
Damian Jones
Username: aegis

Okay, I finally figured out how to use Custom capabilities.

I created some sample code on the main welcome page…

sample:

[s2If current_user_can(access_s2member_level1)]
	[membership_downloads_box title="Your Downloads"]
		[_s2If current_user_can("access_s2member_ccap_mainfiles")]
			<table border="0">
			<tr>
			<td valign="middle" align="left">
			[securelink id=1]<img title="Main eBook Download" alt="Download Your eBook" src="/wp-content/uploads/imageFiles/eBook_cover_100wx130h.png" border="0" />[/securelink]
			</td>
			<td valign="middle" align="left" width="5">
			&nbsp;
			</td>
			<td valign="middle" align="left">Your Main eBook Download</td>
			</tr>
			</table>
		[/_s2If]

	[/membership_downloads_box]
[/s2If]

that puts the membership downloads box from OptimizePress there, but it is empty… so if I add another one:

[_s2If !current_user_can("access_s2member_ccap_mainfiles")]
	You don't have access, but here is what should have displayed:
	
	<table border="0">
	<tr>
	<td valign="middle" align="left">
	[securelink id=1]<img title="Main eBook Download" alt="Download Your eBook" src="/wp-content/uploads/imageFiles/eBook_cover_100wx130h.png" border="0" />[/securelink]
	</td>
	<td valign="middle" align="left" width="5">
	&nbsp;
	</td>
	<td valign="middle" align="left">Your Main eBook Download</td>
	</tr>
	</table>
[/_s2If]

Then when I load the page, I see the no access one (the second one).
So I created a test account, went to the user account, added the custom capability: mainfiles
to that user in the S2Member area.
saved it.
logged in, in another browser, loaded that page, and the same thing happened.
Only the no access one showed up.

So, why did it not work?

Any ideas?
Thanks.
Richard – Damian’s dad

List Of Topic Replies

Viewing 1 replies (of 1 total)
Author Replies
Author Replies
Posted: Tuesday Feb 19th, 2013 at 2:23 am #42440
Staff Member

Thanks for your inquiry. ~ We appreciate your patience :-)

Please correct this mistake in your Simple Shortcode Conditional and try this again for us. Please let us know if you have any further trouble. See also: Knowledge Base » Simple Shortcode Conditionals

[_s2If !current_user_can("access_s2member_ccap_mainfiles")]

Should be: [_s2If !current_user_can(access_s2member_ccap_mainfiles)]
No quotes inside a Shortcode Conditional please; that messes up the Shortcode parser unfortunately.

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