From 48edbb30231e28b74409e02308f15e38940e5da1 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 29 Dec 2010 14:02:04 -0800 Subject: [PATCH] add hooks for the account-management tools --- EVENTS.txt | 5 +++++ actions/profilesettings.php | 45 ++++++++++++++++++++----------------- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/EVENTS.txt b/EVENTS.txt index 91008f54fa..f7cc7df67c 100644 --- a/EVENTS.txt +++ b/EVENTS.txt @@ -1040,3 +1040,8 @@ EndImportActivity: when we finish importing an activity - $activity: The current activity - $trusted: How "trusted" the process is +StartProfileSettingsActions: when we're showing account-management action list +- $action: Action being shown (use for output) + +EndProfileSettingsActions: when we're showing account-management action list +- $action: Action being shown (use for output) diff --git a/actions/profilesettings.php b/actions/profilesettings.php index 8f55a47189..19fbdbd293 100644 --- a/actions/profilesettings.php +++ b/actions/profilesettings.php @@ -458,27 +458,32 @@ class ProfilesettingsAction extends AccountSettingsAction $this->elementStart('div', array('id' => 'aside_primary', 'class' => 'aside')); - if ($user->hasRight(Right::BACKUPACCOUNT)) { - $this->elementStart('li'); - $this->element('a', - array('href' => common_local_url('backupaccount')), - _('Backup account')); - $this->elementEnd('li'); - } - if ($user->hasRight(Right::DELETEACCOUNT)) { - $this->elementStart('li'); - $this->element('a', - array('href' => common_local_url('deleteaccount')), - _('Delete account')); - $this->elementEnd('li'); - } - if ($user->hasRight(Right::RESTOREACCOUNT)) { - $this->elementStart('li'); - $this->element('a', - array('href' => common_local_url('restoreaccount')), - _('Restore account')); - $this->elementEnd('li'); + $this->elementStart('ul'); + if (Event::handle('StartProfileSettingsActions', array($this))) { + if ($user->hasRight(Right::BACKUPACCOUNT)) { + $this->elementStart('li'); + $this->element('a', + array('href' => common_local_url('backupaccount')), + _('Backup account')); + $this->elementEnd('li'); + } + if ($user->hasRight(Right::DELETEACCOUNT)) { + $this->elementStart('li'); + $this->element('a', + array('href' => common_local_url('deleteaccount')), + _('Delete account')); + $this->elementEnd('li'); + } + if ($user->hasRight(Right::RESTOREACCOUNT)) { + $this->elementStart('li'); + $this->element('a', + array('href' => common_local_url('restoreaccount')), + _('Restore account')); + $this->elementEnd('li'); + } + Event::handle('EndProfileSettingsActions', array($this)); } + $this->elementEnd('ul'); $this->elementEnd('div'); } }