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.

Listing capabilities a user has access to

Home Forums Community Forum Listing capabilities a user has access to

This topic contains 2 replies, has 2 voices. Last updated by  Laurent Bertin 3 years, 11 months ago.

Topic Author Topic
Posted: Wednesday Jan 23rd, 2013 at 4:36 am #39146

Hello,

Is it possible to list the capabilities a user has access to ?

Regards

List Of Topic Replies

Viewing 2 replies - 1 through 2 (of 2 total)
Author Replies
Author Replies
Posted: Thursday Jan 24th, 2013 at 4:04 am #39311
Staff Member

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

Capabilities are listed in the Dashboard, under each User account. Clicking [edit] for a specific User will bring up a list of their settings/configuration; and that will include a list of Custom Capabilities integrated with s2Member®.

If you’d like to get these via PHP, or display them on-site somewhere, you will need a PHP snippet.

<?php
$user = wp_get_current_user();
foreach(array_keys($user->allcaps) as $cap)
	{
		echo $cap.'<br />';
	}
?>

If you only want Custom Capabilities integrated with s2Member, you would do something like this.

<?php
$user = wp_get_current_user();
foreach(array_keys($user->allcaps) as $cap)
	{
		if(strpos($cap, 'access_s2member_ccap_') === 0)
			echo $cap.'<br />';
	}
?>

See also: Knowledge Base » ezPHP Plugin for WordPress®

Posted: Thursday Jan 24th, 2013 at 4:38 am #39322

Perfect the last part was exactly what I needed.

Thanks a lot,

Laurent

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