summaryrefslogtreecommitdiff
path: root/lib/accountsettingsaction.php
diff options
context:
space:
mode:
authorCraig Andrews <candrews@integralblue.com>2009-11-10 17:54:24 -0500
committerCraig Andrews <candrews@integralblue.com>2009-11-10 17:54:55 -0500
commit91332cdadc20e721c22fcf22ca1773cedbde95c5 (patch)
tree78842a1498dec8248d461d7d5d8fb45b3352e4b3 /lib/accountsettingsaction.php
parent53c86c43c4b8cba313335f5d70f7f77d4ab640d2 (diff)
Added a events for the settings menu items
Diffstat (limited to 'lib/accountsettingsaction.php')
-rw-r--r--lib/accountsettingsaction.php57
1 files changed, 30 insertions, 27 deletions
diff --git a/lib/accountsettingsaction.php b/lib/accountsettingsaction.php
index 9865e1748..c79a1f5d7 100644
--- a/lib/accountsettingsaction.php
+++ b/lib/accountsettingsaction.php
@@ -104,35 +104,29 @@ class AccountSettingsNav extends Widget
if (Event::handle('StartAccountSettingsNav', array(&$this->action))) {
$user = common_current_user();
- $menu = array();
- $menu['profilesettings'] =
- array(_('Profile'),
- _('Change your profile settings'));
- if(Event::handle('CanUserChangeField', array($user->nickname, 'avatar'))){
- $menu['avatarsettings'] =
- array(_('Avatar'),
- _('Upload an avatar'));
+ if(Event::handle('StartAccountSettingsProfileMenuItem', array($this, &$menu))){
+ $this->showMenuItem('profilesettings',_('Profile'),_('Change your profile settings'));
+ Event::handle('EndAccountSettingsProfileMenuItem', array($this, &$menu));
}
- if(Event::handle('CanUserChangeField', array($user->nickname, 'password'))){
- $menu['passwordsettings'] =
- array(_('Password'),
- _('Change your password'));
+ if(Event::handle('StartAccountSettingsAvatarMenuItem', array($this, &$menu))){
+ $this->showMenuItem('avatarsettings',_('Avatar'),_('Upload an avatar'));
+ Event::handle('EndAccountSettingsAvatarMenuItem', array($this, &$menu));
}
- $menu['emailsettings'] =
- array(_('Email'),
- _('Change email handling'));
- $menu['userdesignsettings'] =
- array(_('Design'),
- _('Design your profile'));
- $menu['othersettings'] =
- array(_('Other'),
- _('Other options'));
-
- foreach ($menu as $menuaction => $menudesc) {
- $this->action->menuItem(common_local_url($menuaction),
- $menudesc[0],
- $menudesc[1],
- $action_name === $menuaction);
+ if(Event::handle('StartAccountSettingsPasswordMenuItem', array($this, &$menu))){
+ $this->showMenuItem('passwordsettings',_('Password'),_('Change your password'));
+ Event::handle('EndAccountSettingsPasswordMenuItem', array($this, &$menu));
+ }
+ if(Event::handle('StartAccountSettingsEmailMenuItem', array($this, &$menu))){
+ $this->showMenuItem('emailsettings',_('Email'),_('Change email handling'));
+ Event::handle('EndAccountSettingsEmailMenuItem', array($this, &$menu));
+ }
+ if(Event::handle('StartAccountSettingsDesignMenuItem', array($this, &$menu))){
+ $this->showMenuItem('userdesignsettings',_('Design'),_('Design your profile'));
+ Event::handle('EndAccountSettingsDesignMenuItem', array($this, &$menu));
+ }
+ if(Event::handle('StartAccountSettingsOtherMenuItem', array($this, &$menu))){
+ $this->showMenuItem('othersettings',_('Other'),_('Other options'));
+ Event::handle('EndAccountSettingsOtherMenuItem', array($this, &$menu));
}
Event::handle('EndAccountSettingsNav', array(&$this->action));
@@ -140,4 +134,13 @@ class AccountSettingsNav extends Widget
$this->action->elementEnd('ul');
}
+
+ function showMenuItem($menuaction, $desc1, $desc2)
+ {
+ $action_name = $this->action->trimmed('action');
+ $this->action->menuItem(common_local_url($menuaction),
+ $desc1,
+ $desc2,
+ $action_name === $menuaction);
+ }
}