Question

I'm trying to add a User Note while programmatically adding a user. I've been working quite successfully from Joomla 3.0 Register user with php script, but am unable to figure out how J32 adds a note - in model notes.php, the save function is commented out, so it's a deadend for me while I figure out all this marvelous new version of the best CMS out there.

Is there some method to do this - an equivalent to registering like $model->addnote,

Was it helpful?

Solution

i couldn't find a method but here is the script i have used within my own plugin. All seems to work correctly

protected function _addNote($vars) {

    $now = new JDate();
    $now = $now->toSql();

    // Create and save the user note
    $userNote    = (object) array(
                    'user_id'            => $vars['id'],
                    'catid'              => 0,
                    'subject'            => "User Information Update By Proworx",
                    'body'               => "<p>User ".$vars['name']." has been updated to:</p><p>Name: ".$vars['name']."</p><p>Email: ".$vars['email']."</p><p>Password: Not Telling... check proworx</p>",
                    'state'              => 1,
                    'created_user_id'                => 332, //DONT FORGET TO CHANGE THIS VALUE TO YOUR SITES ADMIN
                    'created_time'                   => $now
    );
    $db     = JFactory::getDbo();
    $db->insertObject('#__user_notes', $userNote, 'id');
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top