Actions

J1.5 talk

Difference between revisions of "Custom user groups"

From Joomla! Documentation

m (Source script error?: new section)
Line 67: Line 67:
 
Well, something is wrong… The question is, what am I doing wrong?
 
Well, something is wrong… The question is, what am I doing wrong?
 
AND what is the function of lft and rgt in the jos_core_acl_aro_groups table?
 
AND what is the function of lft and rgt in the jos_core_acl_aro_groups table?
 +
 +
== Source script error? ==
 +
 +
Hey, I think the php source provided to rebuild the lft and rgt values is wrong.
 +
 +
If you run it against the un-modified jos_core_acl_aro_user_groups table, you will find that the values assigned are different from the original values.
 +
 +
The problem appears to be in the first call to rebuild_tree:
 +
rebuild_tree ( 0 , 1);
 +
 +
If you change this to
 +
rebuild_tree ( 0 , 0);
 +
 +
Then run it against the original jos_..._groups table, the values remain as they were originally.
 +
 +
Not sure if it fixes anything though!

Revision as of 20:20, 14 October 2009

For displaying the groups correctly you will have to change the code of : /administrator/components/com_users/admin.users.php line 285:

if ( $userGroupName == $myGroupName && $myGroupName == 'administrator' )

  {
     // administrators can't change each other
     $lists['gid'] = '<input type="hidden" name="gid" value="'. $user->get('gid') .'" />'. JText::_( 'Administrator' ) .'';
  }
  else
  {
     $gtree = $acl->get_group_children_tree( null, 'USERS', false );into 

if ( $userGroupName == $myGroupName && $myGroupName == 'administrator' )

  {
     // administrators can't change each other
     $lists['gid'] = '<input type="hidden" name="gid" value="'. $user->get('gid') .'" />'. JText::_( 'Administrator' ) .'';
  }
  else
  {
     $gtree = $acl->get_group_children_tree( null, 'USERS', true);

I use Joomla 1.5.7 and I don't have the /administrator/components/com_users/admin.users.php file. (at least in that address)


I am on my first try too, and I found the call in

../administrator/components/com_users/views/user/view.html.php

on Line 113 (in a J- 1.5.8 wich is patched to a 1.5.9)


Here is a more detailed explanation of my problem I’m running joomla 1.5.9 under windows(test) and linux(production). Using instructions provided here http://docs.joomla.org/Custom_user_groups (this same instruction has been repeated on countless other websites)

This is what I’ve done on my test windows box

1. edited line 113 of \administrator\components\com_users\views\user\view.html.php, changing from : $gtree = $acl->get_group_children_tree( null, 'USERS', false); to : $gtree = $acl->get_group_children_tree( null, 'USERS', true );

2. I added new group to jos_core_acl_aro_groups, say NGrp, parent_id=18 as Registered group’s id=18. I got NGrp’s id=31

3. I run rebuild.php and got lft=12, rgt=13 for NGrp group

4. I added NGrp to jos_groups, id=3, name=NGrp

5. I created new user, say NUser and assigned it to NGrp group. NGrp group which, based on the visual clues of the select , is at the same level as Author group?? - Users         Public Front-end       . - Registered       .        Author       .       . - Editor       .       .       - Publisher       .       - NGrp       -  Public Back-end             - Manager                   - Administrator                         - Super Administrator

6. The NGrp only appears as selectable under Menus ?? (can live with this unless anyone can suggest a solution?) Changed access to an existing menu item, say Nmenu from Registered to NGrp

8. Logged in as NUser, I went to click on the Nmenu item- it's not visible to me (or any other type of user - not even publisher)

Well, something is wrong… The question is, what am I doing wrong? AND what is the function of lft and rgt in the jos_core_acl_aro_groups table?

Source script error?

Hey, I think the php source provided to rebuild the lft and rgt values is wrong.

If you run it against the un-modified jos_core_acl_aro_user_groups table, you will find that the values assigned are different from the original values.

The problem appears to be in the first call to rebuild_tree: rebuild_tree ( 0 , 1);

If you change this to rebuild_tree ( 0 , 0);

Then run it against the original jos_..._groups table, the values remain as they were originally.

Not sure if it fixes anything though!