44 thoughts on “Joomla! + Community Builder custom groups”
L’article a été mis à jour après que Trish m’aie signalé une erreur dans
les remplacements de lignes de code vers la fin du tutoriel. Il manquait un ;
quelque part.
—–
The article was updated after that Trish noticed an error in
code replacements, at the end of the tutorial. It missed a ; somewhere.
You are a lifesaver.
Thank you Guy, for your most excellent tutorial and your personal attention to help me get this working. I have a project that needed exactly this solution, and you saved us.
This is a hack that’s going to make patching hard
This tutorial is about adding custom user groups and as part of the solution modifies both Joomla and Community Builder. Ask your self what happens when you have to patch both Joomla and Community Builder with security updates? Then you have to reapply all you “hacks” again. And it’s not even sure you can, because your a messing with the source code and new updates have every right to change everything in the code as long as the public interfaces are intact.
The tutorial demonstrates a clear violatoin of the Open Closed Principle – leaving the code open for extension but closed for modification. However, I understand that its extremly anoying that Joomla does not come with custom user groups!
I know Mark, that it isn’t going to work with any update. It’s only a short way to have this working with custom groups. I didn’t mean to give a perfect and updatable solution, I just expected to give at least a way to do it, even if it’s dirty.
Guy, can you use the above method for the older Joomla v1.0. Or is it only for v1.5. I have a site with several v1.0 components that will not work on v1.5
articles maintain same groups
Hi Guy, Thank you for sharing your investigation. I did all you post and worked fine, but then I was supposed that when I need post an article now, it would be posible to match with some of the new groups, but id didn’t. My question is if it is possible to do or not?
For some reason I can’t get the rebuild.php script to work. It keeps giving me this error:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/content1/public_html/geronet/rebuild.php on line 1
Hi, look up your code, you probably forgot to put a quote somewhere. If you want, Paste your code here (or send it to me info@guylabbe.ca) we’ll help you out with this.
How can i display a Specific tab only for a different user group.
EX: i want to show “messages” tab on community builder to my custom made user group”Paid members” & hide it from “Registered ” user group when a Registered user visit to a profile i want to show a tab called “Pay to contact this user”
I did everything right. It works, but I would like to show some articles just to the people of my “newgroup” and not to other registered users. Is that possible? I just see the options : public, registered and special. The plugin that you suggest does not work for me. Any other solution????
I think this set of 3 user groups is a different concept than the level user groups we made custom.
I think you will have to hack the content component + admin page… which is pretty dirty… if you have no choice, do it. But keep notes of what you’re doing, because, of course, you’ll have to do it again each time you upgrade your Joomla!; something you may already know. If you’re in need of some hack work such this one you can contact me at info at guylabbe.ca
thats nice patch and helps me a lot. only one thing remaining it cant so diff. fields on registration acc. to usertype. my mean to say if i choose usertype A on registration i want those tab fields on which i had giveN access level to usertype A. and if i choose usertype B on registration i want those tab fields on which i had given access level to usertype B.
Go to your phpmyadmin, if available and add the custom made groups into your ‘jos_groups’ table as well. It somewhat worked for me but you may need some other changes.
Hi,
I use both CB and JUGA. (www.dioscouri.com)
JUGA creates ‘groups’ inside the ‘registered’ users.
Having applied your hack both nee groups act on the same level.
This makes it impossible to use JUGA’s option to hide content A in an article to group B if group A and B both are children of Registered.
Any workaround?
that nice patch and solved my many problems, only one thing remaining, how to show different fields during new user registration. working fine also in cb 1.2.1. i have created two usertype talent and employer your patch helps me to show different tabs on both usertypes profile. but it cant show same fields on registration form can anyone help me.
I used Jquery to hide and pop back fields that were not needed. For fields that were needed in one usertype to fields that were needed in some other usertype and filled the hidden ones with garbage data. A lot of possibilities are available but it’s messy.
Uzair.
P.S. I’ve made a demo on the homepage, check it out.
Thanks for the walk through… everything works perfectly except for one small problem.
When I as an admin try to create users myself in the backend I get an error that reads the following:
illegal attempt to set user at higher level than allowed !
Warning: Invalid argument supplied for foreach() in /home/sdunited/public_html/recruit/administrator/components/com_comprofiler/comprofiler.class.php on line 3897
Warning: Invalid argument supplied for foreach() in /home/sdunited/public_html/recruit/administrator/components/com_comprofiler/comprofiler.class.php on line 3502
hello, i want to create custom access group like “public , registered , special ” thats i want..to make my new vip group member to have view access on my pages with specific access group like “vip” ..
You must replace database connection informations by yours.
NOM_DUTILISATEUR_BD = enter your username here
MOT_DE_PASSE_BD = enter your password here
NOM_DELA_BD = enter name of the database here
Avec ses 55 millions de membres, force est de reconnaître que Facebook est une plateforme intéressante pour pousser son business. microsoft mcitp Intelligemment utilisé et pour les bons sujets, ce réseau social se révèle être une machine de guerre très efficace pour augmenter votre visibilité, voire vos ventes.
At first thanks for your great guide. Fortunatelly I’ve been operating a Job seeker site, to where this function mentioned absolutely useful. I’ve made 2 categories, namely: Employer, Job Seeker… I’ve checked in Joomla/User management and both of them exist, but if I registering as a employer the registration get in to the Employer section, if register a Job Seeker, the registered user get in to regular registered user section, not in the Job Seeker.
How can solve it, is that means any difficulties on the further??
I’ve followed the steps you provide. But stuck in the / administrator / components / com_comprofiler / comprofiler.class.php, because it turned out that the code you give is different from that available to me.
in your code, I have to find (line 3036):
. “\ n AND t.useraccessgroupid IN (“. getChildGIDS implode (‘,’, (userGID ($ _CB_framework-> myId () ))).”)”;
in my file, only to find this (line 784):
“t.useraccessgroupid IN (“. getChildGIDS implode (‘,’, (userGID ($ _CB_framework-> myId () ))).”)”;
I tried to replace the existing line but error. Maybe core-CB that I use is different from what you wear. FYI, I use Joomla 1.5.15 and CB 1.2.2 version…
First of all, thanks a lot for the great tutorial. I could add new groups to Joomla.
What my problem is, if I set up a tab for Employee or Employer then the tabs do not display
If I set them back as REGSITERED, then I can see the tabs again.
Could you tell me any advice regarding the solution?
Hi, it is me again. I tried to do the coding again, at this time I only paste the necessary code into the comprofiler.class.php, so I deleted the old rows.
And it is working!
Super solution.
Wit this I can give mu usergroups a different ‘layout’ on my pages.
Code snippet: < ?php
$acl =& JFactory::getACL();
jimport('joomla.application.component.helper'); // include libraries/application/component/helper.php
$usersParams = & JComponentHelper::getParams('com_users'); // load the Params
// "generate" a new JUser Object
$user = & JFactory::getUser();
$data = array($user); // array for all user settings
$usertype = $usersParams->get($user->id);
$user =& JFactory::getUser(); $usergid = $user->get('gid');
//echo "Group ID = " . $usergid . ' ' ; //I know the groupID now
// End test (It works!!!!)
// echo "The Template used = $template || css = $css ";
// IE8 puts everything to the left without the empty echo,
echo ""
?>
This, in combination with clever use of JUGA makes it look like there are diferens sites
is it possible to have different CB access levels for the user groups?
For example:
Group A and Group B. There should be a Tab which only appears in the profil of Group B. Group A should be able to see this tab in the profiles of Group B, but this tab should not appear in their own Group A.
I just can’t make this work, when I run the sript in my browser I get: Could not connect: Access denied for user ‘XXXXXXXXXX’@’72.209.15.50′ (using password: YES) (where XX is the database name. I’ve double checked username/passwords… they are correct.
I’m using 1and1 server, php version 5.2.17, joomla 1.5.22 and It’s a clean install of joomla on a site I just started building, so there are no other plugins/modules that would conflict. Also worth noting, I have not yet installed CB……… any help appreciated
L’article a été mis à jour après que Trish m’aie signalé une erreur dans
les remplacements de lignes de code vers la fin du tutoriel. Il manquait un ;
quelque part.
—–
The article was updated after that Trish noticed an error in
code replacements, at the end of the tutorial. It missed a ; somewhere.
You are a lifesaver.
Thank you Guy, for your most excellent tutorial and your personal attention to help me get this working. I have a project that needed exactly this solution, and you saved us.
This is a hack that’s going to make patching hard
This tutorial is about adding custom user groups and as part of the solution modifies both Joomla and Community Builder. Ask your self what happens when you have to patch both Joomla and Community Builder with security updates? Then you have to reapply all you “hacks” again. And it’s not even sure you can, because your a messing with the source code and new updates have every right to change everything in the code as long as the public interfaces are intact.
The tutorial demonstrates a clear violatoin of the Open Closed Principle – leaving the code open for extension but closed for modification. However, I understand that its extremly anoying that Joomla does not come with custom user groups!
I know Mark, that it isn’t going to work with any update. It’s only a short way to have this working with custom groups. I didn’t mean to give a perfect and updatable solution, I just expected to give at least a way to do it, even if it’s dirty.
Guy, can you use the above method for the older Joomla v1.0. Or is it only for v1.5. I have a site with several v1.0 components that will not work on v1.5
Sorry I’m affraid it’s only working on J!1.5 and above versions …
articles maintain same groups
Hi Guy, Thank you for sharing your investigation. I did all you post and worked fine, but then I was supposed that when I need post an article now, it would be posible to match with some of the new groups, but id didn’t. My question is if it is possible to do or not?
Thanks in advance,
Marcelo Parra
Hi, that should be possible without much trouble, need to see closer. I suggest you to use this component instead, according to “crony” (posted comment bellow) : http://extensions.joomla.org/extensions/access-&-security/frontend-access-control/7010/details
This hack won’t work on CB 1.2.1 will it?
For some reason I can’t get the rebuild.php script to work. It keeps giving me this error:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/content1/public_html/geronet/rebuild.php on line 1
Any ideas? Thanks!
Hi, look up your code, you probably forgot to put a quote somewhere. If you want, Paste your code here (or send it to me info@guylabbe.ca) we’ll help you out with this.
How can i display a Specific tab only for a different user group.
EX: i want to show “messages” tab on community builder to my custom made user group”Paid members” & hide it from “Registered ” user group when a Registered user visit to a profile i want to show a tab called “Pay to contact this user”
Help Appreciated.
Hi, you can set which user group has the “right” to see a tab. Click on the detail page of your tab in CB admin
I did everything right. It works, but I would like to show some articles just to the people of my “newgroup” and not to other registered users. Is that possible? I just see the options : public, registered and special. The plugin that you suggest does not work for me. Any other solution????
Thanks a lot
I think this set of 3 user groups is a different concept than the level user groups we made custom.
I think you will have to hack the content component + admin page… which is pretty dirty… if you have no choice, do it. But keep notes of what you’re doing, because, of course, you’ll have to do it again each time you upgrade your Joomla!; something you may already know. If you’re in need of some hack work such this one you can contact me at info at guylabbe.ca
hi sir
thats nice patch and helps me a lot. only one thing remaining it cant so diff. fields on registration acc. to usertype. my mean to say if i choose usertype A on registration i want those tab fields on which i had giveN access level to usertype A. and if i choose usertype B on registration i want those tab fields on which i had given access level to usertype B.
THANKS IN ADVANCE
Go to your phpmyadmin, if available and add the custom made groups into your ‘jos_groups’ table as well. It somewhat worked for me but you may need some other changes.
Uzair.
Hi,
I use both CB and JUGA. (www.dioscouri.com)
JUGA creates ‘groups’ inside the ‘registered’ users.
Having applied your hack both nee groups act on the same level.
This makes it impossible to use JUGA’s option to hide content A in an article to group B if group A and B both are children of Registered.
Any workaround?
Aftyer some adjustement it works, even with 3 groups.
I use {jugaaccess [groupname] to show conten belonging to each specific group.
sorry I couldn’t reply to you before, I’m glad to see you’ve found a workaround. I don’t know Juga so I think I weren’t able to help you
that nice patch and solved my many problems, only one thing remaining, how to show different fields during new user registration. working fine also in cb 1.2.1. i have created two usertype talent and employer your patch helps me to show different tabs on both usertypes profile. but it cant show same fields on registration form can anyone help me.
thanks in advance
I used Jquery to hide and pop back fields that were not needed. For fields that were needed in one usertype to fields that were needed in some other usertype and filled the hidden ones with garbage data. A lot of possibilities are available but it’s messy.
Uzair.
P.S. I’ve made a demo on the homepage, check it out.
Thanks for the walk through… everything works perfectly except for one small problem.
When I as an admin try to create users myself in the backend I get an error that reads the following:
illegal attempt to set user at higher level than allowed !
Warning: Invalid argument supplied for foreach() in /home/sdunited/public_html/recruit/administrator/components/com_comprofiler/comprofiler.class.php on line 3897
Warning: Invalid argument supplied for foreach() in /home/sdunited/public_html/recruit/administrator/components/com_comprofiler/comprofiler.class.php on line 3502
Any thoughts? Thanks
Hi Joe, what is your Joomla! version? (exactly)
hello, i want to create custom access group like “public , registered , special ” thats i want..to make my new vip group member to have view access on my pages with specific access group like “vip” ..
did…you read the article?
Hello ,
I did every thing exatlly as you said here!
But while am running the php patch rebuild.php I always have this error :
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/sifae/public_html/mbn/rebuild.php on line 11
Please note my Joomla Ver = 1.5.14.
Thanks for this great Idea,
Best Regards,
Tariq Hamed
This is the code am using :
< ?php
mysql_connect("localhost", "NOM_DUTILISATEUR_BD", "MOT_DE_PASSE_BD") or
die("Could not connect: " . mysql_error());
mysql_select_db("NOM_DELA_BD");
rebuild_tree ( 0 , 1);
function rebuild_tree($parent_id, $left) {
$right = $left+1;
$result = mysql_query('SELECT id FROM jos_core_acl_aro_groups '.
'WHERE parent_id="'.$parent_id.'";');
while ($row = mysql_fetch_array($result)) {
$right = rebuild_tree($row['id'], $right);
}
mysql_query('UPDATE jos_core_acl_aro_groups SET lft='.$left.', rgt='.
$right.' WHERE id="'.$parent_id.'";');
return $right+1;
}
?>
You must replace database connection informations by yours.
NOM_DUTILISATEUR_BD = enter your username here
MOT_DE_PASSE_BD = enter your password here
NOM_DELA_BD = enter name of the database here
Hello,
& its work with me now
Its great work
Please … do you have similir solution to add more user Access goroups more then Public/Registers/Special ?
Thanks again
Best Regards
That’s the matter of this tutorial, isn’t it?
Avec ses 55 millions de membres, force est de reconnaître que Facebook est une plateforme intéressante pour pousser son business. microsoft mcitp Intelligemment utilisé et pour les bons sujets, ce réseau social se révèle être une machine de guerre très efficace pour augmenter votre visibilité, voire vos ventes.
At first thanks for your great guide. Fortunatelly I’ve been operating a Job seeker site, to where this function mentioned absolutely useful. I’ve made 2 categories, namely: Employer, Job Seeker… I’ve checked in Joomla/User management and both of them exist, but if I registering as a employer the registration get in to the Employer section, if register a Job Seeker, the registered user get in to regular registered user section, not in the Job Seeker.
How can solve it, is that means any difficulties on the further??
I’ve followed the steps you provide. But stuck in the / administrator / components / com_comprofiler / comprofiler.class.php, because it turned out that the code you give is different from that available to me.
in your code, I have to find (line 3036):
. “\ n AND t.useraccessgroupid IN (“. getChildGIDS implode (‘,’, (userGID ($ _CB_framework-> myId () ))).”)”;
in my file, only to find this (line 784):
“t.useraccessgroupid IN (“. getChildGIDS implode (‘,’, (userGID ($ _CB_framework-> myId () ))).”)”;
I tried to replace the existing line but error. Maybe core-CB that I use is different from what you wear. FYI, I use Joomla 1.5.15 and CB 1.2.2 version…
thanks btw…
Took a LOT of work but got it going. JLS only installs through CB plugin management and not through Joomla’s install. Got stuck there for ages.
Thanks a TON.
Ok, I see, I should specify this clearly in the future.
First of all, thanks a lot for the great tutorial. I could add new groups to Joomla.
What my problem is, if I set up a tab for Employee or Employer then the tabs do not display
If I set them back as REGSITERED, then I can see the tabs again.
Could you tell me any advice regarding the solution?
Many thanks for your help in advance.
Susie
Hi, it is me again. I tried to do the coding again, at this time I only paste the necessary code into the comprofiler.class.php, so I deleted the old rows.
And it is working!
Great
Glad it helped!
hi, nice tutorial
how would you do the same for menu items?
Super solution.
Wit this I can give mu usergroups a different ‘layout’ on my pages.
Code snippet:
< ?php$acl =& JFactory::getACL();
jimport('joomla.application.component.helper'); // include libraries/application/component/helper.php
$usersParams = & JComponentHelper::getParams('com_users'); // load the Params
// "generate" a new JUser Object
$user = & JFactory::getUser();
$data = array($user); // array for all user settings
$usertype = $usersParams->get($user->id);
$user =& JFactory::getUser(); $usergid = $user->get('gid');
//echo "Group ID = " . $usergid . ' ' ; //I know the groupID now
switch ($usergid) {
case 31:
//echo 'Groep = ' .$usergid . ', Herlecollege';
$template ='hc_bedlam';
$css= 'hc';
break;
case 32:
//echo 'Groep = '. $usergid . ', Vrienden';
$template= 'web_bedlam';
$css= 'web';
break;
case 33:
//echo 'Groep = '. $usergid . ', Talen';
$template= 'cur_bedlam';
$css= 'cur';
break;
case 28:
//echo 'Groep = '. $usergid . ', USERS';
$template= 'base';
$css= 'base';
break;
case 29:
//echo 'Groep = ' .$usergid . ', Public Frontend';
$template= 'base';
$css = 'base';
break;
default: $usergid = 0;
//echo 'Standaard Groep = '. $usergid. ', Geen groep Id';
$template= 'base';
$css = 'base';
break;
}
// End test (It works!!!!)
// echo "The Template used = $template || css = $css ";
// IE8 puts everything to the left without the empty echo,
echo ""
?>
This, in combination with clever use of JUGA makes it look like there are diferens sites
Hello,
is it possible to have different CB access levels for the user groups?
For example:
Group A and Group B. There should be a Tab which only appears in the profil of Group B. Group A should be able to see this tab in the profiles of Group B, but this tab should not appear in their own Group A.
I hope someone can help me. Thanks.
I just can’t make this work, when I run the sript in my browser I get: Could not connect: Access denied for user ‘XXXXXXXXXX’@’72.209.15.50′ (using password: YES) (where XX is the database name. I’ve double checked username/passwords… they are correct.
I’m using 1and1 server, php version 5.2.17, joomla 1.5.22 and It’s a clean install of joomla on a site I just started building, so there are no other plugins/modules that would conflict. Also worth noting, I have not yet installed CB……… any help appreciated
You need to enable joomla’s legacy plugin.