Ejemplo n.º 1
0
 static function create_joomla_users($user_ids)
 {
     foreach ($user_ids as $id) {
         /* If user already in Joomla, warn user and continue to next item */
         if ($id >= 0) {
             JError::raiseWarning(500, JText::_('COM_JOOMDLE_USER_ALREADY_EXISTS_IN_JOOMLA') . ": " . $id);
             continue;
         }
         /* Here we already know ID is from Moodle, as it is not from Joomla */
         $moodle_user = JoomdleHelperContent::call_method('user_details_by_id', -$id);
         //We remove the minus
         if (!$moodle_user) {
             JError::raiseWarning(500, JText::_('COM_JOOMDLE_USER_ID_DOES_NOT_EXIT_IN_MOODLE') . ": " . $id);
             continue;
         }
         $username = $moodle_user['username'];
         JoomdleHelperContent::create_joomla_user($username);
     }
 }