#43848 closed enhancement (fixed)
Function "user_can_access_admin_page" refactor.
Reported by: | rnaby | Owned by: | valentinbora |
---|---|---|---|
Milestone: | 5.6 | Priority: | lowest |
Severity: | normal | Version: | |
Component: | Administration | Keywords: | has-patch needs-refresh |
Focuses: | coding-standards | Cc: |
Description
I think this user_can_access_admin_page
function should looks more clean and better this way. Also added a description of the function.
Attachments (2)
Change History (9)
#2
@
5 years ago
- Keywords needs-refresh added; needs-testing removed
- Milestone changed from Awaiting Review to Future Release
- Owner set to valentinbora
- Priority changed from normal to lowest
- Status changed from new to accepted
Thanks for the patch @rnaby and sorry for the delay here. Unfortunately, the patch needs a refresh as it no longer applies cleanly onto trunk.
For reference, coding standards relevant docs:
#3
@
4 years ago
- Keywords close added
- Resolution set to wontfix
- Status changed from accepted to closed
I reviewed the proposed patch and compared it against the current implementation.
The proposed patch is mostly whitespace changes and merging of if statements.
For example (pseudo-code):
if( A ){ something } if( B ){ something }
to
if( A || B ){ something }
The current implementation is relatively concise and correct with WordPress coding standards. There's no need for this ticket to remain open.
#5
@
4 years ago
- Focuses coding-standards added
- Keywords close removed
- Milestone set to 5.6
- Resolution wontfix deleted
- Status changed from closed to reopened
While I mostly agree with comment:3, I think there is some benefit in replacing these parts:
if ( current_user_can( $submenu_array[1] ) ) { return true; } else { return false; }
with:
return current_user_can( $submenu_array[1] );
The patch for the enhancement.