Page 1 of 1

Submit button customization

Posted: 01 Jul 2024, 08:20
by Joselyne
Hello,

I would 'like to customize the submit button per project. I mean the text for the button will be different if i choose a project.
How can I do this?

Thanks.

Re: Submit button customization

Posted: 01 Jul 2024, 19:22
by atrol
All strings can be customized, see https://mantisbt.org/docs/master/en-US/ ... ze.strings

The note below https://mantisbt.org/docs/master/en-US/ ... ngs.format
shows an example of how to change the Summary string based on a project.

Out of interest, as this feature request looks a bit strange to me: Isn't it confusing for users to see different buttons for the same action for differnt projects?

Re: Submit button customization

Posted: 03 Sep 2024, 09:37
by Joselyne
Hi,
It is not strange, users are informed.
In fact, i have added new status beginning by the status "draft" instead of "new". But for some projects, the first status is "new". That's why i have to differentiate the "$s_submit_report_button". For some project it has the value "create the draft" for others it has the value "submit ...".

So i tried this code :
$t_cookie_name = config_get_global( 'project_cookie' );
if ( $_COOKIE[$t_cookie_name] ){
$t_project_id = $_COOKIE[$t_cookie_name];
//if ($t_project_id === '11'){
if ($t_project_id === '7'){
$s_submit_report_button = 'Submit new ticket';
}else{
$s_submit_report_button = 'Create the draft';
}
}
It works af en toe. When there is no cookie, it takes the value from mantisbt/lang/english.txt, that is "Submit Issue". Notice that we are not using Issue but Ticket.

When i use the fucntion : helper_get_current_project(), the mantis server is no longer accessible. the error is :

"This page is not available at the moment. The server cannot currently process this request."

Any idea?

Re: Submit button customization

Posted: 18 Mar 2025, 14:43
by Joselyne
Please, any help for these problem?

I've tried using the following in custom_strings_inc.php

if( db_is_connected() ) {
if( helper_get_current_project() == 7 ) {
$s_summary = 'Title';
}

but the fact of calling "helper_get_current_project()" crashes Mantis.

Is there something I must do before calling this function?

In which sequence does Mantis load the different files or/en pages?

Thanks

Re: Submit button customization

Posted: 18 Mar 2025, 17:49
by atrol
Try

Code: Select all

if( auth_is_user_authenticated() ) {
	if( helper_get_current_project() == 7 ) {
		$s_summary = 'Title';
	}
}

Re: Submit button customization

Posted: 20 Mar 2025, 09:13
by Joselyne
Thank you very much, that works fine.

Re: Submit button customization

Posted: 21 Mar 2025, 13:33
by atrol
Documentation will be fixed in next verssion, see https://mantisbt.org/bugs/view.php?id=35646

Re: Submit button customization

Posted: 25 Mar 2025, 12:30
by Joselyne
All right.