[英]How to convert joomla(ACL) from joomla 1.5 to joomla 2.5 version
I have a function in joomla 1.5 我在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;
}
But when run as joomla 2.5 is error is: 但是当以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 ?
The ACL system for Joomla! Joomla的ACL系统! 2.5 is completely different and there is no simple answer to your question (Joomla! 1.5's attempt at ACL was only half implemted).
2.5是完全不同的,您的问题没有简单的答案(Joomla!1.5在ACL上的尝试仅意味着一半)。
You would be best of starting with " Access Control List/1.6-2.5/Tutorial " on the Joomla! 您最好从Joomla上的“ Access Control List / 1.6-2.5 / Tutorial ”开始! doc's site.
doc的网站。 The reading through 2.5 core components like
com_users
and com_content
. 通读2.5个核心组件,例如
com_users
和com_content
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.