Submit button customization

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
Joselyne
Posts: 63
Joined: 14 Dec 2023, 15:59

Submit button customization

Post 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.
atrol
Site Admin
Posts: 8531
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Submit button customization

Post 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?
Please use Search before posting and read the Manual
Joselyne
Posts: 63
Joined: 14 Dec 2023, 15:59

Re: Submit button customization

Post 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?
Joselyne
Posts: 63
Joined: 14 Dec 2023, 15:59

Re: Submit button customization

Post 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
atrol
Site Admin
Posts: 8531
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Submit button customization

Post by atrol »

Try

Code: Select all

if( auth_is_user_authenticated() ) {
	if( helper_get_current_project() == 7 ) {
		$s_summary = 'Title';
	}
}
Please use Search before posting and read the Manual
Joselyne
Posts: 63
Joined: 14 Dec 2023, 15:59

Re: Submit button customization

Post by Joselyne »

Thank you very much, that works fine.
atrol
Site Admin
Posts: 8531
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Submit button customization

Post by atrol »

Documentation will be fixed in next verssion, see https://mantisbt.org/bugs/view.php?id=35646
Please use Search before posting and read the Manual
Joselyne
Posts: 63
Joined: 14 Dec 2023, 15:59

Re: Submit button customization

Post by Joselyne »

All right.
Post Reply