Question: convert the code to Java: public function admin_notices() { $user_id = get_current_user_id(); // if the user isn't an admin, definitely don't show the notice if
convert the code to Java:
| public function admin_notices() { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| $user_id = get_current_user_id(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| // if the user isn't an admin, definitely don't show the notice | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ( ! current_user_can( 'manage_options' ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| // update the setting for the current user | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ( isset( $_GET['new-user-approve-settings-notice'] ) && '1' == $_GET['new-user-approve-settings-notice'] ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| add_user_meta( $user_id, 'pw_new_user_approve_settings_notice', '1', true ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| $show_notice = get_user_meta( $user_id, 'pw_new_user_approve_settings_notice' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| // one last chance to show the update | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| $show_notice = apply_filters( 'new_user_approve_show_membership_notice', $show_notice, $user_id ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Check that the user hasn't already clicked to ignore the message | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ( ! $show_notice ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo ' '; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| printf( __( 'The Membership setting must be turned on in order for the New User Approve to work correctly. Update in settings. | Hide Notice', 'new-user-approve' ), admin_url( 'options-general.php' ), add_query_arg( array( 'new-user-approve-settings-notice' => 1 ) ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| }
|
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
