Changeset 2812
- Timestamp:
- 01/17/2011 06:57:34 PM (15 years ago)
- Location:
- branches/plugin/bbp-includes
- Files:
-
- 1 added
- 10 edited
-
bbp-caps.php (modified) (1 diff)
-
bbp-forum-template.php (modified) (5 diffs)
-
bbp-general-template.php (modified) (8 diffs)
-
bbp-loader.php (modified) (3 diffs)
-
bbp-options.php (modified) (4 diffs)
-
bbp-reply-template.php (modified) (2 diffs)
-
bbp-shortcodes.php (added)
-
bbp-topic-functions.php (modified) (1 diff)
-
bbp-topic-template.php (modified) (2 diffs)
-
bbp-user-template.php (modified) (6 diffs)
-
bbp-widgets.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-caps.php
r2783 r2812 7 7 * @subpackage Capabilities 8 8 */ 9 9 10 /** 10 11 * Adds bbPress-specific user roles. -
branches/plugin/bbp-includes/bbp-forum-template.php
r2808 r2812 8 8 */ 9 9 10 /** START - Forum Loop Functions**********************************************/10 /** Forum Loop ****************************************************************/ 11 11 12 12 /** … … 78 78 } 79 79 80 /** F ORUM*********************************************************************/80 /** Forum *********************************************************************/ 81 81 82 82 /** … … 517 517 } 518 518 519 /** F ORUM LAST TOPIC**********************************************************/519 /** Forum Last Topic **********************************************************/ 520 520 521 521 /** … … 660 660 } 661 661 662 /** F ORUM LAST REPLY**********************************************************/662 /** Forum Last Reply **********************************************************/ 663 663 664 664 /** … … 862 862 } 863 863 864 /** F ORUM COUNTS**************************************************************/864 /** Forum Counts **************************************************************/ 865 865 866 866 /** -
branches/plugin/bbp-includes/bbp-general-template.php
r2811 r2812 8 8 */ 9 9 10 /** START - WordPress Add-on Actions******************************************/10 /** Add-on Actions ************************************************************/ 11 11 12 12 /** … … 32 32 } 33 33 34 /** END - WordPress Add-on Actions ********************************************/ 35 36 /** START is_ Functions *******************************************************/ 34 /** is_ ***********************************************************************/ 37 35 38 36 /** … … 319 317 } 320 318 321 /** END is_ Functions *********************************************************/ 322 323 /** START Form Functions ******************************************************/ 319 /** Forms *********************************************************************/ 324 320 325 321 /** … … 619 615 620 616 <?php wp_referer_field(); ?> 617 621 618 <?php wp_nonce_field( 'update-user_' . bbp_get_displayed_user_id() ); 622 619 } … … 659 656 } 660 657 661 /** END Form Functions ********************************************************/ 662 663 /** Start Views ***************************************************************/ 658 /** Views *********************************************************************/ 664 659 665 660 /** … … 772 767 } 773 768 774 /** End Views *****************************************************************/ 775 776 /** Start General Functions ***************************************************/ 777 778 /** 779 * Display possible error messages inside a template file 780 * 781 * @since bbPress (r2688) 782 * 783 * @uses WP_Error bbPress::errors::get_error_codes() To get the error codes 784 * @uses WP_Error bbPress::errors::get_error_messages() To get the error 785 * messages 786 * @uses is_wp_error() To check if it's a {@link WP_Error} 787 */ 788 function bbp_error_messages() { 789 global $bbp; 790 791 if ( isset( $bbp->errors ) && is_wp_error( $bbp->errors ) && $bbp->errors->get_error_codes() ) : ?> 792 793 <div class="bbp-template-notice error"> 794 <p> 795 <?php echo implode( "</p>\n<p>", $bbp->errors->get_error_messages() ); ?> 796 </p> 797 </div> 798 799 <?php endif; 800 } 769 /** Query *********************************************************************/ 770 771 /** 772 * Get the '_bbp_query_name' setting 773 * 774 * @since bbPress (r2695) 775 * 776 * @uses get_query_var() To get the query var '_bbp_query_name' 777 * @return string To return the query var value 778 */ 779 function bbp_get_query_name() { 780 return get_query_var( '_bbp_query_name' ); 781 } 782 783 /** 784 * Set the '_bbp_query_name' setting to $name 785 * 786 * @since bbPress (r2692) 787 * 788 * @param string $name What to set the query var to 789 * @uses set_query_var() To set the query var '_bbp_query_name' 790 */ 791 function bbp_set_query_name( $name = '' ) { 792 set_query_var( '_bbp_query_name', $name ); 793 } 794 795 /** 796 * Used to clear the '_bbp_query_name' setting 797 * 798 * @since bbPress (r2692) 799 * 800 * @uses bbp_set_query_name() To set the query var '_bbp_query_name' to '' 801 */ 802 function bbp_reset_query_name() { 803 bbp_set_query_name(); 804 } 805 806 /** Breadcrumbs ***************************************************************/ 801 807 802 808 /** … … 890 896 } 891 897 898 /** Topic Tags ***************************************************************/ 899 892 900 /** 893 901 * Output all of the allowed tags in HTML format with attributes. … … 919 927 } 920 928 921 /** Start Query Functions *****************************************************/ 922 923 /** 924 * Get the '_bbp_query_name' setting 925 * 926 * @since bbPress (r2695) 927 * 928 * @uses get_query_var() To get the query var '_bbp_query_name' 929 * @return string To return the query var value 930 */ 931 function bbp_get_query_name() { 932 return get_query_var( '_bbp_query_name' ); 933 } 934 935 /** 936 * Set the '_bbp_query_name' setting to $name 937 * 938 * @since bbPress (r2692) 939 * 940 * @param string $name What to set the query var to 941 * @uses set_query_var() To set the query var '_bbp_query_name' 942 */ 943 function bbp_set_query_name( $name = '' ) { 944 set_query_var( '_bbp_query_name', $name ); 945 } 946 947 /** 948 * Used to clear the '_bbp_query_name' setting 949 * 950 * @since bbPress (r2692) 951 * 952 * @uses bbp_set_query_name() To set the query var '_bbp_query_name' to '' 953 */ 954 function bbp_reset_query_name() { 955 bbp_set_query_name(); 929 /** Errors ********************************************************************/ 930 931 /** 932 * Display possible error messages inside a template file 933 * 934 * @since bbPress (r2688) 935 * 936 * @uses WP_Error bbPress::errors::get_error_codes() To get the error codes 937 * @uses WP_Error bbPress::errors::get_error_messages() To get the error 938 * messages 939 * @uses is_wp_error() To check if it's a {@link WP_Error} 940 */ 941 function bbp_error_messages() { 942 global $bbp; 943 944 if ( isset( $bbp->errors ) && is_wp_error( $bbp->errors ) && $bbp->errors->get_error_codes() ) : ?> 945 946 <div class="bbp-template-notice error"> 947 <p> 948 <?php echo implode( "</p>\n<p>", $bbp->errors->get_error_messages() ); ?> 949 </p> 950 </div> 951 952 <?php endif; 956 953 } 957 954 -
branches/plugin/bbp-includes/bbp-loader.php
r2789 r2812 2 2 3 3 /** 4 * The main bbPress loader.4 * bbPress Loader Actions 5 5 * 6 6 * @package bbPress … … 9 9 10 10 /** Main Actions **************************************************************/ 11 12 /** 13 * Main action responsible for constants, globals, and includes 14 * 15 * @since bbPress (r2599) 16 * 17 * @uses do_action() Calls 'bbp_loaded' 18 */ 19 function bbp_loaded() { 20 do_action( 'bbp_loaded' ); 21 } 11 22 12 23 /** … … 52 63 function bbp_setup_globals() { 53 64 do_action( 'bbp_setup_globals' ); 54 }55 56 /**57 * Main action responsible for constants, globals, and includes58 *59 * @since bbPress (r2599)60 *61 * @uses do_action() Calls 'bbp_loaded'62 */63 function bbp_loaded() {64 do_action( 'bbp_loaded' );65 65 } 66 66 -
branches/plugin/bbp-includes/bbp-options.php
r2790 r2812 24 24 $options = array ( 25 25 26 /** S ETTINGS**********************************************************/26 /** Settings **********************************************************/ 27 27 28 28 // Lock post editing after 5 minutes … … 47 47 '_bbp_replies_per_page' => '15', 48 48 49 /** S LUGS*************************************************************/49 /** Slugs *************************************************************/ 50 50 51 51 // Root slug … … 94 94 */ 95 95 function bbp_is_favorites_active() { 96 return (bool) get_option( '_bbp_enable_favorites', true);96 return apply_filters( 'bbp_is_favorites_active', (bool) get_option( '_bbp_enable_favorites', true ) ); 97 97 } 98 98 … … 106 106 */ 107 107 function bbp_is_subscriptions_active() { 108 return (bool) get_option( '_bbp_enable_subscriptions');108 return apply_filters( 'bbp_is_subscriptions_active', (bool) get_option( '_bbp_enable_subscriptions' ) ); 109 109 } 110 110 -
branches/plugin/bbp-includes/bbp-reply-template.php
r2809 r2812 8 8 */ 9 9 10 /** START - Reply Loop Functions**********************************************/10 /** Reply Loop Functions ******************************************************/ 11 11 12 12 /** … … 1512 1512 } 1513 1513 1514 /** END Reply Loop Functions **************************************************/1515 1516 1514 ?> -
branches/plugin/bbp-includes/bbp-topic-functions.php
r2806 r2812 1200 1200 } 1201 1201 } 1202 }/** Topic Updaters ************************************************************/ 1202 } 1203 1204 /** Topic Updaters ************************************************************/ 1203 1205 1204 1206 /** -
branches/plugin/bbp-includes/bbp-topic-template.php
r2810 r2812 8 8 */ 9 9 10 /** START - Topic Loop Functions**********************************************/10 /** Topic Loop ****************************************************************/ 11 11 12 12 /** … … 1148 1148 } 1149 1149 1150 /** T OPIC LAST REPLY**********************************************************/1150 /** Topic Last Reply **********************************************************/ 1151 1151 1152 1152 /** -
branches/plugin/bbp-includes/bbp-user-template.php
r2803 r2812 2 2 3 3 /** 4 * bbPress User Functions4 * bbPress User Template Tags 5 5 * 6 6 * @package bbPress … … 8 8 */ 9 9 10 /** START User Functions******************************************************/10 /** Users *********************************************************************/ 11 11 12 12 /** … … 57 57 } 58 58 59 /** START Favorites Functions *************************************************/ 59 60 /** 61 * Output ID of current user 62 * 63 * @since bbPress (r2574) 64 * 65 * @uses bbp_get_current_user_id() To get the current user id 66 */ 67 function bbp_current_user_id() { 68 echo bbp_get_current_user_id(); 69 } 70 /** 71 * Return ID of current user 72 * 73 * @since bbPress (r2574) 74 * 75 * @uses bbp_get_user_id() To get the current user id 76 * @uses apply_filters() Calls 'bbp_get_current_user_id' with the id 77 * @return int Current user id 78 */ 79 function bbp_get_current_user_id() { 80 return apply_filters( 'bbp_get_current_user_id', bbp_get_user_id( 0, false, true ) ); 81 } 82 83 /** 84 * Output ID of displayed user 85 * 86 * @since bbPress (r2688) 87 * 88 * @uses bbp_get_displayed_user_id() To get the displayed user id 89 */ 90 function bbp_displayed_user_id() { 91 echo bbp_get_displayed_user_id(); 92 } 93 /** 94 * Return ID of displayed user 95 * 96 * @since bbPress (r2688) 97 * 98 * @uses bbp_get_user_id() To get the displayed user id 99 * @uses apply_filters() Calls 'bbp_get_displayed_user_id' with the id 100 * @return int Displayed user id 101 */ 102 function bbp_get_displayed_user_id() { 103 return apply_filters( 'bbp_get_displayed_user_id', bbp_get_user_id( 0, true, false ) ); 104 } 105 106 /** 107 * Return a sanitized user field value 108 * 109 * @since bbPress (r2688) 110 * 111 * @param string $field Field to get 112 * @uses sanitize_text_field() To sanitize the field 113 * @uses esc_attr() To sanitize the field 114 * @return string|bool Value of the field if it exists, else false 115 */ 116 function bbp_get_displayed_user_field( $field = '' ) { 117 global $bbp; 118 119 // Return field if exists 120 if ( isset( $bbp->displayed_user->$field ) ) 121 return esc_attr( sanitize_text_field( $bbp->displayed_user->$field ) ); 122 123 // Return empty 124 return false; 125 } 126 127 /** 128 * Output name of current user 129 * 130 * @since bbPress (r2574) 131 * 132 * @uses bbp_get_current_user_name() To get the current user name 133 */ 134 function bbp_current_user_name() { 135 echo bbp_get_current_user_name(); 136 } 137 /** 138 * Return name of current user 139 * 140 * @since bbPress (r2574) 141 * 142 * @uses apply_filters() Calls 'bbp_get_current_user_name' with the 143 * current user name 144 * @return string 145 */ 146 function bbp_get_current_user_name() { 147 global $user_identity; 148 149 if ( is_user_logged_in() ) 150 $current_user_name = $user_identity; 151 else 152 $current_user_name = __( 'Anonymous', 'bbpress' ); 153 154 return apply_filters( 'bbp_get_current_user_name', $current_user_name ); 155 } 156 157 /** 158 * Output avatar of current user 159 * 160 * @since bbPress (r2574) 161 * 162 * @param int $size Size of the avatar. Defaults to 40 163 * @uses bbp_get_current_user_avatar() To get the current user avatar 164 */ 165 function bbp_current_user_avatar( $size = 40 ) { 166 echo bbp_get_current_user_avatar( $size ); 167 } 168 169 /** 170 * Return avatar of current user 171 * 172 * @since bbPress (r2574) 173 * 174 * @param int $size Size of the avatar. Defaults to 40 175 * @uses bbp_get_current_user_id() To get the current user id 176 * @uses bbp_get_current_anonymous_user_data() To get the current 177 * anonymous user's email 178 * @uses get_avatar() To get the avatar 179 * @uses apply_filters() Calls 'bbp_get_current_user_avatar' with the 180 * avatar and size 181 * @return string Current user avatar 182 */ 183 function bbp_get_current_user_avatar( $size = 40 ) { 184 185 if ( !$user = bbp_get_current_user_id() ) 186 $user = bbp_get_current_anonymous_user_data( 'email' ); 187 188 return apply_filters( 'bbp_get_current_user_avatar', get_avatar( $user, $size ), $size ); 189 } 190 191 /** 192 * Output link to the profile page of a user 193 * 194 * @since bbPress (r2688) 195 * 196 * @param int $user_id Optional. User id 197 * @uses bbp_get_user_profile_link() To get user profile link 198 */ 199 function bbp_user_profile_link( $user_id = 0 ) { 200 echo bbp_get_user_profile_link( $user_id ); 201 } 202 /** 203 * Return link to the profile page of a user 204 * 205 * @since bbPress (r2688) 206 * 207 * @param int $user_id Optional. User id 208 * @uses bbp_get_user_id() To get user id 209 * @uses get_userdata() To get user data 210 * @uses bbp_get_user_profile_url() To get user profile url 211 * @uses apply_filters() Calls 'bbp_get_user_profile_link' with the user 212 * profile link and user id 213 * @return string User profile link 214 */ 215 function bbp_get_user_profile_link( $user_id = 0 ) { 216 if ( !$user_id = bbp_get_user_id( $user_id ) ) 217 return false; 218 219 $user = get_userdata( $user_id ); 220 $name = esc_attr( $user->display_name ); 221 $user_link = '<a href="' . bbp_get_user_profile_url( $user_id ) . '" title="' . $name . '">' . $name . '</a>'; 222 223 return apply_filters( 'bbp_get_user_profile_link', $user_link, $user_id ); 224 } 225 226 /** 227 * Output URL to the profile page of a user 228 * 229 * @since bbPress (r2688) 230 * 231 * @param int $user_id Optional. User id 232 * @param string $user_nicename Optional. User nicename 233 * @uses bbp_get_user_profile_url() To get user profile url 234 */ 235 function bbp_user_profile_url( $user_id = 0, $user_nicename = '' ) { 236 echo bbp_get_user_profile_url( $user_id ); 237 } 238 /** 239 * Return URL to the profile page of a user 240 * 241 * @since bbPress (r2688) 242 * 243 * @param int $user_id Optional. User id 244 * @param string $user_nicename Optional. User nicename 245 * @uses bbp_get_user_id() To get user id 246 * @uses add_query_arg() To add custom args to the url 247 * @uses home_url() To get blog home url 248 * @uses apply_filters() Calls 'bbp_get_user_profile_url' with the user 249 * profile url, user id and user nicename 250 * @return string User profile url 251 */ 252 function bbp_get_user_profile_url( $user_id = 0, $user_nicename = '' ) { 253 global $wp_rewrite, $bbp; 254 255 // Use displayed user ID if there is one, and one isn't requested 256 if ( !$user_id = bbp_get_user_id( $user_id ) ) 257 return false; 258 259 // No pretty permalinks 260 if ( empty( $wp_rewrite->permalink_structure ) ) { 261 $url = add_query_arg( array( 'bbp_user' => $user_id ), home_url( '/' ) ); 262 263 // Get URL safe user slug 264 } else { 265 $url = $wp_rewrite->front . $bbp->user_slug . '/%bbp_user%'; 266 267 if ( empty( $user_nicename ) ) { 268 $user = get_userdata( $user_id ); 269 if ( !empty( $user->user_nicename ) ) 270 $user_nicename = $user->user_nicename; 271 } 272 273 $url = str_replace( '%bbp_user%', $user_nicename, $url ); 274 $url = home_url( user_trailingslashit( $url ) ); 275 } 276 277 return apply_filters( 'bbp_get_user_profile_url', $url, $user_id, $user_nicename ); 278 279 } 280 281 /** 282 * Output link to the profile edit page of a user 283 * 284 * @since bbPress (r2688) 285 * 286 * @param int $user_id Optional. User id 287 * @uses bbp_get_user_profile_edit_link() To get user profile edit link 288 */ 289 function bbp_user_profile_edit_link( $user_id = 0 ) { 290 echo bbp_get_user_profile_edit_link( $user_id ); 291 } 292 /** 293 * Return link to the profile edit page of a user 294 * 295 * @since bbPress (r2688) 296 * 297 * @param int $user_id Optional. User id 298 * @uses bbp_get_user_id() To get user id 299 * @uses get_userdata() To get user data 300 * @uses bbp_get_user_profile_edit_url() To get user profile edit url 301 * @uses apply_filters() Calls 'bbp_get_user_profile_link' with the edit 302 * link and user id 303 * @return string User profile edit link 304 */ 305 function bbp_get_user_profile_edit_link( $user_id = 0 ) { 306 if ( !$user_id = bbp_get_user_id( $user_id ) ) 307 return false; 308 309 $user = get_userdata( $user_id ); 310 $name = $user->display_name; 311 $edit_link = '<a href="' . bbp_get_user_profile_url( $user_id ) . '" title="' . esc_attr( $name ) . '">' . $name . '</a>'; 312 return apply_filters( 'bbp_get_user_profile_link', $edit_link, $user_id ); 313 } 314 315 /** 316 * Output URL to the profile edit page of a user 317 * 318 * @since bbPress (r2688) 319 * 320 * @param int $user_id Optional. User id 321 * @param string $user_nicename Optional. User nicename 322 * @uses bbp_get_user_profile_edit_url() To get user profile edit url 323 */ 324 function bbp_user_profile_edit_url( $user_id = 0, $user_nicename = '' ) { 325 echo bbp_get_user_profile_edit_url( $user_id ); 326 } 327 /** 328 * Return URL to the profile edit page of a user 329 * 330 * @since bbPress (r2688) 331 * 332 * @param int $user_id Optional. User id 333 * @param string $user_nicename Optional. User nicename 334 * @uses bbp_get_user_id() To get user id 335 * @uses add_query_arg() To add custom args to the url 336 * @uses home_url() To get blog home url 337 * @uses apply_filters() Calls 'bbp_get_user_edit_profile_url' with the 338 * edit profile url, user id and user nicename 339 * @return string 340 */ 341 function bbp_get_user_profile_edit_url( $user_id = 0, $user_nicename = '' ) { 342 global $wp_rewrite, $bbp; 343 344 if ( !$user_id = bbp_get_user_id( $user_id ) ) 345 return; 346 347 if ( empty( $wp_rewrite->permalink_structure ) ) { 348 $url = add_query_arg( array( 'bbp_user' => $user_id, 'edit' => '1' ), home_url( '/' ) ); 349 } else { 350 $url = $wp_rewrite->front . $bbp->user_slug . '/%bbp_user%/edit'; 351 352 if ( empty( $user_nicename ) ) { 353 $user = get_userdata( $user_id ); 354 if ( !empty( $user->user_nicename ) ) 355 $user_nicename = $user->user_nicename; 356 } 357 358 $url = str_replace( '%bbp_user%', $user_nicename, $url ); 359 $url = home_url( user_trailingslashit( $url ) ); 360 } 361 362 return apply_filters( 'bbp_get_user_edit_profile_url', $url, $user_id, $user_nicename ); 363 364 } 365 366 /** Favorites *****************************************************************/ 60 367 61 368 /** … … 173 480 } 174 481 175 /** END Favorites Functions ***************************************************/ 176 177 /** START Subscriptions Functions *********************************************/ 482 /** Subscriptions *************************************************************/ 178 483 179 484 /** … … 287 592 } 288 593 289 /** END Subscriptions Functions ***********************************************/290 291 /**292 * Output ID of current user293 *294 * @since bbPress (r2574)295 *296 * @uses bbp_get_current_user_id() To get the current user id297 */298 function bbp_current_user_id() {299 echo bbp_get_current_user_id();300 }301 /**302 * Return ID of current user303 *304 * @since bbPress (r2574)305 *306 * @uses bbp_get_user_id() To get the current user id307 * @uses apply_filters() Calls 'bbp_get_current_user_id' with the id308 * @return int Current user id309 */310 function bbp_get_current_user_id() {311 return apply_filters( 'bbp_get_current_user_id', bbp_get_user_id( 0, false, true ) );312 }313 314 /**315 * Output ID of displayed user316 *317 * @since bbPress (r2688)318 *319 * @uses bbp_get_displayed_user_id() To get the displayed user id320 */321 function bbp_displayed_user_id() {322 echo bbp_get_displayed_user_id();323 }324 /**325 * Return ID of displayed user326 *327 * @since bbPress (r2688)328 *329 * @uses bbp_get_user_id() To get the displayed user id330 * @uses apply_filters() Calls 'bbp_get_displayed_user_id' with the id331 * @return int Displayed user id332 */333 function bbp_get_displayed_user_id() {334 return apply_filters( 'bbp_get_displayed_user_id', bbp_get_user_id( 0, true, false ) );335 }336 337 /**338 * Return a sanitized user field value339 *340 * @since bbPress (r2688)341 *342 * @param string $field Field to get343 * @uses sanitize_text_field() To sanitize the field344 * @uses esc_attr() To sanitize the field345 * @return string|bool Value of the field if it exists, else false346 */347 function bbp_get_displayed_user_field( $field = '' ) {348 global $bbp;349 350 // Return field if exists351 if ( isset( $bbp->displayed_user->$field ) )352 return esc_attr( sanitize_text_field( $bbp->displayed_user->$field ) );353 354 // Return empty355 return false;356 }357 358 /**359 * Output name of current user360 *361 * @since bbPress (r2574)362 *363 * @uses bbp_get_current_user_name() To get the current user name364 */365 function bbp_current_user_name() {366 echo bbp_get_current_user_name();367 }368 /**369 * Return name of current user370 *371 * @since bbPress (r2574)372 *373 * @uses apply_filters() Calls 'bbp_get_current_user_name' with the374 * current user name375 * @return string376 */377 function bbp_get_current_user_name() {378 global $user_identity;379 380 if ( is_user_logged_in() )381 $current_user_name = $user_identity;382 else383 $current_user_name = __( 'Anonymous', 'bbpress' );384 385 return apply_filters( 'bbp_get_current_user_name', $current_user_name );386 }387 388 /**389 * Output avatar of current user390 *391 * @since bbPress (r2574)392 *393 * @param int $size Size of the avatar. Defaults to 40394 * @uses bbp_get_current_user_avatar() To get the current user avatar395 */396 function bbp_current_user_avatar( $size = 40 ) {397 echo bbp_get_current_user_avatar( $size );398 }399 400 /**401 * Return avatar of current user402 *403 * @since bbPress (r2574)404 *405 * @param int $size Size of the avatar. Defaults to 40406 * @uses bbp_get_current_user_id() To get the current user id407 * @uses bbp_get_current_anonymous_user_data() To get the current408 * anonymous user's email409 * @uses get_avatar() To get the avatar410 * @uses apply_filters() Calls 'bbp_get_current_user_avatar' with the411 * avatar and size412 * @return string Current user avatar413 */414 function bbp_get_current_user_avatar( $size = 40 ) {415 416 if ( !$user = bbp_get_current_user_id() )417 $user = bbp_get_current_anonymous_user_data( 'email' );418 419 return apply_filters( 'bbp_get_current_user_avatar', get_avatar( $user, $size ), $size );420 }421 422 /**423 * Output link to the profile page of a user424 *425 * @since bbPress (r2688)426 *427 * @param int $user_id Optional. User id428 * @uses bbp_get_user_profile_link() To get user profile link429 */430 function bbp_user_profile_link( $user_id = 0 ) {431 echo bbp_get_user_profile_link( $user_id );432 }433 /**434 * Return link to the profile page of a user435 *436 * @since bbPress (r2688)437 *438 * @param int $user_id Optional. User id439 * @uses bbp_get_user_id() To get user id440 * @uses get_userdata() To get user data441 * @uses bbp_get_user_profile_url() To get user profile url442 * @uses apply_filters() Calls 'bbp_get_user_profile_link' with the user443 * profile link and user id444 * @return string User profile link445 */446 function bbp_get_user_profile_link( $user_id = 0 ) {447 if ( !$user_id = bbp_get_user_id( $user_id ) )448 return false;449 450 $user = get_userdata( $user_id );451 $name = esc_attr( $user->display_name );452 $user_link = '<a href="' . bbp_get_user_profile_url( $user_id ) . '" title="' . $name . '">' . $name . '</a>';453 454 return apply_filters( 'bbp_get_user_profile_link', $user_link, $user_id );455 }456 457 /**458 * Output URL to the profile page of a user459 *460 * @since bbPress (r2688)461 *462 * @param int $user_id Optional. User id463 * @param string $user_nicename Optional. User nicename464 * @uses bbp_get_user_profile_url() To get user profile url465 */466 function bbp_user_profile_url( $user_id = 0, $user_nicename = '' ) {467 echo bbp_get_user_profile_url( $user_id );468 }469 /**470 * Return URL to the profile page of a user471 *472 * @since bbPress (r2688)473 *474 * @param int $user_id Optional. User id475 * @param string $user_nicename Optional. User nicename476 * @uses bbp_get_user_id() To get user id477 * @uses add_query_arg() To add custom args to the url478 * @uses home_url() To get blog home url479 * @uses apply_filters() Calls 'bbp_get_user_profile_url' with the user480 * profile url, user id and user nicename481 * @return string User profile url482 */483 function bbp_get_user_profile_url( $user_id = 0, $user_nicename = '' ) {484 global $wp_rewrite, $bbp;485 486 // Use displayed user ID if there is one, and one isn't requested487 if ( !$user_id = bbp_get_user_id( $user_id ) )488 return false;489 490 // No pretty permalinks491 if ( empty( $wp_rewrite->permalink_structure ) ) {492 $url = add_query_arg( array( 'bbp_user' => $user_id ), home_url( '/' ) );493 494 // Get URL safe user slug495 } else {496 $url = $wp_rewrite->front . $bbp->user_slug . '/%bbp_user%';497 498 if ( empty( $user_nicename ) ) {499 $user = get_userdata( $user_id );500 if ( !empty( $user->user_nicename ) )501 $user_nicename = $user->user_nicename;502 }503 504 $url = str_replace( '%bbp_user%', $user_nicename, $url );505 $url = home_url( user_trailingslashit( $url ) );506 }507 508 return apply_filters( 'bbp_get_user_profile_url', $url, $user_id, $user_nicename );509 510 }511 512 /**513 * Output link to the profile edit page of a user514 *515 * @since bbPress (r2688)516 *517 * @param int $user_id Optional. User id518 * @uses bbp_get_user_profile_edit_link() To get user profile edit link519 */520 function bbp_user_profile_edit_link( $user_id = 0 ) {521 echo bbp_get_user_profile_edit_link( $user_id );522 }523 /**524 * Return link to the profile edit page of a user525 *526 * @since bbPress (r2688)527 *528 * @param int $user_id Optional. User id529 * @uses bbp_get_user_id() To get user id530 * @uses get_userdata() To get user data531 * @uses bbp_get_user_profile_edit_url() To get user profile edit url532 * @uses apply_filters() Calls 'bbp_get_user_profile_link' with the edit533 * link and user id534 * @return string User profile edit link535 */536 function bbp_get_user_profile_edit_link( $user_id = 0 ) {537 if ( !$user_id = bbp_get_user_id( $user_id ) )538 return false;539 540 $user = get_userdata( $user_id );541 $name = $user->display_name;542 $edit_link = '<a href="' . bbp_get_user_profile_url( $user_id ) . '" title="' . esc_attr( $name ) . '">' . $name . '</a>';543 return apply_filters( 'bbp_get_user_profile_link', $edit_link, $user_id );544 }545 546 /**547 * Output URL to the profile edit page of a user548 *549 * @since bbPress (r2688)550 *551 * @param int $user_id Optional. User id552 * @param string $user_nicename Optional. User nicename553 * @uses bbp_get_user_profile_edit_url() To get user profile edit url554 */555 function bbp_user_profile_edit_url( $user_id = 0, $user_nicename = '' ) {556 echo bbp_get_user_profile_edit_url( $user_id );557 }558 /**559 * Return URL to the profile edit page of a user560 *561 * @since bbPress (r2688)562 *563 * @param int $user_id Optional. User id564 * @param string $user_nicename Optional. User nicename565 * @uses bbp_get_user_id() To get user id566 * @uses add_query_arg() To add custom args to the url567 * @uses home_url() To get blog home url568 * @uses apply_filters() Calls 'bbp_get_user_edit_profile_url' with the569 * edit profile url, user id and user nicename570 * @return string571 */572 function bbp_get_user_profile_edit_url( $user_id = 0, $user_nicename = '' ) {573 global $wp_rewrite, $bbp;574 575 if ( !$user_id = bbp_get_user_id( $user_id ) )576 return;577 578 if ( empty( $wp_rewrite->permalink_structure ) ) {579 $url = add_query_arg( array( 'bbp_user' => $user_id, 'edit' => '1' ), home_url( '/' ) );580 } else {581 $url = $wp_rewrite->front . $bbp->user_slug . '/%bbp_user%/edit';582 583 if ( empty( $user_nicename ) ) {584 $user = get_userdata( $user_id );585 if ( !empty( $user->user_nicename ) )586 $user_nicename = $user->user_nicename;587 }588 589 $url = str_replace( '%bbp_user%', $user_nicename, $url );590 $url = home_url( user_trailingslashit( $url ) );591 }592 593 return apply_filters( 'bbp_get_user_edit_profile_url', $url, $user_id, $user_nicename );594 595 }596 594 597 595 /** Edit User *****************************************************************/ … … 728 726 } 729 727 730 /** END User Functions ********************************************************/731 732 728 ?> -
branches/plugin/bbp-includes/bbp-widgets.php
r2773 r2812 98 98 $instance['title'] = strip_tags( $new_instance['title'] ); 99 99 $instance['parent_forum'] = absint ( $new_instance['parent_forum'] ); 100 100 101 return $instance; 101 102 } … … 112 113 function form( $instance ) { 113 114 $title = !empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; 114 $parent_forum = !empty( $instance['parent_forum'] ) ? esc_attr( $instance['parent_forum'] ) : ''; 115 116 ?> 115 $parent_forum = !empty( $instance['parent_forum'] ) ? esc_attr( $instance['parent_forum'] ) : ''; ?> 117 116 118 117 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'bbpress' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></label></p> … … 129 128 <?php 130 129 } 131 132 130 } 133 131 … … 200 198 201 199 <ul> 200 202 201 <?php while ( bbp_topics() ) : bbp_the_topic(); ?> 203 202 … … 231 230 <ul> 232 231 232 <?php foreach ( $topics as $topic_id => $topic_reply_count ) : ?> 233 234 <li><a class="bbp-topic-title" href="<?php bbp_topic_permalink( $topic_id ); ?>" title="<?php bbp_topic_title( $topic_id ); ?>"><?php bbp_topic_title( $topic_id ); ?></a><?php if ( $show_date == 'on' ) _e( ', ' . bbp_get_topic_last_active( $topic_id ) . ' ago' ); ?></li> 235 233 236 <?php 234 235 foreach ( $topics as $topic_id => $topic_reply_count ) :236 237 ?>238 239 <li><a class="bbp-topic-title" href="<?php bbp_topic_permalink( $topic_id ); ?>" title="<?php bbp_topic_title( $topic_id ); ?>"><?php bbp_topic_title( $topic_id ); ?></a><?php if ( $show_date == 'on' ) _e( ', ' . bbp_get_topic_last_active( $topic_id ) . ' ago' ); ?></li>240 241 <?php242 237 243 238 $topic_count++; … … 246 241 break; 247 242 248 endforeach; 249 250 ?> 243 endforeach; ?> 251 244 252 245 </ul> … … 272 265 $instance['show_date'] = strip_tags( $new_instance['show_date'] ); 273 266 $instance['pop_check'] = strip_tags( $new_instance['pop_check'] ); 267 274 268 return $instance; 275 269 } … … 288 282 $max_shown = !empty( $instance['max_shown'] ) ? esc_attr( $instance['max_shown'] ) : ''; 289 283 $show_date = !empty( $instance['show_date'] ) ? esc_attr( $instance['show_date'] ) : ''; 290 $pop_check = !empty( $instance['pop_check'] ) ? esc_attr( $instance['pop_check'] ) : ''; 291 292 ?> 284 $pop_check = !empty( $instance['pop_check'] ) ? esc_attr( $instance['pop_check'] ) : ''; ?> 293 285 294 286 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'bbpress' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></label></p> … … 405 397 $instance['max_shown'] = strip_tags( $new_instance['max_shown'] ); 406 398 $instance['show_date'] = strip_tags( $new_instance['show_date'] ); 399 407 400 return $instance; 408 401 } … … 420 413 $title = !empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; 421 414 $max_shown = !empty( $instance['max_shown'] ) ? esc_attr( $instance['max_shown'] ) : ''; 422 $show_date = !empty( $instance['show_date'] ) ? esc_attr( $instance['show_date'] ) : ''; 423 424 ?> 415 $show_date = !empty( $instance['show_date'] ) ? esc_attr( $instance['show_date'] ) : ''; ?> 425 416 426 417 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'bbpress' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></label></p> … … 430 421 <?php 431 422 } 432 433 423 } 434 424
Note: See TracChangeset
for help on using the changeset viewer.