Skip to content

Instantly share code, notes, and snippets.

@usualoma
Created November 14, 2009 13:58
Show Gist options
  • Save usualoma/234554 to your computer and use it in GitHub Desktop.
Save usualoma/234554 to your computer and use it in GitHub Desktop.
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