By Supporter on Friday, 26 April 2019
Posted in General Issues
Replies 27
Likes 0
Views 578
Votes 0
Hello,
1 example of ACLs not really respected:

When a subscriber is moved to a ES profile type he gets the ACL to create x page(s).
When this subscription ends the Profile Type(On Subscription Expire) does not allow to create any page (0 page allowed)
But if a page has been created it is still visible and accessible, these pages should be unpublished and require a subscription renewal to be published again...
Are you referring Easysocial profile type "Page limit" ACL (screenshot : http://take.ms/OA1Q9)?

If yes, actually that is correct behavior, if the subscription already expired, the page owner still can able to access their own page.

Can I know which kind of thing user will get restricted if their subscription already expired?
·
Friday, 26 April 2019 22:28
·
0 Likes
·
0 Votes
·
0 Comments
·
Can I know which kind of thing user will get restricted if their subscription already expired?

If we use PayPlan to restrict ACLs it is to earn money upon active subscription.
If after subscription ends the paid options are still in use then it makes no sense to have time limited subscription... or use PayPlan with EasySocial App and profile restrictions.
Pages, groups, etc. are a way for professional (or any business) to promote themselves.
They pay for a subscription limited period then if no renewal is made the access should be denied (page, group, etc. ) and unpublished.

At the moment, the subscriber pays for a limited period to create content (e.g. a page to advertise a business) but the advertisement will be displayed for a lifetime... this is not a normal limited subscription behavior

Maybe a way to trigger this could be an option in EasySocial page/group/etc. categories to integrate with PayPlans.
Option in ES category: integrate with PayPlans YES / NO
if yes, items in these categories are published unpublished upon active/inactive subscription.
·
Tuesday, 30 April 2019 14:43
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for getting back to us, can you check my following summary and see whether I understand correctly with your current requirement :

Active subscription
--------------------------
1. User can able to create their own group, page and event.
2. User also can able to access other user group, page and event on the site.


Inactive subscription
----------------------------
1. User unable to access their own group, page and event.
2. User also unable to access other user group, page and event on the site.

The reason why they subscribe this is because they want to advertise their own business on the Page right?
·
Tuesday, 30 April 2019 18:35
·
0 Likes
·
0 Votes
·
0 Comments
·
Your summary is near to the expected behavior.... please check the difference in terms I use User vs Owner

Active subscription
--------------------------
1. Owner can able to create their own group, page and event.
2. User + Owner also can able to access other user group, page and event on the site.


a. What if a profile A (Default profile) allows 1 creation and profile B (subscriber) allows 3 or more creation? Should we disallow any creation in the default profile to allow the scenario?


Inactive subscription
----------------------------
1. Owner unable to access their own group, page and event (unpublished).
2. User also unable to access other user group, page and event on the site.
NOT REALLY, the user/owner is moved to the unsubscribed profile type with its own ACLs

3. ! Important ! The created items (what if point a. above?) should be unpublished, Subscribers pay to advertise via a page/group..., when subscription ends the advertisement should also end.

The main point of the request is to unpublish created items created under the permission of a subscription plan.
When subscription plan ends, these specific should not be access by any type of user
When subscription is renewed, all creations/activities are published again.
·
Thursday, 02 May 2019 12:23
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank for took your time to explained to me about this, I understand your point and your current site requirement now.

I've checked the code, it seems like there do not have a easier way to achieve this, because it involved a lot of places need to include some of the checking and update the clusters (group, event, page) publish state if the user renew their subscription or they subscription expired as well.

And we didn't plan for implement this yet because currently you are the only one who want this functionality based on your current site requirement, we will see if there got more user who request this similar functionality so we will definitely consider to add this in the future.

If you urgently to have this functionality on your site, I would suggest you that request for a quote from us at https://crm.stackideas.com and select "Customizations" . Our sales person would gladly send you a quote for the customization that you have requested.
·
Thursday, 02 May 2019 14:41
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for getting back to us, can you check my following summary and see whether I understand correctly with your current requirement :

Active subscription
--------------------------
1. User can able to create their own group, page and event.
2. User also can able to access other user group, page and event on the site.


Inactive subscription
----------------------------
1. User unable to access their own group, page and event.
2. User also unable to access other user group, page and event on the site.

The reason why they subscribe this is because they want to advertise their own business on the Page right?

Hello Arlex,
Is the above description something you can implement easily ?
·
Thursday, 02 May 2019 15:43
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Arlex,
Is the above description something you can implement easily ?

Yes, but still need to apply this following customization code but less code and only involved a few files.

This is what my ideas :

1. Create one of the profile type which set "Allow Community Access" to NO.

2. Set all your Payplans Easysocial profile type app inactive state to this profile type, mean once the user subscription already expired, he will under this profile type which unable to access anything on the Easysocial pages except edit user profile page.

3. Apply this following codes into these files :

Group - JoomlaFolder/components/com_easysocial/views/groups/view.html.php
[gist type="php"]
// do not allow other user access non-community access cluster owner page
$groupCreatorHasCommunityAccess = ES::user($group->creator_uid)->hasCommunityAccess();

if (!$groupCreatorHasCommunityAccess) {
ES::raiseError(404, JText::_('Unable to access because the clusters owner subscription already expired and blablabla.'));
}
[/gist]
Refer my attached screenshot - group code.png

Event - JoomlaFolder/components/com_easysocial/views/events/view.html.php
[gist type="php"]
// do not allow other user access non-community access cluster owner page
$eventCreatorHasCommunityAccess = ES::user($event->creator_uid)->hasCommunityAccess();

if (!$eventCreatorHasCommunityAccess) {
ES::raiseError(404, JText::_('Unable to access because the clusters owner subscription already expired and blablabla.'));
}
[/gist]
Refer my attached screenshot - Event code.png

Page - JoomlaFolder/components/com_easysocial/views/pages/view.html.php
[gist type="php"]
// do not allow other user access non-community access cluster owner page
$pageCreatorHasCommunityAccess = ES::user($page->creator_uid)->hasCommunityAccess();

if (!$pageCreatorHasCommunityAccess) {
ES::raiseError(404, JText::_('Unable to access because the clusters owner subscription already expired and blablabla.'));
}
[/gist]
Refer my attached screenshot - Page code.png

Note: you can modify those sentences word to language constants e.g. you can simply put this COM_ES_CUSTOM_MESSAGE_BLABLABLA then override these language constants into your site backend language override section.

For example :

ES::raiseError(404, JText::_('COM_ES_CUSTOM_MESSAGE_BLABLABLA'));


4. Those group, event and page will not unpublish it, it will still show on the listing page, but when someone trying to view it, it will show the error message.

5. If the owner already renew the subscription, everyone can able to access it as usual.
·
Thursday, 02 May 2019 17:42
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,

I took some time to think about your proposal.
To deny community access is something we can not do as it would impact too heavily the interaction between users.

Would this scenario work:

# Community access for any profile type

# Multiple profile types for individual and professionals
- - Profile A - Registered users (creation is allowed in some but not all categories - ES ACLs)
- - Profile B - Professional users (creation is allowed in other specific categories - ES ACLs)
- - ... and more profile types ...

# PayPlans
Subscription 1 allows profile B users to create group/page/event in specific ES categories (ES ACLs)
- - Any profile type can view the items.
- - Subscription plan 1 for Profile B only affects group/pages/events created by users in the select ES profile type B (creation ACLs)
that means when Plan 1 expires owner AND other users can not access these items, renewal (for OWNER) is compulsory.
The trick is to deny access to ALL users when the OWNER subscription ends.

If you think about an other way to achieve this let me know.
The important is to have:
1. Community access for all profile types
2. Allow specific creation upon subscription for a specific profile type, (but viewing does not require any subscription for other profile types)
3. When the subscription of the creator (owner) ends deny access to ALL profile type for the created items of this owner in the specific categories.

In other words:
I am a subscriber (paying), I can created a page in a category that is normally not permitted without a paid subscription.
Any registered users (no paid subscription needed) can access my created Pages/Groups/events in theses specific categories.
When my own subscription ends, nobody can access these items in those specific categories.

I hope you can clearly understand with all these different ways of describing the request ...
·
Tuesday, 07 May 2019 18:15
·
0 Likes
·
0 Votes
·
0 Comments
·
1. Try apply this following codes into these files :

Group - JoomlaFolder/components/com_easysocial/views/groups/view.html.php
[gist type="php"]
// check if owner of the cluster item subscription still active or not
$ppUser = PP::user($group->creator_uid);
$userPlans = $ppUser->getPlans(PP_SUBSCRIPTION_ACTIVE);

if (!$userPlans) {
ES::raiseError(404, JText::_('Unable to access because the clusters owner subscription already expired and blablabla.'));
}
[/gist]
Same place as what I shown the screenshot at above - group code.png

Event - JoomlaFolder/components/com_easysocial/views/events/view.html.php
[gist type="php"]
// check if owner of the cluster item subscription still active or not
$ppUser = PP::user($event->creator_uid);
$userPlans = $ppUser->getPlans(PP_SUBSCRIPTION_ACTIVE);

if (!$userPlans) {
ES::raiseError(404, JText::_('Unable to access because the clusters owner subscription already expired and blablabla.'));
}
[/gist]
Same place as what I shown the screenshot at above - Event code.png

Page - JoomlaFolder/components/com_easysocial/views/pages/view.html.php
[gist type="php"]
// check if owner of the cluster item subscription still active or not
$ppUser = PP::user($page->creator_uid);
$userPlans = $ppUser->getPlans(PP_SUBSCRIPTION_ACTIVE);

if (!$userPlans) {
ES::raiseError(404, JText::_('Unable to access because the clusters owner subscription already expired and blablabla.'));
}
[/gist]
Same place as what I shown the screenshot at above - Page code.png

Note: you can modify those sentences word to language constants e.g. you can simply put this COM_ES_CUSTOM_MESSAGE_BLABLABLA then override these language constants into your site backend language override section.

For example :

ES::raiseError(404, JText::_('COM_ES_CUSTOM_MESSAGE_BLABLABLA'));


2. Those group, event and page will not unpublish it if the owner subscription expired, it will still show on the listing page, but when someone trying to view it, it will show the error message.

3. If the owner already renew the subscription, everyone can able to access it as usual.
·
Wednesday, 08 May 2019 13:14
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Arlex,

The result is it also blocks the listing views with a return url: ?option=com_easysocial
To be more precise, in the Pages/Groups/Events, there are categories where anyone can create items and then restricted categories that need an active subscription for creation.

I placed the below codes as explained.
Group - JoomlaFolder/components/com_easysocial/views/groups/view.html.php

// check if owner of the cluster item subscription still active or not
$ppUser = PP::user($group->creator_uid);
$userPlans = $ppUser->getPlans(PP_SUBSCRIPTION_ACTIVE);

if (!$userPlans) {
ES::raiseError(404, JText::_('COM_ES_CUSTOM_MESSAGE_SUBSCRIPTION_EXPIRED_GROUP'));
}


Page - JoomlaFolder/components/com_easysocial/views/pages/view.html.php

// check if owner of the cluster item subscription still active or not
$ppUser = PP::user($page->creator_uid);
$userPlans = $ppUser->getPlans(PP_SUBSCRIPTION_ACTIVE);

if (!$userPlans) {
ES::raiseError(404, JText::_('COM_ES_CUSTOM_MESSAGE_SUBSCRIPTION_EXPIRED_PAGE'));
}


Event - JoomlaFolder/components/com_easysocial/views/events/view.html.php

// check if owner of the cluster item subscription still active or not
$ppUser = PP::user($event->creator_uid);
$userPlans = $ppUser->getPlans(PP_SUBSCRIPTION_ACTIVE);

if (!$userPlans) {
ES::raiseError(404, JText::_('COM_ES_CUSTOM_MESSAGE_SUBSCRIPTION_EXPIRED_EVENT'));
}
·
Wednesday, 08 May 2019 20:05
·
0 Likes
·
0 Votes
·
0 Comments
·
My suggested code only validate for the clusters(group/event/page) owner whether their subscription still active or not under single cluster view, if they subscription already expired, then it will throw the error when someone trying to access it.

In other word, it will not block this listing view ?option=com_easysocial and other view as well, only block the single cluster view if the owner subscription already expired.

To be more precise, in the Pages/Groups/Events, there are categories where anyone can create items and then restricted categories that need an active subscription for creation.

I believe you did configure correctly for the cluster categories 'Creation Access' on your site, so if the user subscription already expired, the system will switch this user profile type to another profile type which do not have permission to create cluster item on the site.
·
Thursday, 09 May 2019 11:08
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Arlex,

I believe I understand where we are doing this wrong...
In PP there is no App to allow creation of any kind in EasySocial, only an App to change profile type.

We should not look into the active subscription but rather check the user profile type !

On subscription active the user is moved to profile B
- Creation access - allowed for profile B set in the category ACLs
- Everyone can access the single cluster view

On subscription inactive or no subscription the user is moved back to profile A
- Creation access - denied for profile A set in the category ACLs
- The Error message is displayed when trying to access the single cluster view

PayPal Plan X:
- Extended Community access:
- - Creation of a business page
- - Creation of a business group
- - Creation of business events
- - ...

to allow this subscription features we need to move them from ES profile type (to match category creation access).
The check should then be the ES profile type and not the active subscription.
The Creation access is set in in the cluster category > General Tab > Cluster Creation Access > Select Profiles
·
Thursday, 09 May 2019 15:20
·
0 Likes
·
0 Votes
·
0 Comments
·
Sorry I still lost here.

Can you check again with my following explanation and see whether I understand correctly?

1. On subscription active the user is moved to profile B
- Creation access - allowed for profile B based on the current cluster categories 'Cluster Creation Access' section.
- This profile B user can access their own cluster view.
- This profile B user can access other cluster view as well.
- This profile B user can access cluster listing view. (screenshot : http://take.ms/Qmw4bg)

2. On subscription inactive or no subscription the user is moved back to profile A
- Creation access - denied for profile A based on the current cluster categories 'Cluster Creation Access' section.
- This profile A user can't access their own cluster page.
- This profile A user can't access other cluster page as well.
- This profile A user can't access cluster listing view. (screenshot : http://take.ms/Qmw4bg)
·
Thursday, 09 May 2019 19:19
·
0 Likes
·
0 Votes
·
0 Comments
·
I will try to simplify this by using Valid / Invalid

This is important:
- No specific profile is required to have an active subscription to list or view the valid clusters.
- All users (regardless the profile) can list and access valid clusters

A VALID cluster is:
- a cluster created in a category that does not require a special profile for creation like a default profile A (no or inactive subscription) .
- a cluster created in a category that requires a special profile and who's owner has an active subscription (profile B in our example)

An INVALID cluster is:
- a cluster created in a category that requires profile B, but who's owner has an inactive subscription
The owner was moved back to profile A > his clusters in these specific categories are now invalid

1. On subscription active the user is moved to profile B
- Creation access - allowed for profile B based on the current cluster categories 'Cluster Creation Access' section.
- This profile B user can access any VALID clusters (listing and page)

2. On subscription inactive or no subscription the user is moved back to profile A
- Creation access - denied for profile A based on the current cluster categories 'Cluster Creation Access' section.
- This profile A user can access any VALID clusters (listing and page)
·
Thursday, 09 May 2019 20:26
·
0 Likes
·
0 Votes
·
0 Comments
·
1. Try apply this following codes into these files :

Group - JoomlaFolder/components/com_easysocial/views/groups/view.html.php
[gist type="php"]
$clusterCatModel = ES::model('ClusterCategory');

// Retrieve the current item creation profile type access id
$clusterAccessProfileTypeIds = $clusterCatModel->getAccess($group->category_id);

if ($this->my->id) {

$groupsModel = ES::model('Groups');

// Retrieve the current logged in user creatable categories
$groupCategories = $groupsModel->getCreatableCategories($this->my->getProfile()->id, true);
$creatableCategories = array();

if ($groupCategories) {

foreach ($groupCategories as $groupCat) {
$creatableCategories[] = $groupCat->id;
}
}

// Retrieve the current item owner profile type id
$groupOwnerProfileTypeId = ES::user($group->creator_uid)->getProfile()->id;

// Do not allow those user to access these item if the categories did restricted certain profile type can able to create.
// check for the cluster owner whether still can able to create item under this current item category
if (!empty($creatableCategories) && !in_array($group->category_id, $creatableCategories) && !in_array($groupOwnerProfileTypeId, $clusterAccessProfileTypeIds)) {
$this->info->set(JText::_('COM_ES_CUSTOM_MESSAGE_SUBSCRIPTION_EXPIRED_GROUP'));
return $this->redirect(ESR::groups(array(), false));
}

} else {
// check for public user whether they can able to access these item
// block them if this category item already restricted for certain profile type user to access
if (!empty($clusterAccessProfileTypeIds)) {
$this->info->set(JText::_('COM_ES_CUSTOM_MESSAGE_SUBSCRIPTION_EXPIRED_GROUP'));
return $this->redirect(ESR::groups(array(), false));
}
}
[/gist]
Same place as what I shown the screenshot at above - group code.png

Event - JoomlaFolder/components/com_easysocial/views/events/view.html.php
[gist type="php"]
$clusterCatModel = ES::model('ClusterCategory');

// Retrieve the current item creation profile type access id
$clusterAccessProfileTypeIds = $clusterCatModel->getAccess($event->category_id);

if ($this->my->id) {

$eventsModel = ES::model('EventCategories');

// Retrieve the current logged in user creatable categories
$eventCategories = $eventsModel->getCreatableCategories($this->my->getProfile()->id, true);
$creatableCategories = array();

if ($eventCategories) {

foreach ($eventCategories as $eventCat) {
$creatableCategories[] = $eventCat->id;
}
}

// Retrieve the current item owner profile type id
$eventOwnerProfileTypeId = ES::user($event->creator_uid)->getProfile()->id;

// Do not allow those user to access these item if the categories did restricted certain profile type can able to create.
if (!empty($creatableCategories) && !in_array($event->category_id, $creatableCategories) && !in_array($eventOwnerProfileTypeId, $clusterAccessProfileTypeIds)) {
$this->info->set(JText::_('COM_ES_CUSTOM_MESSAGE_SUBSCRIPTION_EXPIRED_EVENT'));
return $this->redirect(ESR::events(array(), false));
}

} else {
// check for public user whether they can able to access these item
// block them if this category item already restricted for certain profile type user to access
if (!empty($clusterAccessProfileTypeIds)) {
$this->info->set(JText::_('COM_ES_CUSTOM_MESSAGE_SUBSCRIPTION_EXPIRED_EVENT'));
return $this->redirect(ESR::events(array(), false));
}
}
[/gist]
Same place as what I shown the screenshot at above - Event code.png

Page - JoomlaFolder/components/com_easysocial/views/pages/view.html.php
[gist type="php"]
$clusterCatModel = ES::model('ClusterCategory');

// Retrieve the current item creation profile type access id
$clusterAccessProfileTypeIds = $clusterCatModel->getAccess($page->category_id);

if ($this->my->id) {

$pagesModel = ES::model('Pages');

// Retrieve the current logged in user creatable categories
$pageCategories = $pagesModel->getCreatableCategories($this->my->getProfile()->id, true);
$creatableCategories = array();

if ($pageCategories) {

foreach ($pageCategories as $pageCat) {
$creatableCategories[] = $pageCat->id;
}
}

// Retrieve the current item owner profile type id
$pageOwnerProfileTypeId = ES::user($page->creator_uid)->getProfile()->id;

// Do not allow those user to access these item if the categories did restricted certain profile type can able to create.
if (!empty($creatableCategories) && !in_array($page->category_id, $creatableCategories) && !in_array($pageOwnerProfileTypeId, $clusterAccessProfileTypeIds)) {
$this->info->set(JText::_('COM_ES_CUSTOM_MESSAGE_SUBSCRIPTION_EXPIRED_PAGE'));
return $this->redirect(ESR::pages(array(), false));
}

} else {
// check for public user whether they can able to access these item
// block them if this category item already restricted for certain profile type user to access
if (!empty($clusterAccessProfileTypeIds)) {
$this->info->set(JText::_('COM_ES_CUSTOM_MESSAGE_SUBSCRIPTION_EXPIRED_PAGE'));
return $this->redirect(ESR::pages(array(), false));
}
}
[/gist]
Same place as what I shown the screenshot at above - Page code.png
·
Friday, 10 May 2019 11:23
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Arlex,

MANY MANY thanks for your help.
It seems to work as expected but I still need to test further with more categories.

Is there a code I can insert somewhere that instead of this url ( ?option=com_easysocial ) it returns to:
A - ES home page with sef url
or
B - ES cluster listing view (page/event/group)

What do you believe is the best return url? My preference is the cluster listing.
·
Friday, 10 May 2019 20:24
·
0 Likes
·
0 Votes
·
0 Comments
·
I already updated the code at my above reply https://stackideas.com/forums/easysocial-profile-types-acls-upon-subscription#reply-462837 so it will redirect to the cluster listing page when they trying to access invalid cluster page.
·
Saturday, 11 May 2019 15:26
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Arlex,

Yep, I lost all these modifications with the latest updates...
Coming back here for reference and copying the codes because I forgot to do this earlier...

From your knowledge of ES and PP do you think it would be possible to have PP Apps to restrict these kind of access?
I guess users (like Paul Murray, snobben or Philippe and possibly others ...) would also be in demand for such functionality

This is really a great feature, I love it !
SOoooo many, many, many thanks again to you Arlex for the codes you provided
·
Friday, 21 June 2019 00:26
·
0 Likes
·
0 Votes
·
0 Comments
·
You're welcome.

Currently I can't give you an answer whether this possible to achieve this if handle it from the Payplans app because we haven't plan to implement this yet, especially the coding wise we need more time to experiment it and see which method suitable to implement this and easy to maintain in the future, although it's a good feature but maybe not now as our priority is on some of the key features first.

It would be best if you can submit all these feature under our forum 'Feature request' category so our developer will review all these feature request for the next major release of Payplans.
·
Friday, 21 June 2019 11:25
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post