Making WordPress.org

Changeset 2396


Ignore:
Timestamp:
01/28/2016 03:59:51 PM (8 years ago)
Author:
iandunn
Message:

WordCamp Budgets: Centralize get_requester_name().

Location:
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments
Files:
3 edited

Legend:

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

    r2395 r2396  
    223223
    224224/**
    225  * Get the name of the requester
    226  *
    227  * @param int $post_author_id
    228  *
    229  * @return string
    230  */
    231 function get_requester_name( $post_author_id ) {
    232     $requester_name = '';
    233 
    234     $author = get_user_by( 'id', $post_author_id );
    235 
    236     if ( is_a( $author, 'WP_User' ) ) {
    237         $requester_name = $author->get( 'display_name' );
    238     }
    239 
    240     return $requester_name;
    241 }
    242 
    243 /**
    244225 * Determine if the current user can submit changes to the given Reimbursement Request
    245226 *
     
    271252    $status_name        = get_status_name( $post->post_status );
    272253    $request_id         = get_current_blog_id() . '-' . $post->ID;
    273     $requested_by       = get_requester_name( $post->post_author );
     254    $requested_by       = \WordCamp_Budgets::get_requester_name( $post->post_author );
    274255    $delete_text        = EMPTY_TRASH_DAYS ? __( 'Move to Trash' ) : __( 'Delete Permanently' );
    275256    $update_text        = current_user_can( 'manage_network' ) ? __( 'Update Request', 'wordcamporg' ) : __( 'Send Request', 'wordcamporg' );
     
    338319
    339320    if ( empty ( $name_of_payer ) ) {
    340         $name_of_payer = get_requester_name( $post->post_author );
     321        $name_of_payer = \WordCamp_Budgets::get_requester_name( $post->post_author );
    341322    }
    342323
     
    602583
    603584    $subject          = 'New note on ' . sanitize_text_field( $request->post_title );
    604     $note_author_name = get_requester_name( $note['author_id'] );
     585    $note_author_name = \WordCamp_Budgets::get_requester_name( $note['author_id'] );
    605586    $request_url      = admin_url( sprintf( 'post.php?post=%s&action=edit', $request->ID ) );
    606587    $headers          = array( 'Reply-To: support@wordcamp.org' );
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php

    r2395 r2396  
    369369
    370370    /**
     371     * Get the name of the requester
     372     *
     373     * @param int $post_author_id
     374     *
     375     * @return string
     376     */
     377    public static function get_requester_name( $post_author_id ) {
     378        $requester_name = '';
     379
     380        $author = get_user_by( 'id', $post_author_id );
     381
     382        if ( is_a( $author, 'WP_User' ) ) {
     383            $requester_name = $author->get( 'display_name' );
     384        }
     385
     386        return $requester_name;
     387    }
     388
     389    /**
    371390     * Get the e-mail address of the requester in `Name <address>` format
    372391     *
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/reimbursement-request/metabox-notes.php

    r2392 r2396  
    1616            <span class="wcbrr-note-meta">
    1717                <?php echo esc_html( date( 'Y-m-d', $note['timestamp'] ) ); ?>
    18                 <?php echo esc_html( get_requester_name( $note['author_id'] ) ); ?>:
     18                <?php echo esc_html( \WordCamp_Budgets::get_requester_name( $note['author_id'] ) ); ?>:
    1919            </span>
    2020
Note: See TracChangeset for help on using the changeset viewer.