View Issue Details

IDProjectCategoryView StatusLast Update
0023331mantisbtcode cleanuppublic2017-10-08 23:53
Reporterdregad Assigned Todregad  
Status closedResolutionfixed 
Target Version2.7.0Fixed in Version2.7.0 
Summary0023331: New user_get_username() API function

There are many occurrences of user_get_field( <id>, 'username' ) to retrieve a user's username in MantisBT codebase.

Since this is a common usage scenario, it makes sense to have a dedicated API function for this, similar to user_get_realname(); it would also avoid confusion with user_get_name(), which serves a different purpose (display).

Additional Information

This is a follow-up on @johgoe's suggestion in 0023225:

I guess a new method [...] user_get_username( $t_user_id) is requiered to fix this.

and the subsequent approval by @vboctor in PR

TagsNo tags attached.


related to 0023225 closeddregad Token API does not work with config show show_realname 


There are no notes attached to this issue.

Related Changesets

MantisBT: master b6d5eb51

2017-09-08 06:44:23


Details Diff
New API function user_get_username()

Replaces multiple calls to `user_get_field(<id>, 'username')` and avoids
confusion with user_get_name().

As discussed in issue 0023225 and PR

Fixes 0023331
Affected Issues
0023225, 0023331
mod - account_update.php Diff File
mod - api/rest/restcore/AuthMiddleware.php Diff File
mod - api/soap/mc_account_api.php Diff File
mod - bug_reminder_page.php Diff File
mod - core/authentication_api.php Diff File
mod - core/email_api.php Diff File
mod - core/filter_form_api.php Diff File
mod - core/ldap_api.php Diff File
mod - core/rss_api.php Diff File
mod - core/user_api.php Diff File
mod - verify.php Diff File

MantisBT: master 69f166a9

2017-09-08 06:47:23


Details Diff
Improve PHPDoc for user_get_name()

Better description of the function, and clearly state that it should
not be used to retrieve the user's username.

Issue 0023331
Affected Issues
mod - core/user_api.php Diff File