Looking for function to get user issues

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
Nocny
Posts: 2
Joined: 07 Mar 2022, 09:49

Looking for function to get user issues

Post by Nocny »

Hi, I'm a developer and currently I'm working on cmd to delete user account and issues.

Currently, to delete user account im using

Code: Select all

user_delete($userId)
function and it working fine!

But I have problem with delete user issues, I have found

Code: Select all

bug_delete($bugId)
function but I can't find function to get array of bugId's owned by user to use mentioned bug_delete($bugId) function.

My questions:
1. is there a function to delete all data related to user (account, issues, etc.) at once?
2. is there a function to get an array of issue ids bound to user id?

Code: Select all

/**
 * Mantis Version
 */
define( 'MANTIS_VERSION', '2.17.1' );
define( 'FILTER_VERSION', 'v9' );
cas
Posts: 1586
Joined: 11 Mar 2006, 16:08
Contact:

Re: Looking for function to get user issues

Post by cas »

Normally you would not want to delete also all issues.
But in case you still want to do that, such function is easy to create for a developer.
Simply select all issues from the mantis_bug_table from the corresponding user (where the user is defined as Reporter and/or handler) and the use the function bug_delete for those issues.
Nocny
Posts: 2
Joined: 07 Mar 2022, 09:49

Re: Looking for function to get user issues

Post by Nocny »

Yea, I know I can do select from DB, but before using this option, I'm looking for a function created by developers to do it. If function doesn't exists, I will use db query.
cas
Posts: 1586
Joined: 11 Mar 2006, 16:08
Contact:

Re: Looking for function to get user issues

Post by cas »

There is a manual way of doing that provided you have enough authorizations. In the View Issues pages, set the filter to the user to be deleted. You will then see all issues from that user. Select them all and press Delete. Next remove the user.
But of course you can create a function for it ( I do not think that it is available out of the box).
Post Reply