* @license GPL-2.0+ * @link https://robincornett.com * @copyright 2014-2019 Robin Cornett Creative, LLC */ class Display_Featured_Image_Genesis_Author extends Display_Featured_Image_Genesis_Helper { /** * The key for the plugin user meta. * @var string $name */ protected $name = 'displayfeaturedimagegenesis'; /** * Set new profile field for authors * * @since 2.3.0 */ public function set_author_meta() { // current user add_action( 'profile_personal_options', array( $this, 'do_author_fields' ) ); add_action( 'personal_options_update', array( $this, 'save_profile_fields' ) ); // not current user add_action( 'edit_user_profile', array( $this, 'do_author_fields' ) ); add_action( 'edit_user_profile_update', array( $this, 'save_profile_fields' ) ); } /** * Add the featured image row to the user profile. * @param $user object the user being edited. */ public function do_author_fields( $user ) { $id = get_the_author_meta( $this->name, $user->ID ); echo '
| ', esc_attr( $this->name ), esc_html__( 'Featured Image', 'display-featured-image-genesis' ) ); echo ' | ';
$images = $this->get_images_class();
if ( $id ) {
echo wp_kses_post( $images->render_image_preview( $id, $user->display_name ) );
}
$images->render_buttons( $id, $this->name );
printf( ' %s ', esc_html__( 'Upload an image to use as your author page featured image.', 'display-featured-image-genesis' ) ); echo ' | ';
echo '
|---|