function save() { global $database, $jTips; $bind = array(); $this->set('updated', gmdate('Y-m-d H:i:s')); foreach ($this as $prop => $val) { $bind[$prop] = $val; } if (!$this->bind($bind)) { return false; } //jTipsDebug("IDA: " .$this->id); if (!$this->check()) { return false; } if (!$this->user_id) { jTipsLogger::_log('attempt to save jtipsuser with no related josuser. aborted', 'ERROR'); return false; } //jTipsDebug("IDB: " .$this->id); if (empty($this->id) and !empty($this->season_id)) { $newUser = true; } else { $newUser = false; } //Bug 36: Set the image property to empty string instead of null if (!$this->store(true)) { jTipsLogger::_log($this->_db->getErrorMsg(), 'ERROR'); return false; } //jTipsDebug("IDC " .$this->id); //late entry points here jTipsLogger::_log('saving user with id ' . $this->id . ' and season ' . $this->season_id); if ($newUser) { // BUG 406 - optionally set reminders as on by default if ($jTips['DefaultReminders']) { jTipsLogger::_log('setting email reminder option as on by default'); $this->setPreference('email_reminder', 1); } jTipsLogger::_log('setting default points for new user for season ' . $this->season_id); $jSeason = new jSeason($database); $jSeason->load($this->season_id); jTipsLogger::_log('comparing dates ' . date('Y-m-d') . ' >? ' . TimeDate::toDatabaseDate($jSeason->start_time)); if (date('Y-m-d') > TimeDate::toDatabaseDate($jSeason->start_time)) { $jSeason->getDefaultPoints($this->id); } if ($jTips['JomSocialActivities'] and $jTips['JomSocialOnUserJoin']) { // BUG 334 - typo in user_id variable. jTipsJomSocial::writeJoinMessage($this->user_id, $jSeason); } } return true; }