0

joomla1.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 ?
4

1 に答える 1

0

Joomla の ACL システム! 2.5 は完全に異なり、あなたの質問に対する簡単な答えはありません (ACL に対する Joomla! 1.5 の試みは半分しか実装されていませんでした)。

Joomla の「 Access Control List/1.6-2.5/Tutorial 」から始めるとよいでしょう。ドクターのサイト。com_usersおよびのような 2.5 コア コンポーネントの読み取りcom_content

于 2012-08-23T03:58:02.470 に答える