From a092aac32d061c8f6265c9975040e9f8c0b96f55 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 6 Feb 2010 12:59:41 +0100 Subject: add events to fine-tune user deletion --- actions/deleteuser.php | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'actions') diff --git a/actions/deleteuser.php b/actions/deleteuser.php index 32b703aa7..c4f84fad2 100644 --- a/actions/deleteuser.php +++ b/actions/deleteuser.php @@ -131,18 +131,21 @@ class DeleteuserAction extends ProfileFormAction $this->elementStart('fieldset'); $this->hidden('token', common_session_token()); $this->element('legend', _('Delete user')); - $this->element('p', null, - _('Are you sure you want to delete this user? '. - 'This will clear all data about the user from the '. - 'database, without a backup.')); - $this->element('input', array('id' => 'deleteuserto-' . $id, - 'name' => 'profileid', - 'type' => 'hidden', - 'value' => $id)); - foreach ($this->args as $k => $v) { - if (substr($k, 0, 9) == 'returnto-') { - $this->hidden($k, $v); + if (Event::handle('StartDeleteUserForm', array($this, $this->user))) { + $this->element('p', null, + _('Are you sure you want to delete this user? '. + 'This will clear all data about the user from the '. + 'database, without a backup.')); + $this->element('input', array('id' => 'deleteuserto-' . $id, + 'name' => 'profileid', + 'type' => 'hidden', + 'value' => $id)); + foreach ($this->args as $k => $v) { + if (substr($k, 0, 9) == 'returnto-') { + $this->hidden($k, $v); + } } + Event::handle('EndDeleteUserForm', array($this, $this->user)); } $this->submit('form_action-no', _('No'), 'submit form_action-primary', 'no', _("Do not block this user")); $this->submit('form_action-yes', _('Yes'), 'submit form_action-secondary', 'yes', _('Delete this user')); @@ -158,7 +161,9 @@ class DeleteuserAction extends ProfileFormAction function handlePost() { - $this->user->delete(); + if (Event::handle('StartDeleteUser', array($this, $this->user))) { + $this->user->delete(); + Event::handle('EndDeleteUser', array($this, $this->user)); + } } } - -- cgit v1.2.3-54-g00ecf From c95daacfdb6d89098716b8eeccfdd82124019d7a Mon Sep 17 00:00:00 2001 From: Christopher Vollick Date: Fri, 26 Feb 2010 10:10:38 -0500 Subject: Updated ShowGroup to Resolve Aliases Again. The way we find groups changed with this new Local_group table. I had to update this too. --- actions/showgroup.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'actions') diff --git a/actions/showgroup.php b/actions/showgroup.php index 0139ba157..4e1fcb6c7 100644 --- a/actions/showgroup.php +++ b/actions/showgroup.php @@ -125,14 +125,6 @@ class ShowgroupAction extends GroupDesignAction $local = Local_group::staticGet('nickname', $nickname); if (!$local) { - common_log(LOG_NOTICE, "Couldn't find local group for nickname '$nickname'"); - $this->clientError(_('No such group.'), 404); - return false; - } - - $this->group = User_group::staticGet('id', $local->group_id); - - if (!$this->group) { $alias = Group_alias::staticGet('alias', $nickname); if ($alias) { $args = array('id' => $alias->group_id); @@ -142,11 +134,19 @@ class ShowgroupAction extends GroupDesignAction common_redirect(common_local_url('groupbyid', $args), 301); return false; } else { + common_log(LOG_NOTICE, "Couldn't find local group for nickname '$nickname'"); $this->clientError(_('No such group.'), 404); return false; } } + $this->group = User_group::staticGet('id', $local->group_id); + + if (!$this->group) { + $this->clientError(_('No such group.'), 404); + return false; + } + common_set_returnto($this->selfUrl()); return true; -- cgit v1.2.3-54-g00ecf