Remove Relationships field from view/update bug pages

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
qatester
Posts: 21
Joined: 05 Mar 2010, 06:39

Remove Relationships field from view/update bug pages

Post by qatester »

I want to remove the Relationships field from the View and Update bug pages. I tried to find the enumeration that responsible for turning on/off the Relationships field in config_defaults_inc.php but I couldn't find it. Does anyone know how to hide the Relationships field?
vida
Posts: 6
Joined: 10 May 2010, 13:56
Location: Prague

Re: Remove Relationships field from view/update bug pages

Post by vida »

I would like to ask the same question. How to hide relationships section from view/update bug page?
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Remove Relationships field from view/update bug pages

Post by atrol »

There is no way to disable this by normal customization, so you would have to change the code.
If you use MantisBt version 1.2.1 this can be done by changing the file bug_view_inc.php
Just comment out line 696 by adding at # at the beginning of the line
# relationship_view_box ( $tpl_bug->id );
Please use Search before posting and read the Manual
vida
Posts: 6
Joined: 10 May 2010, 13:56
Location: Prague

Re: Remove Relationships field from view/update bug pages

Post by vida »

Thank you!

Our Mantis will be clear and simple soon, just the last question about hiding something (I promise!): we have only one project (it won't change) and I would like to hide obselete buttons "clone", "move" and also "stick". Is there any trick?
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Remove Relationships field from view/update bug pages

Post by atrol »

I agree that "move" is obsolet if you have just one project.
"clone" is a nice convenience feature if you have an issue which is nearly the same as an existing one,I would not remove it.
"stick" is also not dependant on having one or more project

Nethertheless if you want it, comment out the following lines in file core/html_api.php

Code: Select all

	# STICK/UNSTICK button
	if ( access_has_bug_level( $t_sticky, $p_bug_id ) ) {
		echo '<td class="center">';
		if ( !bug_get_field( $p_bug_id, 'sticky' ) ) {
			html_button_bug_stick( $p_bug_id );
		} else {
			html_button_bug_unstick( $p_bug_id );
		}
		echo '</td>';
	}

	if( !$t_readonly ) {
		# CREATE CHILD button
		echo '<td class="center">';
		html_button_bug_create_child( $p_bug_id );
		echo '</td>';
	}

	
			# MOVE button
		echo '<td class="center">';
		html_button_bug_move( $p_bug_id );
		echo '</td>';
Ok, now you have a MantisBT with modifications of sourcecode.
Be aware, that all your changes will be lost, if you will update to a newer version.
You have to change the code again manually, especially if the files you changed are also changed in standard MantisBT.
Please use Search before posting and read the Manual
Phileas
Posts: 29
Joined: 22 Feb 2010, 16:51
Location: Switzerland

Re: Remove Relationships field from view/update bug pages

Post by Phileas »

Following Flag will hide the Sticky Button.
$g_set_bug_sticky_threshold = NOBODY;

But how can I hide the Clone Button?
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Remove Relationships field from view/update bug pages

Post by atrol »

Phileas, thank you for providing this information, I overlooked this

@vida
to get what you want, ignore my previous post, you have to add the following lines to your config_inc.php

Code: Select all

$g_move_bug_threshold = NOBODY;
$g_set_bug_sticky_threshold = NOBODY;
To remove the clone button, there you have to change sourcecode of core/html_api.php
from

Code: Select all

   if( !$t_readonly ) {
      # CREATE CHILD button
      echo '<td class="center">';
      html_button_bug_create_child( $p_bug_id );
      echo '</td>';
   }
to

Code: Select all

#   if( !$t_readonly ) {
#      # CREATE CHILD button
#      echo '<td class="center">';
#      html_button_bug_create_child( $p_bug_id );
#      echo '</td>';
#   }
Please use Search before posting and read the Manual
Soumaya
Posts: 5
Joined: 27 Apr 2022, 12:30

Re: Remove Relationships field from view/update bug pages

Post by Soumaya »

Just thought i would post an update to removing the clone button,
It's no longer located in core/html_api.php, instead it's in the bug_view_inc.php file.

So now you have to make these changes in the bug_view_inc.php file:
from

Code: Select all

# CLONE button
if( $p_flags['can_clone'] ) {
	echo '<div class="pull-left padding-right-2">';
	html_button( string_get_bug_report_url(), lang_get( 'create_child_bug_button' ), array( 'm_id' => $p_bug_id ) );
	echo '</div>';
}
to

Code: Select all

# CLONE button
#if( $p_flags['can_clone'] ) {
#	echo '<div class="pull-left padding-right-2">';
#	html_button( string_get_bug_report_url(), lang_get( 'create_child_bug_button' ), array( 'm_id' => $p_bug_id ) );
#	echo '</div>';
#}
Post Reply