Get the bug id after submting bug

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
Amin
Posts: 26
Joined: 08 Oct 2018, 15:42

Get the bug id after submting bug

Post by Amin »

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: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Get the bug id after submting bug

Post by atrol »

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: 26
Joined: 08 Oct 2018, 15:42

Re: Get the bug id after submting bug

Post by Amin »

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: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Get the bug id after submting bug

Post by atrol »

Amin wrote: 08 Nov 2018, 15:28The 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