PriMoThemes — now s2Member® (official notice)
This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™
PseudoNyhm wrote:I am hoping not to directly access the database. For example, in phpBB, I'm able to instantiate the phpBB system, then fetch the user object (essentially from the DB, but through phpBB), then call methods such as phpbb_check_hash(..) and group_memberships(..). This does not require/incur any actual user login (no need for a current session). That's what I'm hoping for.
require('/wp-load.php');
$user_label = c_ws_plugin__s2member_user_access::user_access_label($user);
require('../blog/wp-load.php');
if (!validate_username($user)) // fail
$userid = username_exists($user);
if (is_null($userid)) // fail
if (!user_pass_ok($user,$pass)) // fail
if (!user_can($userid, 's2member_level1')) // fail
// user has run the gauntlet, signal auth accept
Cristián Lávaque wrote:'s2member_level1' is a role, 'access_s2member_level1' is a capability.
user_can($userid, 'access_s2member_level1') // capability check
user_is($userid, 's2member_level1') // role check
PseudoNyhm wrote:So they probably aren't interchangeable. Is this the correct way to check a role versus capability:
- Code: Select all
user_can($userid, 'access_s2member_level1') // capability check
user_is($userid, 's2member_level1') // role check
$user_level = c_ws_plugin__s2member_user_access::user_access_level($user);
$user_role = c_ws_plugin__s2member_user_access::user_access_role($user);
PseudoNyhm wrote:If so, then that makes good sense. Thanks for the clarification. I will install a test platform, including the role management plugin you suggested, to see how things are set up.
Users browsing this forum: Google [Bot] and 2 guests