/** * Returns the webex user that hosts this meeting. * * @return bool|user The WebEx user. False on failure. */ public function get_host_webex_user() { global $USER; $webexuser = false; if (isset($this->hostwebexid)) { try { // Try and load the user for this meetings user. $webexuser = \mod_webexactivity\user::load_webex_id($this->hostwebexid); } catch (\coding_exception $e) { $webexuser = false; } } // If we haven't set it, try and set it to the current user. if (!$webexuser) { $webexuser = \mod_webexactivity\user::load_for_user($USER); } return $webexuser; }
$mform = new \mod_webexactivity\useredit_form(); if ($mform->is_cancelled()) { \mod_webexactivity\webex::password_return_redirect(); } else { if ($fromform = $mform->get_data()) { $webexuser = \mod_webexactivity\user::load_for_user($user, false); if (!$webexuser) { throw new coding_exception('An unknown error occurred while trying to reload the user'); } $webexuser->password = $fromform->password; $webexuser->save_to_db(); \mod_webexactivity\webex::password_return_redirect(); } else { $webexuser = false; try { $webexuser = \mod_webexactivity\user::load_for_user($user); } catch (\mod_webexactivity\local\exception\webexactivity_exception $e) { // TODO: Should not be needed after 0.2.0. $webexuser = \mod_webexactivity\user::create(); $webexuser->moodleuserid = $id; $webexuser->email = $user->email; if ($webexuser->update_from_webex()) { $webexuser->save_to_db(); } else { $webexuser = false; } } if ($webexuser) { $data = new stdClass(); $data->id = $id; $data->action = 'useredit';