Dao plugin
For Joomla 1.5 & 1.6
"DAO works by creating a 'Workspace' object in which all database operations are performed". More on wikipedia
Download, install and enable:
Then:
To get row in users table:
$user = User::Retrieve( $user_id );
Done!
To create new user:
$user = new User();
$user->username = "My new user";
$user->Save();
To update:
$user->email = "my@new-email.org";
$user->Save();
To delete:
$user = User::Retrieve( $user_id );
$user->Delete();
To get collection of users:
In User class add property (all entities classes are in plugins/system/entities for Joomla 1.5 and plugins/system/dao/entities for Joomla 1.6)
static function ukEmailHoldersCollection()
{
$entity = new Entity();
$query = "SELECT * FROM users WHERE email LIKE '%uk'";
return $entity->Collection( $query, null, __CLASS__ );
}
Then in your model or wherever:
$users = User::ukEmailHoldersCollection();
Any questions ask on forum. Documentation will be available soon.