This question has been asked on the forum before but never answered, so I will try again.
Whenever I click on User Manager to maintain my users, I get the following error:
"Fatal error: Class 'JModelList' not found in /home/midstat3/public_html/administrator/components/com_users/models/users.php on line 19"
My site was Joomla 1.5.21 when I got the error so I upgraded to 1.5.23 but till get the exact same error. Everything else on my site seems to work fine (from what I have tested thus far).
This is critical as it impacts my live site. I am unable to do anything in the User Manager with Joomla.
Regards
daalouw
Class 'JModelList' not found
Moderator: General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
-
- Joomla! Apprentice
- Posts: 47
- Joined: Tue Oct 20, 2009 11:19 pm
- OOmNezar
- Joomla! Ace
- Posts: 1869
- Joined: Mon Sep 07, 2009 3:18 am
Re: Class 'JModelList' not found
You said 1.5.23 Can you show that file here ?daalouw wrote:.... /home/midstat3/public_html/administrator/components/com_users/models/users.php on line 19"....
coffee & smoke just fine
OOm Nezar
-
- Joomla! Apprentice
- Posts: 47
- Joined: Tue Oct 20, 2009 11:19 pm
Re: Class 'JModelList' not found
Here is the code from that file:
<?php
/**
* @version $Id: user.php 20196 2011-01-09 02:40:25Z ian $
* @copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access.
defined('_JEXEC') or die;
jimport('joomla.application.component.modeladmin');
/**
* User model.
*
* @package Joomla.Administrator
* @subpackage com_users
* @since 1.6
*/
class UsersModelUser extends JModelAdmin
{
/**
* Returns a reference to the a Table object, always creating it.
*
* @param type $type The table type to instantiate
* @param string $prefix A prefix for the table class name. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JTable A database object
* @since 1.6
*/
public function getTable($type = 'User', $prefix = 'JTable', $config = array())
{
$table = JTable::getInstance($type, $prefix, $config);
return $table;
}
/**
* Method to get a single record.
*
* @param integer $pk The id of the primary key.
*
* @return mixed Object on success, false on failure.
* @since 1.6
*/
public function getItem($pk = null)
{
$result = parent::getItem($pk);
// Get the dispatcher and load the users plugins.
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('user');
// Trigger the data preparation event.
$results = $dispatcher->trigger('onContentPrepareData', array('com_users.user', $result));
return $result;
}
/**
* Method to get the record form.
*
* @param array $data An optional array of data for the form to interogate.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
* @return JForm A JForm object on success, false on failure
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
{
// Initialise variables.
$app = JFactory::getApplication();
// Get the form.
$form = $this->loadForm('com_users.user', 'user', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form)) {
return false;
}
return $form;
}
/**
* Method to get the data that should be injected in the form.
*
* @return mixed The data for the form.
* @since 1.6
*/
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = JFactory::getApplication()->getUserState('com_users.edit.user.data', array());
if (empty($data)) {
$data = $this->getItem();
}
// TODO: Maybe this can go into the parent model somehow?
// Get the dispatcher and load the users plugins.
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('user');
// Trigger the data preparation event.
$results = $dispatcher->trigger('onContentPrepareData', array('com_users.profile', $data));
// Check for errors encountered while preparing the data.
if (count($results) && in_array(false, $results, true)) {
$this->setError($dispatcher->getError());
}
return $data;
}
/**
* Override JModelAdmin::preprocessForm to ensure the correct plugin group is loaded.
*
* @param object $form A form object.
* @param mixed $data The data expected for the form.
* @param string $group The name of the plugin group to import (defaults to "content").
*
* @throws Exception if there is an error in the form event.
* @since 1.6
*/
protected function preprocessForm(JForm $form, $data, $group = 'user')
{
parent::preprocessForm($form, $data, $group);
}
/**
* Method to save the form data.
*
* @param array $data The form data.
*
* @return boolean True on success.
* @since 1.6
*/
public function save($data)
{
// Initialise variables;
$pk = (!empty($data['id'])) ? $data['id'] : (int) $this->getState('user.id');
$user = JUser::getInstance($pk);
$my = JFactory::getUser();
if ($data['block'] && $pk == $my->id && !$my->block) {
$this->setError(JText::_('COM_USERS_USERS_ERROR_CANNOT_BLOCK_SELF'));
return false;
}
// Make sure that we are not removing ourself from Super Admin group
$iAmSuperAdmin = $my->authorise('core.admin');
if ($iAmSuperAdmin && $my->get('id') == $pk) {
// Check that at least one of our new groups is Super Admin
$stillSuperAdmin = false;
$myNewGroups = $data['groups'];
foreach ($myNewGroups as $group) {
$stillSuperAdmin = ($stillSuperAdmin) ? ($stillSuperAdmin) : JAccess::checkGroup($group, 'core.admin');
}
if (!$stillSuperAdmin) {
$this->setError(JText::_('COM_USERS_USERS_ERROR_CANNOT_DEMOTE_SELF'));
return false;
}
}
// Bind the data.
if (!$user->bind($data)) {
$this->setError($user->getError());
return false;
}
// Store the data.
if (!$user->save()) {
$this->setError($user->getError());
return false;
}
$this->setState('user.id', $user->id);
return true;
}
/**
* Method to delete rows.
*
* @param array $pks An array of item ids.
*
* @return boolean Returns true on success, false on failure.
* @since 1.6
*/
public function delete(&$pks)
{
// Initialise variables.
$user = JFactory::getUser();
$table = $this->getTable();
$pks = (array) $pks;
// Check if I am a Super Admin
$iAmSuperAdmin = $user->authorise('core.admin');
// Trigger the onUserBeforeSave event.
JPluginHelper::importPlugin('user');
$dispatcher = JDispatcher::getInstance();
if (in_array($user->id, $pks)) {
$this->setError(JText::_('COM_USERS_USERS_ERROR_CANNOT_DELETE_SELF'));
return false;
}
// Iterate the items to delete each one.
foreach ($pks as $i => $pk)
{
if ($table->load($pk)) {
// Access checks.
$allow = $user->authorise('core.delete', 'com_users');
// Don't allow non-super-admin to delete a super admin
$allow = (!$iAmSuperAdmin && JAccess::check($pk, 'core.admin')) ? false : $allow;
if ($allow) {
// Get users data for the users to delete.
$user_to_delete = JFactory::getUser($pk);
// Fire the onUserBeforeDelete event.
$dispatcher->trigger('onUserBeforeDelete', array($table->getProperties()));
if (!$table->delete($pk)) {
$this->setError($table->getError());
return false;
} else {
// Trigger the onUserAfterDelete event.
$dispatcher->trigger('onUserAfterDelete', array($user_to_delete->getProperties(), true, $this->getError()));
}
}
else {
// Prune items that you can't change.
unset($pks[$i]);
JError::raiseWarning(403, JText::_('JERROR_CORE_DELETE_NOT_PERMITTED'));
}
}
else {
$this->setError($table->getError());
return false;
}
}
return true;
}
/**
* Method to block user records.
*
* @param array $pks The ids of the items to publish.
* @param int $value The value of the published state
*
* @return boolean True on success.
* @since 1.6
*/
function block(&$pks, $value = 1)
{
// Initialise variables.
$app = JFactory::getApplication();
$dispatcher = JDispatcher::getInstance();
$user = JFactory::getUser();
// Check if I am a Super Admin
$iAmSuperAdmin = $user->authorise('core.admin');
$table = $this->getTable();
$pks = (array) $pks;
JPluginHelper::importPlugin('user');
// Access checks.
foreach ($pks as $i => $pk)
{
if ($value == 1 && $pk == $user->get('id')) {
// Cannot block yourself.
unset($pks[$i]);
JError::raiseWarning(403, JText::_('COM_USERS_USERS_ERROR_CANNOT_BLOCK_SELF'));
}
else if ($table->load($pk)) {
$old = $table->getProperties();
$allow = $user->authorise('core.edit.state', 'com_users');
// Don't allow non-super-admin to delete a super admin
$allow = (!$iAmSuperAdmin && JAccess::check($pk, 'core.admin')) ? false : $allow;
// Prepare the logout options.
$options = array(
'clientid' => array(0, 1)
);
if ($allow) {
// Skip changing of same state
if ($table->block == $value) {
unset($pks[$i]);
continue;
}
$table->block = (int) $value;
// Allow an exception to be thrown.
try
{
if (!$table->check()) {
$this->setError($table->getError());
return false;
}
// Trigger the onUserBeforeSave event.
$result = $dispatcher->trigger('onUserBeforeSave', array($old, false));
if (in_array(false, $result, true)) {
// Plugin will have to raise it's own error or throw an exception.
return false;
}
// Store the table.
if (!$table->store()) {
$this->setError($table->getError());
return false;
}
// Trigger the onAftereStoreUser event
$dispatcher->trigger('onUserAfterSave', array($table->getProperties(), false, true, null));
}
catch (Exception $e)
{
$this->setError($e->getMessage());
return false;
}
// Log the user out.
if ($value) {
$app->logout($table->id, $options);
}
}
else {
// Prune items that you can't change.
unset($pks[$i]);
JError::raiseWarning(403, JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'));
}
}
}
return true;
}
/**
* Method to activate user records.
*
* @param array $pks The ids of the items to activate.
*
* @return boolean True on success.
* @since 1.6
*/
function activate(&$pks)
{
// Initialise variables.
$dispatcher = JDispatcher::getInstance();
$user = JFactory::getUser();
// Check if I am a Super Admin
$iAmSuperAdmin = $user->authorise('core.admin');
$table = $this->getTable();
$pks = (array) $pks;
// Access checks.
foreach ($pks as $i => $pk)
{
if ($table->load($pk)) {
$old = $table->getProperties();
$allow = $user->authorise('core.edit.state', 'com_users');
// Don't allow non-super-admin to delete a super admin
$allow = (!$iAmSuperAdmin && JAccess::check($pk, 'core.admin')) ? false : $allow;
if (empty($table->activation)) {
// Ignore activated accounts.
unset($pks[$i]);
}
else if ($allow) {
$table->block = 0;
$table->activation = '';
// Allow an exception to be thrown.
try
{
if (!$table->check()) {
$this->setError($table->getError());
return false;
}
// Trigger the onUserBeforeSave event.
$result = $dispatcher->trigger('onUserBeforeSave', array($old, false));
if (in_array(false, $result, true)) {
// Plugin will have to raise it's own error or throw an exception.
return false;
}
// Store the table.
if (!$table->store()) {
$this->setError($table->getError());
return false;
}
// Fire the onAftereStoreUser event
$dispatcher->trigger('onUserAfterSave', array($table->getProperties(), false, true, null));
}
catch (Exception $e)
{
$this->setError($e->getMessage());
return false;
}
}
else {
// Prune items that you can't change.
unset($pks[$i]);
JError::raiseWarning(403, JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'));
}
}
}
return true;
}
/**
* Perform batch operations
*
* @param array $config An array of variable for the batch operation
* @param array $user_ids An array of IDs on which to operate
* @since 1.6
*/
public function batch($config, $user_ids)
{
// Ensure there are selected users to operate on.
if (empty($user_ids)) {
$this->setError(JText::_('COM_USERS_USERS_NO_ITEM_SELECTED'));
return false;
}
else if (!empty($config)) {
// Only run operations if a config array is present.
// Ensure there is a valid group.
$group_id = JArrayHelper::getValue($config, 'group_id', 0, 'int');
JArrayHelper::toInteger($user_ids);
if ($group_id < 1) {
$this->setError(JText::_('COM_USERS_ERROR_INVALID_GROUP'));
return false;
}
// Get the system ACL object and set the mode to database driven.
$acl = JFactory::getACL();
$oldAclMode = $acl->setCheckMode(1);
$groupLogic = JArrayHelper::getValue($config, 'group_logic');
switch ($groupLogic)
{
case 'set':
$doDelete = 2;
$doAssign = true;
break;
case 'del':
$doDelete = true;
$doAssign = false;
break;
case 'add':
default:
$doDelete = false;
$doAssign = true;
break;
}
// Remove the users from the group(s) if requested.
if ($doDelete) {
// Purge operation, remove the users from all groups.
if ($doDelete === 2) {
$this->_db->setQuery(
'DELETE FROM `#__user_usergroup_map`' .
' WHERE `user_id` IN ('.implode(',', $user_ids).')'
);
}
else {
// Remove the users from the group.
$this->_db->setQuery(
'DELETE FROM `#__user_usergroup_map`' .
' WHERE `user_id` IN ('.implode(',', $user_ids).')' .
' AND `group_id` = '.$group_id
);
}
// Check for database errors.
if (!$this->_db->query()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
}
// Assign the users to the group if requested.
if ($doAssign) {
// Build the tuples array for the assignment query.
$tuples = array();
foreach ($user_ids as $id)
{
$tuples[] = '('.$id.','.$group_id.')';
}
$this->_db->setQuery(
'INSERT IGNORE INTO `#__user_usergroup_map` (`user_id`, `group_id`)' .
' VALUES '.implode(',', $tuples)
);
// Check for database errors.
if (!$this->_db->query()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
}
// Set the ACL mode back to it's previous state.
$acl->setCheckMode($oldAclMode);
}
return true;
}
/**
* Gets the available groups.
*
* @return array
* @since 1.6
*/
public function getGroups()
{
$user = JFactory::getUser();
if ($user->authorise('core.edit', 'com_users') && $user->authorise('core.manage', 'com_users'))
{
$model = JModel::getInstance('Groups', 'UsersModel', array('ignore_request' => true));
return $model->getItems();
}
else
{
return null;
}
}
/**
* Gets the groups this object is assigned to
*
* @return array
* @since 1.6
*/
public function getAssignedGroups($userId = null)
{
// Initialise variables.
$userId = (!empty($userId)) ? $userId : (int)$this->getState('user.id');
if (empty($userId)) {
$result = array();
$config = JComponentHelper::getParams('com_users');
if ($groupId = $config->get('new_usertype')) {
$result[$groupId] = null;
}
}
else {
jimport('joomla.user.helper');
$result = JUserHelper::getUserGroups($userId);
}
return $result;
}
}
<?php
/**
* @version $Id: user.php 20196 2011-01-09 02:40:25Z ian $
* @copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access.
defined('_JEXEC') or die;
jimport('joomla.application.component.modeladmin');
/**
* User model.
*
* @package Joomla.Administrator
* @subpackage com_users
* @since 1.6
*/
class UsersModelUser extends JModelAdmin
{
/**
* Returns a reference to the a Table object, always creating it.
*
* @param type $type The table type to instantiate
* @param string $prefix A prefix for the table class name. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JTable A database object
* @since 1.6
*/
public function getTable($type = 'User', $prefix = 'JTable', $config = array())
{
$table = JTable::getInstance($type, $prefix, $config);
return $table;
}
/**
* Method to get a single record.
*
* @param integer $pk The id of the primary key.
*
* @return mixed Object on success, false on failure.
* @since 1.6
*/
public function getItem($pk = null)
{
$result = parent::getItem($pk);
// Get the dispatcher and load the users plugins.
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('user');
// Trigger the data preparation event.
$results = $dispatcher->trigger('onContentPrepareData', array('com_users.user', $result));
return $result;
}
/**
* Method to get the record form.
*
* @param array $data An optional array of data for the form to interogate.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
* @return JForm A JForm object on success, false on failure
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
{
// Initialise variables.
$app = JFactory::getApplication();
// Get the form.
$form = $this->loadForm('com_users.user', 'user', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form)) {
return false;
}
return $form;
}
/**
* Method to get the data that should be injected in the form.
*
* @return mixed The data for the form.
* @since 1.6
*/
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = JFactory::getApplication()->getUserState('com_users.edit.user.data', array());
if (empty($data)) {
$data = $this->getItem();
}
// TODO: Maybe this can go into the parent model somehow?
// Get the dispatcher and load the users plugins.
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('user');
// Trigger the data preparation event.
$results = $dispatcher->trigger('onContentPrepareData', array('com_users.profile', $data));
// Check for errors encountered while preparing the data.
if (count($results) && in_array(false, $results, true)) {
$this->setError($dispatcher->getError());
}
return $data;
}
/**
* Override JModelAdmin::preprocessForm to ensure the correct plugin group is loaded.
*
* @param object $form A form object.
* @param mixed $data The data expected for the form.
* @param string $group The name of the plugin group to import (defaults to "content").
*
* @throws Exception if there is an error in the form event.
* @since 1.6
*/
protected function preprocessForm(JForm $form, $data, $group = 'user')
{
parent::preprocessForm($form, $data, $group);
}
/**
* Method to save the form data.
*
* @param array $data The form data.
*
* @return boolean True on success.
* @since 1.6
*/
public function save($data)
{
// Initialise variables;
$pk = (!empty($data['id'])) ? $data['id'] : (int) $this->getState('user.id');
$user = JUser::getInstance($pk);
$my = JFactory::getUser();
if ($data['block'] && $pk == $my->id && !$my->block) {
$this->setError(JText::_('COM_USERS_USERS_ERROR_CANNOT_BLOCK_SELF'));
return false;
}
// Make sure that we are not removing ourself from Super Admin group
$iAmSuperAdmin = $my->authorise('core.admin');
if ($iAmSuperAdmin && $my->get('id') == $pk) {
// Check that at least one of our new groups is Super Admin
$stillSuperAdmin = false;
$myNewGroups = $data['groups'];
foreach ($myNewGroups as $group) {
$stillSuperAdmin = ($stillSuperAdmin) ? ($stillSuperAdmin) : JAccess::checkGroup($group, 'core.admin');
}
if (!$stillSuperAdmin) {
$this->setError(JText::_('COM_USERS_USERS_ERROR_CANNOT_DEMOTE_SELF'));
return false;
}
}
// Bind the data.
if (!$user->bind($data)) {
$this->setError($user->getError());
return false;
}
// Store the data.
if (!$user->save()) {
$this->setError($user->getError());
return false;
}
$this->setState('user.id', $user->id);
return true;
}
/**
* Method to delete rows.
*
* @param array $pks An array of item ids.
*
* @return boolean Returns true on success, false on failure.
* @since 1.6
*/
public function delete(&$pks)
{
// Initialise variables.
$user = JFactory::getUser();
$table = $this->getTable();
$pks = (array) $pks;
// Check if I am a Super Admin
$iAmSuperAdmin = $user->authorise('core.admin');
// Trigger the onUserBeforeSave event.
JPluginHelper::importPlugin('user');
$dispatcher = JDispatcher::getInstance();
if (in_array($user->id, $pks)) {
$this->setError(JText::_('COM_USERS_USERS_ERROR_CANNOT_DELETE_SELF'));
return false;
}
// Iterate the items to delete each one.
foreach ($pks as $i => $pk)
{
if ($table->load($pk)) {
// Access checks.
$allow = $user->authorise('core.delete', 'com_users');
// Don't allow non-super-admin to delete a super admin
$allow = (!$iAmSuperAdmin && JAccess::check($pk, 'core.admin')) ? false : $allow;
if ($allow) {
// Get users data for the users to delete.
$user_to_delete = JFactory::getUser($pk);
// Fire the onUserBeforeDelete event.
$dispatcher->trigger('onUserBeforeDelete', array($table->getProperties()));
if (!$table->delete($pk)) {
$this->setError($table->getError());
return false;
} else {
// Trigger the onUserAfterDelete event.
$dispatcher->trigger('onUserAfterDelete', array($user_to_delete->getProperties(), true, $this->getError()));
}
}
else {
// Prune items that you can't change.
unset($pks[$i]);
JError::raiseWarning(403, JText::_('JERROR_CORE_DELETE_NOT_PERMITTED'));
}
}
else {
$this->setError($table->getError());
return false;
}
}
return true;
}
/**
* Method to block user records.
*
* @param array $pks The ids of the items to publish.
* @param int $value The value of the published state
*
* @return boolean True on success.
* @since 1.6
*/
function block(&$pks, $value = 1)
{
// Initialise variables.
$app = JFactory::getApplication();
$dispatcher = JDispatcher::getInstance();
$user = JFactory::getUser();
// Check if I am a Super Admin
$iAmSuperAdmin = $user->authorise('core.admin');
$table = $this->getTable();
$pks = (array) $pks;
JPluginHelper::importPlugin('user');
// Access checks.
foreach ($pks as $i => $pk)
{
if ($value == 1 && $pk == $user->get('id')) {
// Cannot block yourself.
unset($pks[$i]);
JError::raiseWarning(403, JText::_('COM_USERS_USERS_ERROR_CANNOT_BLOCK_SELF'));
}
else if ($table->load($pk)) {
$old = $table->getProperties();
$allow = $user->authorise('core.edit.state', 'com_users');
// Don't allow non-super-admin to delete a super admin
$allow = (!$iAmSuperAdmin && JAccess::check($pk, 'core.admin')) ? false : $allow;
// Prepare the logout options.
$options = array(
'clientid' => array(0, 1)
);
if ($allow) {
// Skip changing of same state
if ($table->block == $value) {
unset($pks[$i]);
continue;
}
$table->block = (int) $value;
// Allow an exception to be thrown.
try
{
if (!$table->check()) {
$this->setError($table->getError());
return false;
}
// Trigger the onUserBeforeSave event.
$result = $dispatcher->trigger('onUserBeforeSave', array($old, false));
if (in_array(false, $result, true)) {
// Plugin will have to raise it's own error or throw an exception.
return false;
}
// Store the table.
if (!$table->store()) {
$this->setError($table->getError());
return false;
}
// Trigger the onAftereStoreUser event
$dispatcher->trigger('onUserAfterSave', array($table->getProperties(), false, true, null));
}
catch (Exception $e)
{
$this->setError($e->getMessage());
return false;
}
// Log the user out.
if ($value) {
$app->logout($table->id, $options);
}
}
else {
// Prune items that you can't change.
unset($pks[$i]);
JError::raiseWarning(403, JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'));
}
}
}
return true;
}
/**
* Method to activate user records.
*
* @param array $pks The ids of the items to activate.
*
* @return boolean True on success.
* @since 1.6
*/
function activate(&$pks)
{
// Initialise variables.
$dispatcher = JDispatcher::getInstance();
$user = JFactory::getUser();
// Check if I am a Super Admin
$iAmSuperAdmin = $user->authorise('core.admin');
$table = $this->getTable();
$pks = (array) $pks;
// Access checks.
foreach ($pks as $i => $pk)
{
if ($table->load($pk)) {
$old = $table->getProperties();
$allow = $user->authorise('core.edit.state', 'com_users');
// Don't allow non-super-admin to delete a super admin
$allow = (!$iAmSuperAdmin && JAccess::check($pk, 'core.admin')) ? false : $allow;
if (empty($table->activation)) {
// Ignore activated accounts.
unset($pks[$i]);
}
else if ($allow) {
$table->block = 0;
$table->activation = '';
// Allow an exception to be thrown.
try
{
if (!$table->check()) {
$this->setError($table->getError());
return false;
}
// Trigger the onUserBeforeSave event.
$result = $dispatcher->trigger('onUserBeforeSave', array($old, false));
if (in_array(false, $result, true)) {
// Plugin will have to raise it's own error or throw an exception.
return false;
}
// Store the table.
if (!$table->store()) {
$this->setError($table->getError());
return false;
}
// Fire the onAftereStoreUser event
$dispatcher->trigger('onUserAfterSave', array($table->getProperties(), false, true, null));
}
catch (Exception $e)
{
$this->setError($e->getMessage());
return false;
}
}
else {
// Prune items that you can't change.
unset($pks[$i]);
JError::raiseWarning(403, JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'));
}
}
}
return true;
}
/**
* Perform batch operations
*
* @param array $config An array of variable for the batch operation
* @param array $user_ids An array of IDs on which to operate
* @since 1.6
*/
public function batch($config, $user_ids)
{
// Ensure there are selected users to operate on.
if (empty($user_ids)) {
$this->setError(JText::_('COM_USERS_USERS_NO_ITEM_SELECTED'));
return false;
}
else if (!empty($config)) {
// Only run operations if a config array is present.
// Ensure there is a valid group.
$group_id = JArrayHelper::getValue($config, 'group_id', 0, 'int');
JArrayHelper::toInteger($user_ids);
if ($group_id < 1) {
$this->setError(JText::_('COM_USERS_ERROR_INVALID_GROUP'));
return false;
}
// Get the system ACL object and set the mode to database driven.
$acl = JFactory::getACL();
$oldAclMode = $acl->setCheckMode(1);
$groupLogic = JArrayHelper::getValue($config, 'group_logic');
switch ($groupLogic)
{
case 'set':
$doDelete = 2;
$doAssign = true;
break;
case 'del':
$doDelete = true;
$doAssign = false;
break;
case 'add':
default:
$doDelete = false;
$doAssign = true;
break;
}
// Remove the users from the group(s) if requested.
if ($doDelete) {
// Purge operation, remove the users from all groups.
if ($doDelete === 2) {
$this->_db->setQuery(
'DELETE FROM `#__user_usergroup_map`' .
' WHERE `user_id` IN ('.implode(',', $user_ids).')'
);
}
else {
// Remove the users from the group.
$this->_db->setQuery(
'DELETE FROM `#__user_usergroup_map`' .
' WHERE `user_id` IN ('.implode(',', $user_ids).')' .
' AND `group_id` = '.$group_id
);
}
// Check for database errors.
if (!$this->_db->query()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
}
// Assign the users to the group if requested.
if ($doAssign) {
// Build the tuples array for the assignment query.
$tuples = array();
foreach ($user_ids as $id)
{
$tuples[] = '('.$id.','.$group_id.')';
}
$this->_db->setQuery(
'INSERT IGNORE INTO `#__user_usergroup_map` (`user_id`, `group_id`)' .
' VALUES '.implode(',', $tuples)
);
// Check for database errors.
if (!$this->_db->query()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
}
// Set the ACL mode back to it's previous state.
$acl->setCheckMode($oldAclMode);
}
return true;
}
/**
* Gets the available groups.
*
* @return array
* @since 1.6
*/
public function getGroups()
{
$user = JFactory::getUser();
if ($user->authorise('core.edit', 'com_users') && $user->authorise('core.manage', 'com_users'))
{
$model = JModel::getInstance('Groups', 'UsersModel', array('ignore_request' => true));
return $model->getItems();
}
else
{
return null;
}
}
/**
* Gets the groups this object is assigned to
*
* @return array
* @since 1.6
*/
public function getAssignedGroups($userId = null)
{
// Initialise variables.
$userId = (!empty($userId)) ? $userId : (int)$this->getState('user.id');
if (empty($userId)) {
$result = array();
$config = JComponentHelper::getParams('com_users');
if ($groupId = $config->get('new_usertype')) {
$result[$groupId] = null;
}
}
else {
jimport('joomla.user.helper');
$result = JUserHelper::getUserGroups($userId);
}
return $result;
}
}
- OOmNezar
- Joomla! Ace
- Posts: 1869
- Joined: Mon Sep 07, 2009 3:18 am
Re: Class 'JModelList' not found
Make sure you are not install Joomla 1.6
This is 1.5 Forum
And Look like there is file for Joomla 1.6
What are you doing before it's happen ?
May be you are try downgrade or something ?
Not yet helpfull, but just try to help
This is 1.5 Forum
And Look like there is file for Joomla 1.6
What are you doing before it's happen ?
May be you are try downgrade or something ?
Not yet helpfull, but just try to help
coffee & smoke just fine
OOm Nezar
-
- Joomla! Apprentice
- Posts: 47
- Joined: Tue Oct 20, 2009 11:19 pm
Re: Class 'JModelList' not found
This is a new website freshly installed onto a webhost. I am loaded the Akeeba archive file and restored m,y site from the archive file. I am not sure if the host installed a native Joomla 1.6 or Joomla 1.5 install prior to my site installation itself.
Is there anything I can do to get this site fixed?
I appreciate your help tremendously.
daalouw
Is there anything I can do to get this site fixed?
I appreciate your help tremendously.
daalouw
-
- Joomla! Apprentice
- Posts: 5
- Joined: Fri Feb 27, 2009 3:25 am
Re: Class 'JModelList' not found
I had the same problem after a failed 1.6 upgrade.
I fixed it by renaming/deleting the user.php file generating the error (it isn't part of the 1.5.x installation)
I fixed it by renaming/deleting the user.php file generating the error (it isn't part of the 1.5.x installation)
-
- Joomla! Apprentice
- Posts: 47
- Joined: Tue Oct 20, 2009 11:19 pm
Re: Class 'JModelList' not found
Greendl, I tried renaming that file and now I get a 404 error (module not found).
I upgraded to Joomla 1.5.25 and still no luck. This is critical to my organization (as I am sure all issues reported here are critical) but it has been 6 months and I still cannot get to my users on the site. Anybody?
I upgraded to Joomla 1.5.25 and still no luck. This is critical to my organization (as I am sure all issues reported here are critical) but it has been 6 months and I still cannot get to my users on the site. Anybody?