Making WordPress.org


Ignore:
Timestamp:
01/14/2016 03:21:54 PM (10 years ago)
Author:
iandunn
Message:

WordCamp Budgets: Centralize get_requester_formatted_email() for all modules.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php

    r2292 r2296  
    212212
    213213    /**
     214     * Get the e-mail address of the requester in `Name <address>` format
     215     *
     216     * @param int $post_author_id
     217     *
     218     * @return false|string
     219     */
     220    public static function get_requester_formatted_email( $post_author_id ) {
     221        $address   = false;
     222        $requester = get_user_by( 'id', $post_author_id );
     223
     224        if ( is_a( $requester, 'WP_User' ) ) {
     225            $address = sprintf( '%s <%s>', $requester->get( 'display_name' ), $requester->get( 'user_email' ) );
     226        }
     227
     228        return $address;
     229    }
     230
     231    /**
    214232     * Insert an entry into a log for one of the custom post types
    215233     *
Note: See TracChangeset for help on using the changeset viewer.