Automatically switch to a project.

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
claymation
Posts: 4
Joined: 17 Sep 2009, 06:32

Automatically switch to a project.

Post by claymation »

I'm looking to make a small customization that will automatically switch to a project right after you create it. Does any one have any pointers on the code I should add to manage_proj_create.php that would make this happen? Thanks.
-Clay
tom_glebas
Posts: 14
Joined: 07 Sep 2009, 23:19

Re: Automatically switch to a project.

Post by tom_glebas »

This can be accomplished in typical Mantis style by adding a redirect link after the "Operation Successful" notice is printed and allowing the user to select the project before the redirect takes them back to the Manage Projects page (like it does when you create an issue). Or, it can be made to happen automatically by replacing the redirect to the Manage Projects page with a redirect to the Project Edit page.

In manage_proj_create.php, $t_project_id contains the ID of the newly created project.

Original code (at the bottom of manage_proj_create.php in Mantis 1.1.4):

Code: Select all

<?php
	echo lang_get( 'operation_successful' ) . '<br />';

	print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) );
?>
</div>

<?php html_page_bottom1( __FILE__ ) ?>
So, the following two lines of code can be added to display a link to the new project after the "Operation Successful" notice.:

Code: Select all

<?php
	echo lang_get( 'operation_successful' ) . '<br />';

//Establish URL of the newly created project
$my_open_proj_url = 'manage_proj_edit_page.php?project_id=' . $t_project_id;

//Print a link to the newly created project
echo '<a href="' . $my_open_proj_url . '">' . lang_get('my_go_to_project'). '</a> ';

	print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) );
?>
</div>

<?php html_page_bottom1( __FILE__ ) ?>
You need to create the language entry for my_go_to_project
Post Reply