Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started