remove menu options

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
massimo
Posts: 6
Joined: 02 Sep 2009, 15:27

remove menu options

Post by massimo »

Hi,

Is it possible to remove some of the main menu options?
For example I don’t need the roadmap, the Docs, the Change Log.

If yes, how?

Thank you for the help
Massimo
Leonardo Colombi
Posts: 5
Joined: 17 Sep 2009, 07:04
Contact:

Re: remove menu options

Post by Leonardo Colombi »

Hello,
I think you shoudl change/comment/remove some lines inside function print_menu().
You can find it in the core/html_api.php
massimo
Posts: 6
Joined: 02 Sep 2009, 15:27

Re: remove menu options

Post by massimo »

Jeferson Oliveira in the mantis_help mailing list gave me he solution (and I thank him).

I cut and paste his answer.

Yes, it is possible. And you don't need to change the core to customize the most of the items mentioned above.

There are two places where you can mange the permissions or availability of some modules:

1) Log into Mantis and access Manage/Manage configurations
- in this section you can control Workflow Thresholds (and change, for example, "View Change Log" access), Workflow Transitions, E-mail Notifications;

2) Set in "config_inc.php" (that definitely is not a core file) new values to the configuration variables defined in "config_defaults_inc.php".
Please notice that is a good practice don't change "config_defaults_inc.php". When some variable need to be changed define it's new value in "config_inc.php".

You can, for example, add

$g_roadmap_view_threshold = NOBODY;

in "config_inc.php" and this way deny the access to the roadmap page for everyone.

In this way I was able to remove the roadmap and the Change log (that I don't use) But I have not been able to remove the "Docs" menu.

It is OK I am happy with this solution.

Thanks to Jeferson
iphar
Posts: 5
Joined: 23 Oct 2009, 12:13

Re: remove menu options

Post by iphar »

I disabled the menu items by these config lines:

$g_roadmap_view_threshold = NOBODY;
$g_view_changelog_threshold = NOBODY;
$g_enable_project_documentation = OFF;
$g_manage_news_threshold = NOBODY;

so now there's only the core functionality left!
massimo
Posts: 6
Joined: 02 Sep 2009, 15:27

Re: remove menu options

Post by massimo »

Thank you Iphar.

It works great.

Only a small extra question.

Where can I find the documentation of all these parameters (other than in the config_default_inc.php file)?
vboctor
Site Admin
Posts: 1293
Joined: 13 Feb 2005, 22:11
Location: Redmond, Washington
Contact:

Re: remove menu options

Post by vboctor »

Check the configuration section in the manual:
http://www.mantisbt.org/docs/master-1.2.x/en/

The above link points to the 1.2.x release branch manual.
Migrate your MantisBT to the MantisHub Cloud
Afrank
Posts: 4
Joined: 27 Jan 2010, 19:01

Re: remove menu options

Post by Afrank »

I understood the question as removing primary menu links i.e.

Main | My View | View Issues | Report Issue | My Account | Logout

if you're interested in removing these, simply to to the html_api.php file and comment out the menu you want to not show. For example, I wanted to eliminate Roadmap, Documentation, and News.

Once you open html_api.php file, put a # in-front of the lines of the menus you want to hide.


Exapmle:

# Project Documentation Page
#if( ON == config_get( 'enable_project_documentation' ) ) {
# $t_menu_options[] = '<a href="proj_doc_page.php">' . lang_get( 'docs_link' ) . #'</a>';
# }


Notice you also need the # where the } is...

good luck!
atrol
Site Admin
Posts: 8398
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: remove menu options

Post by atrol »

You should better use MantisBT configuration in config_inc.php to achieve this.
The advantage is, that you don't have to change the MantisBT source code and you will have fever problems when updating to a newer version.
Please use Search before posting and read the Manual
farah
Posts: 1
Joined: 25 Feb 2013, 02:50

Re: hide my account menu options

Post by farah »

Hi,
I want to hide my account menu from user. So they can't change their own password.
Only administrator can reset the password.
Can you describe me in details how to do it correctly.
Thanks..
cas
Posts: 1635
Joined: 11 Mar 2006, 16:08
Contact:

Re: remove menu options

Post by cas »

That you can only achieve if you "protect" the account. This you can do under Manage/manage users.
josepernia8
Posts: 5
Joined: 07 Mar 2016, 19:56

Re: remove menu options

Post by josepernia8 »

I don't know if this will help anyone at this point, but i did modify the html_api.php to hide My Account from users.
You need to find this line and comment it:
if( OFF == $t_protected ) {
$t_menu_options[] = '<a href="' . helper_mantis_url( 'account_page.php">' ) . lang_get( 'account_link' ) . '</a>';
}
Or you could change the helper_mantis_url to helper_mantis_url( 'account_prefs_page.php">' ) so the User go to preference when he hits My Account

Then you need to find the line where this function starts: function print_account_menu( $p_page = '' )

Then you need to comment this lines:

print_bracket_link( $t_account_page, lang_get( 'account_link' ) );
print_bracket_link( $t_account_prefs_page, lang_get( 'change_preferences_link' ) );
print_bracket_link( $t_account_manage_columns_page, lang_get( 'manage_columns_config' ) );

So he doesn't see the sub menu to change to manage columns or to change his password, but this would hide it for all users so if you want it to only show to administrator add this IF:

if (current_user_is_administrator()){
print_bracket_link( $t_account_page, lang_get( 'account_link' ) );
print_bracket_link( $t_account_prefs_page, lang_get( 'change_preferences_link' ) );
print_bracket_link( $t_account_manage_columns_page, lang_get( 'manage_columns_config' ) );
}

Or if you want it to show to some acces levels only:

if (current_user_get_access_level() == ADMINISTRATOR || current_user_get_access_level() == MANAGER || current_user_get_access_level() == DEVELOPER){
print_bracket_link( $t_account_page, lang_get( 'account_link' ) );
print_bracket_link( $t_account_prefs_page, lang_get( 'change_preferences_link' ) );
print_bracket_link( $t_account_manage_columns_page, lang_get( 'manage_columns_config' ) );
}

Hope it helps anyone, is only a bit modification to the code and you can have the modifications you did (like me) in a txt/word and always save the Original file from Mantis.

Cheers.
Post Reply