Multisys Network Co. Ltd. 多元網絡有限公司
 

Create Joomla 1.5 User Group and CCboard 1.2 Group Mapping

Part 1: Create Joomla User Group

(Part 1 Source : http://docs.joomla.org/Custom_user_groups .Following information is provided as reference only. Multisys Network will NOT corresponding on any corruption or data lost. )

I use custom user groups (user roles) within Joomla 1.5. For example under the registered users group I've added several subgroups:
myproject
 customers
  customer A admin
 product manager
  product manager admin
 etc....

I use these groups within my extension to set the permissions.
When I add the groups into the jos_core_acl_aro_groups table and set the relations correctly the groups in the user management are not displayed correctly (e.q. the administrator groups disappear). For displaying the groups correctly you will have to change the code of : administrator/components/com_users/admin.users.php line 285:

(Not sure in what version this changed - but in J! 1.5.14 this change is no longer in the administrator/components/com_users/admin.users.php file. This change must now be made to administrator/components/com_users/views/user/view.html.php on line 113.)

if ( $userGroupName == $myGroupName && $myGroupName == 'administrator' )
   {
      // administrators can't change each other
      $lists['gid'] = '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'] = 'get('gid') .'" />'. JText::_( 'Administrator' ) .'';
   }
   else
   {
      $gtree = $acl->get_group_children_tree( null, 'USERS', true);
 


If you like to add your self custom groups do the following:
Edit the jos_core_acl_aro_groups table and add your custom groups (for example with phpmyadmin). When you add a new group make sure that you assign the correct parent to the added group. For example: the joomla registered group has the ID 19, when you assign a subgroup to it make sure that the parent_id is 19. Dont assign the lft and rght fields yet but use the code below to rebuild the groups tree correctly:

 

Create a PHP File under joomla server installation. Please change the user name , password and database name to meet your case.

// Edit the variables below to match your
// configuration. Leave the host localhost
// unless you KNOW that it is supposed to be
// different.
 
$user="USER" ;
$password="PASSWORD" ;
$db="DATABASE" ;
 
$host=localhost ;
 
    mysql_connect("$host", "$user", "$password") or
        die("Could not connect: " . mysql_error());
       mysql_select_db("$db");
 
    // 0-> parent_id in Joomla this is the value of the parent_id field of the Root record
    // 1-> start the left tree at 1
    rebuild_tree ( 0 , 1);
 
 
    function rebuild_tree($parent_id, $left) {
 
 
    // the right value of this node is the left value + 1
       $right = $left+1;
 
       // get all children of this node
       $result = mysql_query('SELECT id FROM jos_core_acl_aro_groups '.'WHERE parent_id="'.$parent_id.'";')
          or die(mysql_error());
 
       while ($row = mysql_fetch_array($result)) {
           // recursive execution of this function for each
           // child of this node
           // $right is the current right value, which is
           // incremented by the rebuild_tree function
           $right = rebuild_tree($row['id'], $right);
         }
 
       // we've got the left value, and now that we've processed
       // the children of this node we also know the right value
       mysql_query('UPDATE jos_core_acl_aro_groups SET lft='.$left.', rgt='.
                    $right.' WHERE id="'.$parent_id.'";');
 
       // return the right value of this node + 1
       return $right+1;
    }
echo 'Complete! Go check your Joomla User Admin!'
    ?>
 

Open the script from web browser to execute the script. Joomla group is created and rebuild. 

 

Part 2 : ccboard 1.2 RC

(Srouce : Reseach by Multisys Network Company Limited , http://www.multisys.hk)

Edit file under your joomla installation:

administrator/components/com_ccboard/elements/permission.php

edit class "JElementPermissions'
Add Line


JHTML::_('select.option', $acl->get_group_id(null, 'new group name'),JText::_('new group name') ),


example :

 class JElementPermissions extends JElement
{
    var $_name = 'Permissions';
    function fetchElement($name, $value, &$node, $control_name)
    {
        $acl = &JFactory::getACL();
        $fieldName = $name;

        $items = array(
            JHTML::_('select.option', '0', 'Guest'),
            JHTML::_('select.option', $acl->get_group_id(null, 'Registered'), JText::_('REGISTERED') ),
            JHTML::_('select.option', $acl->get_group_id(null, 'Author'), JText::_('AUTHOR')),
            JHTML::_('select.option', $acl->get_group_id(null, 'Editor'), JText::_('EDITOR')),
            JHTML::_('select.option', $acl->get_group_id(null, 'Publisher'), JText::_('PUBLISHER')),
            JHTML::_('select.option', $acl->get_group_id(null, 'Team Leader 2'), JText::_('Team Leader 2')),
            JHTML::_('select.option', $acl->get_group_id(null, 'Manager'), JText::_('MANAGER')),
            JHTML::_('select.option', $acl->get_group_id(null, 'Administrator'), JText::_('ADMINISTRATOR')),
            JHTML::_('select.option', $acl->get_group_id(null, 'Super Administrator'), JText::_('CCB_SUPER_ADMINISTRATOR')),
        );

        return JHTML::_('select.genericlist', $items, $fieldName, 'style="width:200px;"', 'value', 'text', $value, $control_name.$name);
    }

 

.........................

........................

Search

電腦過了保養期怎麼辦 ?

電腦及notebook 過了保養期 ?

本公司可以提供比原廠更優惠的維修服務 !

請即聯絡我們 !

檢查及報價只需港幣$250

連上門收機及送回給客戶

如有查詢, 歡迎以

fbmessenger s

Facebook Messenger

或致電 35788288 與我們聯絡

只限香港境內

零件及人工另行報價

各大官方維修中心聯絡方法

我們的模型業務及課程

我們的模型業務課程

gundam model img

© 2016 Multisys Network Company Limited. All Rights Reserved.