summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--EVENTS.txt3
-rw-r--r--classes/User.php6
-rw-r--r--plugins/OpenID/OpenIDPlugin.php6
3 files changed, 13 insertions, 2 deletions
diff --git a/EVENTS.txt b/EVENTS.txt
index 92c411025..25a51516b 100644
--- a/EVENTS.txt
+++ b/EVENTS.txt
@@ -489,3 +489,6 @@ ChangePassword: Handle a password change request
- $newpassword: the desired new password
- &$errormsg: set this to an error message if the password could not be changed. If the password was changed, leave this as false
+UserDeleteRelated: Specify additional tables to delete entries from when deleting users
+- $user: User object
+- &$related: array of DB_DataObject class names to delete entries on matching user_id.
diff --git a/classes/User.php b/classes/User.php
index 96a64ccb2..b0d372be8 100644
--- a/classes/User.php
+++ b/classes/User.php
@@ -719,16 +719,18 @@ class User extends Memcached_DataObject
function delete()
{
$profile = $this->getProfile();
- $profile->delete();
+ if ($profile) {
+ $profile->delete();
+ }
$related = array('Fave',
- 'User_openid',
'Confirm_address',
'Remember_me',
'Foreign_link',
'Invitation',
'Notice_inbox',
);
+ Event::handle('UserDeleteRelated', array($this, &$related));
foreach ($related as $cls) {
$inst = new $cls();
diff --git a/plugins/OpenID/OpenIDPlugin.php b/plugins/OpenID/OpenIDPlugin.php
index 2309eea9d..e4aed2ddb 100644
--- a/plugins/OpenID/OpenIDPlugin.php
+++ b/plugins/OpenID/OpenIDPlugin.php
@@ -298,4 +298,10 @@ class OpenIDPlugin extends Plugin
new ColumnDef('modified', 'timestamp')));
return true;
}
+
+ function onUserDeleteRelated($user, &$tables)
+ {
+ $tables[] = 'User_openid';
+ return true;
+ }
}