Changeset 4206
- Timestamp:
- 10/10/2016 07:46:37 PM (7 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-forums
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-forums/bbpress/user-profile.php
r4145 r4206 21 21 22 22 <?php if ( current_user_can( 'moderate' ) ) : ?> 23 <p class="bbp-user-email"><?php printf( esc_html__( 'Email: %s', 'wporg-forums' ), bbp_get_displayed_user_field( 'user_email' ) ); ?></p> 23 24 <p class="bbp-user-email"><?php 25 /* translators: %s: user's email address */ 26 printf( esc_html__( 'Email: %s', 'wporg-forums' ), bbp_get_displayed_user_field( 'user_email' ) ); 27 ?></p> 28 24 29 <?php endif; ?> 30 31 <p class="bbp-user-wporg-profile"><?php 32 $user_nicename = bbp_get_displayed_user_field( 'user_nicename' ); 33 $slack_username = wporg_support_get_slack_username(); 34 35 if ( $slack_username && $slack_username != $user_nicename ) { 36 /* translators: 1: user's WordPress.org profile link, 2: user's Slack username, 3: make.wordpress.org/chat URL */ 37 printf( __( '%1$s on WordPress.org, %2$s on <a href="%3$s">Slack</a>', 'wporg-forums' ), 38 wporg_support_get_wporg_profile_link(), 39 '@' . $slack_username, 40 'https://make.wordpress.org/chat/' 41 ); 42 } elseif( $slack_username ) { 43 /* translators: 1: WordPress.org and Slack username, 2: URL for information about Slack */ 44 printf( __( '%1$s on WordPress.org and <a href="%2$s">Slack</a>', 'wporg-forums' ), 45 wporg_support_get_wporg_profile_link(), 46 'https://make.wordpress.org/chat/' 47 ); 48 } else { 49 /* translators: %s: user's WordPress.org profile link */ 50 printf( esc_html__( '%s on WordPress.org', 'wporg-forums' ), 51 wporg_support_get_wporg_profile_link() 52 ); 53 } 54 ?></p> 25 55 26 56 <?php if ( $custom_title = get_user_option( 'title', bbp_get_displayed_user_id() ) ) : ?> 27 57 28 <p class="bbp-user-custom-title"><?php printf( esc_html__( 'Title: %s', 'wporg-forums' ), esc_html( $custom_title ) ); ?></p> 58 <p class="bbp-user-custom-title"><?php 59 /* translators: %s: user's custom title */ 60 printf( esc_html__( 'Title: %s', 'wporg-forums' ), esc_html( $custom_title ) ); 61 ?></p> 29 62 30 63 <?php endif; ?> 31 64 32 <p class="bbp-user-forum-role"><?php printf( esc_html__( 'Forum Role: %s', 'wporg-forums' ), bbp_get_user_display_role() ); ?></p> 33 <p class="bbp-user-member-since"><?php printf( esc_html__( 'Member Since: %s', 'wporg-forums' ), wporg_support_get_user_registered_date() ); ?></p> 34 <p class="bbp-user-topic-count"><?php printf( esc_html__( 'Topics Started: %s', 'wporg-forums' ), bbp_get_user_topic_count_raw() ); ?></p> 35 <p class="bbp-user-reply-count"><?php printf( esc_html__( 'Replies Created: %s', 'wporg-forums' ), bbp_get_user_reply_count_raw() ); ?></p> 65 <p class="bbp-user-forum-role"><?php 66 /* translators: %s: user's forum role */ 67 printf( esc_html__( 'Forum Role: %s', 'wporg-forums' ), bbp_get_user_display_role() ); 68 ?></p> 69 <p class="bbp-user-member-since"><?php 70 /* translators: %s: user's registration date */ 71 printf( esc_html__( 'Member Since: %s', 'wporg-forums' ), wporg_support_get_user_registered_date() ); 72 ?></p> 73 <p class="bbp-user-topic-count"><?php 74 /* translators: %s: number of user's topics */ 75 printf( esc_html__( 'Topics Started: %s', 'wporg-forums' ), bbp_get_user_topic_count_raw() ); 76 ?></p> 77 <p class="bbp-user-reply-count"><?php 78 /* translators: %s: number of user's replies */ 79 printf( esc_html__( 'Replies Created: %s', 'wporg-forums' ), bbp_get_user_reply_count_raw() ); 80 ?></p> 36 81 </div> 37 82 </div><!-- #bbp-author-topics-started --> -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-forums/functions.php
r4163 r4206 174 174 175 175 /** 176 * Get user's WordPress.org profile link. 177 * 178 * @param int $user_id 179 * @return string 180 */ 181 function wporg_support_get_wporg_profile_link( $user_id = 0 ) { 182 $user_nicename = bbp_get_user_nicename( $user_id ); 183 184 return sprintf( '<a href="%s">@%s</a>', 185 esc_url( 'https://profiles.wordpress.org/' . $user_nicename ), 186 $user_nicename 187 ); 188 } 189 190 /** 191 * Get user's Slack username. 192 * 193 * @param int $user_id 194 * @return string The user's Slack username (without '@') if user has one. 195 */ 196 function wporg_support_get_slack_username( $user_id = 0 ) { 197 global $wpdb; 198 199 $user_id = bbp_get_user_id( $user_id ); 200 $slack_username = ''; 201 202 $data = $wpdb->get_var( $wpdb->prepare( "SELECT profiledata FROM slack_users WHERE user_id = %d", $user_id ) ); 203 if ( $data && ( $data = json_decode( $data, true ) ) ) { 204 $slack_username = $data['name']; 205 } 206 207 return $slack_username; 208 } 209 210 /** 176 211 * Get user's registration date. 212 * 213 * @param int $user_id 214 * @return string 177 215 */ 178 216 function wporg_support_get_user_registered_date( $user_id = 0 ) {
Note: See TracChangeset
for help on using the changeset viewer.