/** * {@inheritdoc} */ protected function render_content() { $current_user = get_userdata(get_current_user_id()); $profileuser = get_userdata($this->get_item_id()); parent::render_content(); $new_email = get_option($current_user->ID . '_new_email'); if ($new_email && $new_email['newemail'] != $current_user->user_email && $profileuser->ID == $current_user->ID) { echo '<div class="updated inline"><p>'; printf(__('There is a pending change of your e-mail to %1$s. <a href="%2$s">Cancel</a>'), '<code>' . $new_email['newemail'] . '</code>', esc_url(self_admin_url('profile.php?dismiss=' . $current_user->ID . '_new_email'))); echo '</p></div>'; } }
/** * {@inheritdoc} */ public function render_content() { // @todo Setup $current_user correctly $current_user = new stdClass(); // @todo Setup $profileuser correctly $profileuser = new stdClass(); parent::render_content(); $new_email = get_option($current_user->ID . '_new_email'); if ($new_email && $new_email['newemail'] != $current_user->user_email && $profileuser->ID == $current_user->ID) { echo '<div class="updated inline"><p>'; printf(__('There is a pending change of your e-mail to %1$s. <a href="%2$s">Cancel</a>'), '<code>' . $new_email['newemail'] . '</code>', esc_url(self_admin_url('profile.php?dismiss=' . $current_user->ID . '_new_email'))); echo '</p></div>'; } }
/** * Render control wrapper, label, description, and control input * * @param WP_Fields_API_Control $control Control object * @param null|int $item_id Item ID * @param null|string $object_name Object name */ public function render_control($control, $item_id = null, $object_name = null) { // Pass $object_name and $item_id to Control $control->object_name = $object_name; $control->item_id = $item_id; $label = trim($control->label); $description = trim($control->description); // Avoid outputting them in render_content() $control->label = ''; $control->description = ''; $input_id = 'field-' . $control->id; if (isset($control->input_attrs['id'])) { $input_id = $control->input_attrs['id']; } ?> <div <?php $control->wrap_attrs(); ?> > <?php if (0 < strlen($label)) { ?> <label for="<?php echo esc_attr($input_id); ?> "><?php echo esc_html($label); ?> </label> <?php } ?> <?php $control->render_content(); ?> <?php if (0 < strlen($description)) { ?> <p class="description"><?php echo wp_kses_post($description); ?> </p> <?php } ?> </div> <?php }