Changeset 2970 for branches/plugin/bbp-includes/bbp-general-template.php
- Timestamp:
- 04/01/2011 01:33:09 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-general-template.php
r2927 r2970 39 39 * @since bbPress (r2549) 40 40 * 41 * @uses WP_Query42 *43 41 * @param int $post_id Possible post_id to check 44 * @return bool 42 * @uses bbp_get_forum_post_type() To get the forum post type 43 * @uses is_singular() To check if it's the single post page 44 * @uses get_post_field() To get the post type of the post id 45 * @uses WP_Query To make some checks 46 * @return bool True if it's a forum page, false if not 45 47 */ 46 48 function bbp_is_forum( $post_id = 0 ) { … … 69 71 * @since bbPress (r2549) 70 72 * 71 * @uses WP_Query72 * @uses bbp_is_topic_edit() To check if it's a topic edit page73 *74 73 * @param int $post_id Possible post_id to check 75 * @return bool 74 * 75 * @uses bbp_is_topic_edit() To return false if it's a topic edit page 76 * @uses bbp_get_topic_post_type() To get the topic post type 77 * @uses is_singular() To check if it's the single post page 78 * @uses get_post_field() To get the post type of the post id 79 * @uses WP_Query To make some checks 80 * @return bool True if it's a topic page, false if not 76 81 */ 77 82 function bbp_is_topic( $post_id = 0 ) { … … 105 110 * 106 111 * @uses WP_Query Checks if WP_Query::bbp_is_topic_edit is true 107 * @return bool 112 * @return bool True if it's the topic edit page, false if not 108 113 */ 109 114 function bbp_is_topic_edit() { … … 122 127 * 123 128 * @uses bbp_is_topic_edit() To check if it's a topic edit page 124 * @return bool 129 * @return bool True if it's the topic merge page, false if not 125 130 */ 126 131 function bbp_is_topic_merge() { … … 138 143 * 139 144 * @uses bbp_is_topic_edit() To check if it's a topic edit page 140 * @return bool 145 * @return bool True if it's the topic split page, false if not 141 146 */ 142 147 function bbp_is_topic_split() { … … 153 158 * @since bbPress (r2549) 154 159 * 155 * @uses WP_Query156 * @uses bbp_is_reply_edit() To check if it's a reply edit page157 *158 160 * @param int $post_id Possible post_id to check 159 * @return bool 161 * @uses bbp_is_reply_edit() To return false if it's a reply edit page 162 * @uses bbp_get_reply_post_type() To get the reply post type 163 * @uses is_singular() To check if it's the single post page 164 * @uses get_post_field() To get the post type of the post id 165 * @uses WP_Query To make some checks 166 * @return bool True if it's a reply page, false if not 160 167 */ 161 168 function bbp_is_reply( $post_id = 0 ) { … … 189 196 * 190 197 * @uses WP_Query Checks if WP_Query::bbp_is_reply_edit is true 191 * @return bool 198 * @return bool True if it's the reply edit page, false if not 192 199 */ 193 200 function bbp_is_reply_edit() { … … 211 218 * @uses bbp_is_user_profile_page() To check if it's the user profile page 212 219 * @uses bbp_get_query_name() To get the query name 213 * @return bool 220 * @return bool True if it's the favorites page, false if not 214 221 */ 215 222 function bbp_is_favorites( $query_name_check = true ) { … … 234 241 * @uses bbp_is_user_profile_page() To check if it's the user profile page 235 242 * @uses bbp_get_query_name() To get the query name 236 * @return bool 243 * @return bool True if it's the subscriptions page, false if not 237 244 */ 238 245 function bbp_is_subscriptions( $query_name_check = true ) { … … 258 265 * @uses bbp_is_user_profile_page() To check if it's the user profile page 259 266 * @uses bbp_get_query_name() To get the query name 260 * @return bool 267 * @return bool True if it's the topics created page, false if not 261 268 */ 262 269 function bbp_is_topics_created( $query_name_check = true ) { … … 273 280 * Check if current page is the currently logged in users author page 274 281 * 282 * @since bbPress (r2688) 283 * 275 284 * @uses bbPres Checks if bbPress::displayed_user is set and if 276 285 * bbPress::displayed_user::ID equals bbPress::current_user::ID 277 286 * or not 278 * @return bool 287 * @return bool True if it's the user's home, false if not 279 288 */ 280 289 function bbp_is_user_home() { … … 293 302 * 294 303 * @uses WP_Query Checks if WP_Query::bbp_is_user_profile_page is set to true 295 * @return bool 304 * @return bool True if it's a user's profile page, false if not 296 305 */ 297 306 function bbp_is_user_profile_page() { … … 310 319 * 311 320 * @uses WP_Query Checks if WP_Query::bbp_is_user_profile_edit is set to true 312 * @return bool 321 * @return bool True if it's a user's profile edit page, false if not 313 322 */ 314 323 function bbp_is_user_profile_edit() { … … 345 354 * @param array $wp_classes 346 355 * @param array $custom_classes 347 *348 356 * @uses bbp_is_forum() 349 357 * @uses bbp_is_topic() … … 361 369 * @uses bbp_is_favorites() 362 370 * @uses bbp_is_topics_created() 363 * 364 * @return array 371 * @return array Body Classes 365 372 */ 366 373 function bbp_body_class( $wp_classes, $custom_classes = false ) { … … 478 485 $url = $_SERVER['REQUEST_URI']; 479 486 480 $url = (string) esc_attr( $url ); 487 // Remove loggedout query arg if it's there 488 $url = (string) esc_attr( remove_query_arg( 'loggedout', $url ) ); 481 489 482 490 $referer_field = '<input type="hidden" name="redirect_to" value="' . $url . '" />'; … … 631 639 * @uses current_user_can() To check if the current user can read 632 640 * private forums 641 * @uses bbp_get_forum_post_type() To get the forum post type 642 * @uses bbp_get_topic_post_type() To get the topic post type 633 643 * @uses walk_page_dropdown_tree() To generate the dropdown using the 634 644 * walker … … 1009 1019 * @since bbPress (r2692) 1010 1020 * 1011 * @uses bbp_set_query_name() To set the query var '_bbp_query_name' to ''1021 * @uses bbp_set_query_name() To set the query var '_bbp_query_name' value to '' 1012 1022 */ 1013 1023 function bbp_reset_query_name() { … … 1051 1061 * @uses bbp_get_reply_permalink() To get the reply link 1052 1062 * @uses get_permalink() To get the permalink 1063 * @uses bbp_get_forum_post_type() To get the forum post type 1064 * @uses bbp_get_topic_post_type() To get the topic post type 1065 * @uses bbp_get_reply_post_type() To get the reply post type 1053 1066 * @uses bbp_get_forum_title() To get the forum title 1054 1067 * @uses bbp_get_topic_title() To get the topic title … … 1142 1155 } 1143 1156 1144 /** Errors ********************************************************************/1145 1146 /** 1147 * Display possible error messages inside a template file1157 /** Errors & Messages *********************************************************/ 1158 1159 /** 1160 * Display possible errors & messages inside a template file 1148 1161 * 1149 1162 * @since bbPress (r2688) … … 1154 1167 * @uses is_wp_error() To check if it's a {@link WP_Error} 1155 1168 */ 1156 function bbp_ error_messages() {1169 function bbp_template_notices() { 1157 1170 global $bbp; 1158 1171 1159 if ( isset( $bbp->errors ) && is_wp_error( $bbp->errors ) && $bbp->errors->get_error_codes() ) : ?> 1172 // Bail if no notices or errors 1173 if ( !isset( $bbp->errors ) || !is_wp_error( $bbp->errors ) || !$bbp->errors->get_error_codes() ) 1174 return; 1175 1176 // Prevent debug notices 1177 $errors = $messages = array(); 1178 1179 // Loop through notices 1180 foreach ( $bbp->errors->get_error_codes() as $code ) { 1181 1182 // Get notice severity 1183 $severity = $bbp->errors->get_error_data( $code ); 1184 1185 // Loop through notices and separate errors from messages 1186 foreach ( $bbp->errors->get_error_messages( $code ) as $error ) { 1187 if ( 'message' == $severity ) { 1188 $messages[] = $error; 1189 } else { 1190 $errors[] = $error; 1191 } 1192 } 1193 } 1194 1195 // Display errors first... 1196 if ( !empty( $errors ) ) : ?> 1160 1197 1161 1198 <div class="bbp-template-notice error"> 1162 1199 <p> 1163 <?php echo implode( "</p>\n<p>", $ bbp->errors->get_error_messages()); ?>1200 <?php echo implode( "</p>\n<p>", $errors ); ?> 1164 1201 </p> 1165 1202 </div> 1166 1203 1167 <?php endif; 1204 <?php endif; 1205 1206 // ...and messages last 1207 if ( !empty( $messages ) ) : ?> 1208 1209 <div class="bbp-template-notice"> 1210 <p> 1211 <?php echo implode( "</p>\n<p>", $messages ); ?> 1212 </p> 1213 </div> 1214 1215 <?php endif; 1168 1216 } 1169 1217 … … 1193 1241 */ 1194 1242 function bbp_get_logout_link( $redirect_to = '' ) { 1195 return apply_filters( 'bbp_get_logout_link', '<a href="' . wp_logout_url( ) . '" class="button logout-link">' . __( 'Log Out', 'bbpress' ) . '</a>', $redirect_to );1243 return apply_filters( 'bbp_get_logout_link', '<a href="' . wp_logout_url( $redirect_to ) . '" class="button logout-link">' . __( 'Log Out', 'bbpress' ) . '</a>', $redirect_to ); 1196 1244 } 1197 1245
Note: See TracChangeset
for help on using the changeset viewer.