$this->get_default_avatar_url_by_email( $current_user->user_email ) ]; wp_localize_script( 'sua', 'sua_obj', $l10n ); } /** * Default WordPress avatar URL by user email * * @since 2.8 */ private function get_default_avatar_url_by_email( $user_email = '' ) { // Check the email provided if ( empty($user_email) || ! filter_var($user_email, FILTER_VALIDATE_EMAIL) ) return null; // Sanitize Email and get md5 $user_email = sanitize_email( $user_email ); $md5_user_email = md5( $user_email ); // SSL Gravatar URL $url = "https://secure.gravatar.com/avatar/{$md5_user_email}.jpg"; // Size 192 (96 * 2) for Retina Display $url = add_query_arg( 's', 192, $url ); return esc_url( $url ); } /** * Add table in user profile * * @since 1.0 */ public function render_custom_user_profile_fields( $user ) { // Get user meta $attachment_id = get_user_meta( $user->ID, SUA_USER_META_KEY, true ); ?>
ID, 96 ); ?>
0 ) add_user_meta( $user_id, SUA_USER_META_KEY, $_POST[SUA_USER_META_KEY] ); return true; } /** * Admin notice to donate for this plugin * * @since 2.6 */ public function custom_admin_notice() { // Get the transient $notice_is_expired = get_transient( SUA_TRANSIENT_NAME ); if ( ! empty($notice_is_expired) && is_numeric($notice_is_expired) && $notice_is_expired == 1 ) : // Notice dismissed, nothing to see! else: // Get Current user global $current_user; // Show the notice ?>

%s,
thank you for using my plugin Simple User Avatar! To support the development, also in the future, I invite you to support me. Even a small amount, such as 1$ for one coffee, will be greatly appreciated. Thank you very much, Matteo.', 'simple-user-avatar' ), sanitize_text_field( $current_user->display_name ), esc_url( 'https://wordpress.org/plugins/simple-user-avatar/' ) ); ?>