By Vlad on Wednesday, 15 October 2014
Posted in General Issues
Replies 37
Likes 0
Views 628
Votes 0
So once you have created different user profiles, how do you define who is allowed to use which component.

Its a follow up from my prev thread about different user levels.
I have created 2 types of user profiles.

One - registered

Second - public (under Guest User)

Created account under Guest - still have access to dashboard, which is what I did not want to as their purpose is to use only Discuss.

What step have I missed out?
·
Wednesday, 15 October 2014 21:34
·
0 Likes
·
0 Votes
·
0 Comments
·
Site details
·
Wednesday, 15 October 2014 21:40
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Vlad,

You can't actually restrict which component the user can access with profile types actually. The Access Control List in EasySocial controls the limitations or functionality within EasySocial
·
Thursday, 16 October 2014 00:18
·
0 Likes
·
0 Votes
·
0 Comments
·
I cant find the list.
If you can not restrict access, then what is the use in different user groups?
Thanks
·
Thursday, 16 October 2014 10:20
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Vlad,

If I understand you correctly, you want to restrict some user group from accessing EasySocial isn't? You can achieve this by do some tweak to the code. Here I have attached to you a file, can you download it and put it in your site: \components\com_easysocial\easysocial.php . You need to edit this code and put your restricted user group at line: 28.

//restrict user group in this component
$user = JFactory::getUser();
$group = $user->groups[2];
//($group == 2) #2 is the user group id.
//change it according your restricted user group.
if ($group == 2) {
echo "You are not authorized to view this page.";
return;
}

Hope this will work.
Thanks.
·
Thursday, 16 October 2014 11:45
·
0 Likes
·
0 Votes
·
0 Comments
·
youve understood correctly. But do I add this fie or I find similar one and amend?
·
Thursday, 16 October 2014 11:57
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Vlad,

Here I have attached to you another file, please download it and put it in your site: \components\com_easysocial\easysocial.php . In this file, please edit line 28; $restrict = array('2','7'); replace #2 and #7 with your restricted user group id. I hope this worked. By the way this is a temporary customization and may have bugs.

If you wish a perfect customization or if this is a priority, please do post them on our sales section at https://crm.stackideas.com and our sales department would get back to you with a proper quote. I am really sorry but we are actually quite tied up with our own internal development and we wouldn't be able to assist you with these customization right now.

Hope this will work.
Thanks.
·
Thursday, 16 October 2014 12:59
·
0 Likes
·
0 Votes
·
0 Comments
·
right ok, thanks for that anyway. Ill try.
·
Thursday, 16 October 2014 13:04
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Vlad,

If you have anymore question, please don't hesitate to ask us and if this issue is resolved, may I close this thread. Please do update us back.

Thanks and have a wonderful day.
·
Thursday, 16 October 2014 13:45
·
0 Likes
·
0 Votes
·
0 Comments
·
not yet, not tied it. Will let yuo know
·
Thursday, 16 October 2014 13:59
·
0 Likes
·
0 Votes
·
0 Comments
·
you have two numbers for User ID, I have only one to change. Please clarify. Thanks.
·
Thursday, 16 October 2014 14:02
·
0 Likes
·
0 Votes
·
0 Comments
·
Also your file is identical to the old one, do you want me to replace it?
·
Thursday, 16 October 2014 14:07
·
0 Likes
·
0 Votes
·
0 Comments
·
Heres screenshot
Line 28 - no code as you said
Please give more details.
Appreciate your help
·
Thursday, 16 October 2014 14:15
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Vlad,

Please download the latest file attached and put it in your site. You will find the code in line 28 and you need to override the existing file with the latest file. In this file, please edit line 28;
$restrict = array('2','7');
replace '2' with your restricted user group id and delete '7'. It should become:
$restrict = array('2');
. Here the screenshot: http://screencast.com/t/yhs3r2RJT . If you have anymore question, please don't hesitate to ask us.

Hope this will help.
Thanks.
·
Thursday, 16 October 2014 15:42
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mohdy

As I have shown in the screenshot in the file you have provided line 28 that you have mentioned does not exist. Have you provided me with the same file?

Vlad
·
Thursday, 16 October 2014 20:18
·
0 Likes
·
0 Votes
·
0 Comments
·
ALSO, what is the point of different group levels if components react in the same way to different level users. Please educate me on this.

And please do not forget my previous question - line 28 that you have mentioned does not exist int he file you have provided to me.

Thanks
·
Thursday, 16 October 2014 22:04
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Vlad,

Firstly, please understand that the usage of ACL in EasySocial currently is not meant to restrict the access to the components. It's an access control which controls the behavior / limits / access limits of the user that uses the extension.

We associate profile types with Joomla user groups simply because other 3rd party paid subscription system could benefit from this.

