Created
November 14, 2009 13:58
-
-
Save usualoma/234554 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package MT::Plugin::UserDashboard; | |
use strict; | |
use MT; | |
use MT::Plugin; | |
use base qw( MT::Plugin ); | |
MT->add_plugin(MT::Plugin::UserDashboard->new); | |
sub init_registry { | |
my $plugin = shift; | |
$plugin->registry({ | |
callbacks => { | |
'MT::App::CMS::template_source.dashboard' => sub { | |
my ($cb, $app) = @_; | |
return if $app->view ne 'user'; | |
my $menus = $app->registry('menus'); | |
foreach my $menu (values(%$menus)) { | |
if ($menu->{view}) { | |
if (ref($menu->{view}) | |
? grep($_ eq 'system', @{ $menu->{view} }) | |
: $menu->{view} eq 'system' | |
) { | |
$menu->{view} = 'user'; | |
} | |
} | |
} | |
} | |
}, | |
}); | |
} | |
1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment