【问题标题】:How to convert joomla(ACL) from joomla 1.5 to joomla 2.5 version如何将 joomla(ACL) 从 joomla 1.5 转换为 joomla 2.5 版本
【发布时间】:2012-08-18 13:00:53
【问题描述】:

我在 joomla 1.5 中有一个函数

function saveuser($row){
    $db =& JFactory::getDBO();
    $instance = new JUser();
    jimport('joomla.application.component.helper');
    $config   = &JComponentHelper::getParams('com_users');
    if(!isset($row['usertype']))
    $row['usertype'] = $config->get( 'new_usertype', 'Registered' );

    $acl =& JFactory::getACL();
    if(!$row['gid'])
    $row['gid'] = $acl->get_group_id( '', $usertype);

    $instance->set( 'id'            , $row['id'] );
    $instance->set( 'name'          , $row['name'] );
    $instance->set( 'username'      , $row['username'] );
    $instance->set( 'password'      , $row['password'] );
    $instance->set( 'email'         , $row['email'] );
    $instance->set( 'gid'           , $row['gid']);
    $instance->set( 'usertype'      , $row['usertype'] );
    unset($instance->password_clear);
    unset($instance->guest);
    unset($instance->aid);
    $ret = $db->insertObject( '#__users', $instance, 'id' );
    if(!$ret){
        return false;
    }
    $acl->add_object( 'users', $row['username'], $row['id'], null, null, 'ARO' );
    $acl->add_group_object( $row['gid'], 'users', $row['id'], 'ARO' );
    return true;
}

但是当以 joomla 2.5 运行时,错误是:

Fatal error: Call to undefined method JAccess::get_group_id() in ... on line ...
Fatal error: Call to undefined method JAccess::add_object() in ... on line ...
Fatal error: Call to undefined method JAccess::add_group_object() ... on line ...

How to fix this function to joomla 2.5, How to ideas ?

【问题讨论】:

    标签: php joomla joomla1.5 joomla2.5


    【解决方案1】:

    Joomla 的 ACL 系统! 2.5 完全不同,您的问题没有简单的答案(Joomla! 1.5 对 ACL 的尝试只实现了一半)。

    您最好在 Joomla! 上以“Access Control List/1.6-2.5/Tutorial”开头!医生的网站。通读com_userscom_content等2.5个核心组件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-05-01
      • 2013-01-12
      • 2014-03-01
      • 2013-02-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多