I have attached the file that my colleague was supposed to attach earlier below.
·
Friday, 17 October 2014 00:49
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi
Ive changed the file (Picture 1)
In fact I did not have to add any user ID as the User Group (Guest) was was trying to limit is actually 2 (Picture 2)
However, when I log in under Registered user I can not access the Dashboard (Picture 3), but I still can access Discuss (Picture 4)
It seems that the code even restricts registered users, which is what is should not be doing, as I intended the restriction to be applied only to Guest users
Thanks
·
Friday, 17 October 2014 09:03
·
0 Likes
·
0 Votes
·
0 Comments
·
Just another addition. Guest Users also can not have access to Blogs, but Registered can. Hope this will help you calculate the solution.
·
Friday, 17 October 2014 11:44
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Vlad,

Actually this custom restriction is using Joomla user group and your second screenshot shows profile types in EasySocial. Can you refer to this screenshot: http://screencast.com/t/7AT5MBPTdi and find this group id in Joomla user group here: http://screencast.com/t/nSVdIjuRkv . This user group will not have access to EasySocial.

Please be advise.
Thanks.
·
Friday, 17 October 2014 11:50
·
0 Likes
·
0 Votes
·
0 Comments
·
ok will try. Thanks.
·
Friday, 17 October 2014 12:11
·
0 Likes
·
0 Votes
·
0 Comments
·
Ok, weve moved one step forward. Registered users have access to both Dashboard and Discuss.
Guest Users do not have access to neither Dashboard nor to Discuss.
The idea was to let Guests use Discuss, but not Dashboard.
Feels like a small thing is still missing from achieving the result.
Im sure youll work it out in no time.
Thanks
·
Friday, 17 October 2014 12:22
·
0 Likes
·
0 Votes
·
0 Comments
·
Could it be that I simply have to use a different log in provider, i.e. not EasySocial but others from the list?
·
Friday, 17 October 2014 12:26
·
0 Likes
·
0 Votes
·
0 Comments
·
or could it be that I need another additional of custom css for Discuss from you?
·
Friday, 17 October 2014 14:03
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Vlad,

I am sorry for the late reply.
Since we didn't have access to your site, it is a little bit hard for us to understand and giving assistance. We need to test the fix in your site in order to make it work. Here I have attached to you a file, can you download it and put it in your site at the same place: \components\com_easysocial\easysocial.php . This customization code is restricting the restricted user group totally, which means the user cannot use view the profile, friends, followers, events, groups, applications etc. To use this you need to edit this file at line 64 containing code: $restrict = array('2'); change '2' this to your user group id.

//check for ES task before restricting the user group
if ($task != 'login' && $task != 'logout' && $task != 'registration'){
//restrict user group in this component
$user = JFactory::getUser();
$group = $user->groups;

//set the restricted user group id
$restrict = array('2'); //change this to your user group id. ------------> Line 64

foreach ($restrict as $key => $value) {
if (in_array($value, $group)) {
echo "You are not authorized to view this page.";
return;
}
}
}


Hope this will work.
Thanks.
·
Friday, 17 October 2014 16:35
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,

Here the attached file.
·
Friday, 17 October 2014 16:36
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi

I have provided the access. You should have the updated pw.
·
Friday, 17 October 2014 16:37
·
0 Likes
·
0 Votes
·
0 Comments
·
your above instructions are a little confusing. What are we trying to achieve according to this?
·
Friday, 17 October 2014 16:38
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Vlad,

I have put the fix on your site. Can you check this issue for me is this you're trying to achieved and your issue is resolves? If you have anymore question, please don't hesitate to ask us.

Please be advise.
Thanks.
·
Friday, 17 October 2014 17:09
·
0 Likes
·
0 Votes
·
0 Comments
·
What Im trying to do is represented on this picture

Is this what you have done on the website?

Thanks
·
Saturday, 18 October 2014 09:16
·
0 Likes
·
0 Votes
·
0 Comments
·
Ive tested what you have done, and it seems that Guests are banned altogether.
Registered users have access to everything.
Therefore, only Guests need to be rectified.
·
Saturday, 18 October 2014 09:26
·
0 Likes
·
0 Votes
·
0 Comments
·
Actually seems ok. Leave the thread on, ill test it a few times to be sure.
·
Saturday, 18 October 2014 09:33
·
0 Likes
·
0 Votes
·
0 Comments
·
actually this scheme reflects what I would like. Seems like it works.
Please let me know if this is what you have done.
Thanks
·
Saturday, 18 October 2014 11:21
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Vlad,

Based on Yasser's file above, the hack is to restrict Guest user group from accessing EasySocial. That's about it. Also, kindly please do understand that customizations are actually not supported by us.
·
Saturday, 18 October 2014 17:55
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi

But this is all I need in fact. Yasser has done a good job and I appreciate that.

The only thing that has cropped up is this..
when you click register user instead of the usual window it takes you to Registration Completed. So it skips the whole registration.
However, if you try register by clicking on lock icon on the toolbar all is working ok.

Some setting problem?

Thanks
·
Saturday, 18 October 2014 23:37
·
0 Likes
·
0 Votes
·
0 Comments
·
Actually no, it was just the lockdown mode. All is perfect!
Thanks a lot for bearig with me!
·
Saturday, 18 October 2014 23:45
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for updating Vlad, glad that your issues are resolved now
·
Sunday, 19 October 2014 00:24
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post