}
+ /**
+ * Clears a profile.
+ * *always deletes in: profile_addresses, profile_binets, profile_job,
+ * profile_langskills, profile_mentor, profile_networking,
+ * profile_phones, profile_skills, watch_profile
+ * *always keeps in: profile_corps, profile_display, profile_education,
+ * profile_medals, profile_name, profile_photos, search_name
+ * *modifies: profiles
+ */
+ public function clear()
+ {
+ $tables = array(
+ 'profile_job', 'profile_langskills', 'profile_mentor',
+ 'profile_networking', 'profile_skills', 'watch_profile',
+ 'profile_phones', 'profile_addresses', 'profile_binets');
+
+ foreach ($tables as $t) {
+ XDB::execute('DELETE FROM ' . $t . '
+ WHERE pid = {?}',
+ $this->id());
+ }
+
+ XDB::execute("UPDATE profiles
+ SET cv = NULL, freetext = NULL, freetext_pub = 'private',
+ medals_pub = 'private', alias_pub = 'private',
+ email_directory = NULL
+ WHERE pid = {?}",
+ $this->id());
+ }
+
/** Sets the level of visibility of the profile
* Sets $this->visibility to a list of valid visibilities.
* @param one of the self::VIS_* values
*/
public function clear($clearAll = true)
{
- XDB::execute('DELETE FROM account_lost_passwords, register_marketing,
- register_pending, register_subs, watch_nonins,
- watch, watch_promo
- WHERE uid = {?}',
- $this->id());
+ $tables = array('account_lost_passwords', 'register_marketing',
+ 'register_pending', 'register_subs', 'watch_nonins',
+ 'watch', 'watch_promo');
+
+ foreach ($tables as $t) {
+ XDB::execute('DELETE FROM ' . $t . '
+ WHERE uid = {?}',
+ $this->id());
+ }
if ($clearAll) {
$groupIds = XDB::iterator('SELECT asso_id
}
}
- XDB::execute('DELETE FROM account_auth_openid, announce_read, contacts,
- email_options, email_send_save, emails,
- forum_innd, forum_profiles, forum_subs,
- gapps_accounts, gapps_nicknames, group_announces_read,
- group_members, group_member_sub_requests, reminder, requests,
- requests_hidden
- WHERE uid = {?}',
- $this->id());
+ $tables = array('account_auth_openid', 'gannounce_read', 'contacts',
+ 'email_options', 'gemail_send_save', 'emails',
+ 'forum_innd', 'gforum_profiles', 'forum_subs',
+ 'gapps_accounts', 'ggapps_nicknames', 'group_announces_read',
+ 'group_members', 'ggroup_member_sub_requests', 'reminder', 'requests',
+ 'requests_hidden');
+
+ foreach ($tables as $t) {
+ XDB::execute('DELETE FROM ' . $t . '
+ WHERE uid = {?}',
+ $this->id());
+ }
+
XDB::execute("UPDATE accounts
SET registration_date = 0, state = 'pending', password = NULL,
weak_password = NULL, token = NULL, is_admin = 0