Foros del Web » Creando para Internet » Sistemas de gestión de contenidos » Joomla »

Error en funcion Joomla 1.6

Estas en el tema de Error en funcion Joomla 1.6 en el foro de Joomla en Foros del Web. Buscando una forma de crear usuarios atravez de mi componente joomla, me encontre en el sitio oficial una funcion que realiza ese trabajo, pero me ...
  #1 (permalink)  
Antiguo 22/12/2010, 17:56
Avatar de ONahuelO  
Fecha de Ingreso: junio-2009
Ubicación: Gualeguaychú, Argentina
Mensajes: 144
Antigüedad: 14 años, 10 meses
Puntos: 4
Error en funcion Joomla 1.6

Buscando una forma de crear usuarios atravez de mi componente joomla, me encontre en el sitio oficial una funcion que realiza ese trabajo, pero me retorna un error:

Código:
Fatal error: Call to undefined method JAccess::get_group_id() in ........\default.php on line 53

Esta es la funcion:
Código PHP:
/*

I handle this code as if it is a snippet of a method or function!!

First set up some variables/objects
*/
// get the ACL
$acl =& JFactory::getACL();

/* get the com_user params */

jimport('joomla.application.component.helper'); // include libraries/application/component/helper.php
$usersParams = &JComponentHelper::getParams'com_users' ); // load the Params

// "generate" a new JUser Object
$user JFactory::getUser(0); // it's important to set the "0" otherwise your admin user information will be loaded

$data = array(); // array for all user settings

// get the default usertype
$usertype $usersParams->get'new_usertype' );
if (!
$usertype) {
    
$usertype 'Registered';
}

// set up the "main" user information

$data['name'] = $firstname.' '.$lastname// add first- and lastname
$data['username'] = $username// add username
$data['email'] = $email// add email
$data['gid'] = $acl->get_group_id''$usertype'ARO' );  // generate the gid from the usertype

/* no need to add the usertype, it will be generated automaticaly from the gid */

$data['password'] = $password// set the password
$data['password2'] = $password// confirm the password
$data['sendEmail'] = 1// should the user receive system mails?

/* Now we can decide, if the user will need an activation */

$useractivation $usersParams->get'useractivation' ); // in this example, we load the config-setting
if ($useractivation == 1) { // yeah we want an activation

    
jimport('joomla.user.helper'); // include libraries/user/helper.php
    
$data['block'] = 1// block the User
    
$data['activation'] =JUtility::getHashJUserHelper::genRandomPassword() ); // set activation hash (don't forget to send an activation email)

}
else { 
// no we need no activation

    
$data['block'] = 0// don't block the user

}

if (!
$user->bind($data)) { // now bind the data to the JUser Object, if it not works....

    
JError::raiseWarning(''JText::_$user->getError())); // ...raise an Warning
    
return false// if you're in a method/function return false

}

if (!
$user->save()) { // if the user is NOT saved...

    
JError::raiseWarning(''JText::_$user->getError())); // ...raise an Warning
    
return false// if you're in a method/function return false

}

return 
$user// else return the new JUser object 
URL:http://docs.joomla.org/JUser
  #2 (permalink)  
Antiguo 23/12/2010, 07:06
Avatar de Larenz
Colaborador
 
Fecha de Ingreso: enero-2007
Ubicación: Nicaragua
Mensajes: 1.398
Antigüedad: 17 años, 3 meses
Puntos: 55
Respuesta: Error en funcion Joomla 1.6

Aún está en RC el Joomla 1.6, así que mejor somete tu caso con ellos ya que sigue en desarrollo y no hay una versión final estable de Joomla 1.6. Deberías de informarte mejor.
__________________
¡No lo sé todo! Pero comencé como tú, ¡sin saber nada!
Encuéntrame en Facebook: Perfil + Página

Etiquetas: funcion
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 21:41.