Get the bug id after submting bug

Get help from other users here.

Moderators: Contributor, Developer

Post Reply
Amin
Posts: 20
Joined: Oct 08, 2018 10:42 am

Get the bug id after submting bug

Post by Amin » Nov 08, 2018 9:55 am

Hello,

I would like to get the bug_id after submiting an bug in order to use it after to do something

I have do that but I'm not sur that it's working correctly :

$p_issue_id =helper_get_current_project();
$t_bug = bug_get( $p_issue_id );


If someone have another idea I will appreciate his help.

Thank you

atrol
Site Admin
Posts: 7352
Joined: Mar 26, 2008 4:37 pm
Location: Germany

Re: Get the bug id after submting bug

Post by atrol » Nov 08, 2018 10:05 am

You have to write a plugin that uses event EVENT_REPORT_BUG https://www.mantisbt.org/docs/master/en ... bug.action
Please use Search before posting and read the Manual

Amin
Posts: 20
Joined: Oct 08, 2018 10:42 am

Re: Get the bug id after submting bug

Post by Amin » Nov 08, 2018 10:28 am

Hello Atrol,

Thank you for response

But The EVENT_REPORT_BUG take in parameters Bug data structure and Bug id and he retrun nothing. And I want to get the bug ID.

I need to get the bug ID in order to use it in custom_function_api.php (in a override fonction).

atrol
Site Admin
Posts: 7352
Joined: Mar 26, 2008 4:37 pm
Location: Germany

Re: Get the bug id after submting bug

Post by atrol » Nov 08, 2018 11:03 am

Amin wrote:
Nov 08, 2018 10:28 am
The EVENT_REPORT_BUG take in parameters Bug data structure and Bug id and he retrun nothing.
EVENT_REPORT_BUG is not a function, it's an event where you can subscribe to with your own function.
Your own function is called with the bug id as 2nd parameter

From provided documentation link
At this point, the issue ID is actually known, and is passed as a second parameter.
I am talking about plugins, not custom functions.

If you want to use a custom function, you have to write custom_function_override_issue_create_notify which is called with issue id as parameter
https://www.mantisbt.org/docs/master/en ... cs.defined

Keep in mind that custom functions are easier to implement than plugins, but they are limited in terms of functionality and might be removed in Mantis in a later version (not anncounced yet).
Please use Search before posting and read the Manual

Post Reply