Skip to content

Instantly share code, notes, and snippets.



Last active Aug 29, 2015
What would you like to do?
EasySocial Access Example
require_once(JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php');
// Retrieve current logged in user.
$my = Foundry::user();
// Retrieve @SocialAccess object
$access = $my->getAccess();
// To check if the user has permissions
if ($access->allowed('comments.delete')) {
// Do some super tasks here
// To check if the user exceeded certain limits
// Here you need to write own logics to compute how many items the user has already created.
$totalCreated = 10;
if ($access->exceeded('comments.create', $totalCreated)) {
// User did not exceed limits
// Shorthand for retrieving access
if ($my->getAccess()->allowed('comments.delete')) {
// Do something here
if ($my->getAccess()->exceeded('comments.create', $totalCreated)) {
// Do something here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.