Changeset 4166
- Timestamp:
- 08/21/2012 07:11:11 AM (13 years ago)
- Location:
- branches/plugin/bbp-includes
- Files:
-
- 2 edited
-
bbp-reply-functions.php (modified) (2 diffs)
-
bbp-topic-functions.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-reply-functions.php
r4162 r4166 224 224 /** Topic Tags ************************************************************/ 225 225 226 if ( !empty( $_POST['bbp_topic_tags'] ) ) 226 // Either replace terms 227 if ( bbp_allow_topic_tags() && current_user_can( 'assign_topic_tags' ) && ! empty( $_POST['bbp_topic_tags'] ) ) { 227 228 $terms = esc_attr( strip_tags( $_POST['bbp_topic_tags'] ) ); 229 230 // ...or remove them. 231 } elseif ( isset( $_POST['bbp_topic_tags'] ) ) { 232 $terms = ''; 233 234 // Existing terms 235 } else { 236 $terms = bbp_get_topic_tag_names( $topic_id ); 237 } 228 238 229 239 /** Additional Actions (Before Save) **************************************/ … … 486 496 /** Topic Tags ************************************************************/ 487 497 488 if ( !empty( $_POST['bbp_topic_tags'] ) ) 498 // Either replace terms 499 if ( bbp_allow_topic_tags() && current_user_can( 'assign_topic_tags' ) && ! empty( $_POST['bbp_topic_tags'] ) ) { 489 500 $terms = esc_attr( strip_tags( $_POST['bbp_topic_tags'] ) ); 501 502 // ...or remove them. 503 } elseif ( isset( $_POST['bbp_topic_tags'] ) ) { 504 $terms = ''; 505 506 // Existing terms 507 } else { 508 $terms = bbp_get_topic_tag_names( $topic_id ); 509 } 490 510 491 511 /** Additional Actions (Before Save) **************************************/ -
branches/plugin/bbp-includes/bbp-topic-functions.php
r4149 r4166 430 430 $topic = $topic_id = $forum_id = $anonymous_data = 0; 431 431 $topic_title = $topic_content = $topic_edit_reason = ''; 432 $terms = array( bbp_get_topic_tag_tax_id() => array() );433 432 434 433 /** Topic *****************************************************************/ … … 552 551 /** Topic Tags ************************************************************/ 553 552 554 // Tags555 if ( bbp_allow_topic_tags() && !empty( $_POST['bbp_topic_tags'] ) ) {553 // Either replace terms 554 if ( bbp_allow_topic_tags() && current_user_can( 'assign_topic_tags' ) && ! empty( $_POST['bbp_topic_tags'] ) ) { 556 555 557 556 // Escape tag input … … 564 563 // Add topic tag ID as main key 565 564 $terms = array( bbp_get_topic_tag_tax_id() => $terms ); 565 566 // ...or remove them. 567 } elseif ( isset( $_POST['bbp_topic_tags'] ) ) { 568 $terms = array( bbp_get_topic_tag_tax_id() => array() ); 569 570 // Existing terms 571 } else { 572 $terms = array( bbp_get_topic_tag_tax_id() => explode( ',', bbp_get_topic_tag_names( $topic_id, ',' ) ) ); 566 573 } 567 574 … … 3069 3076 } 3070 3077 3078 /** Topic Tags ****************************************************************/ 3079 3080 /** 3081 * Get topic tags for a specific topic ID 3082 * 3083 * @since bbPress (r4165) 3084 * 3085 * @param int $topic_id 3086 * @param string $sep 3087 * @return string 3088 */ 3089 function bbp_get_topic_tag_names( $topic_id = 0, $sep = ', ' ) { 3090 $topic_id = bbp_get_topic_id( $topic_id ); 3091 $topic_tags = array_filter( (array) get_the_terms( $topic_id, bbp_get_topic_tag_tax_id() ) ); 3092 $terms = array(); 3093 foreach( $topic_tags as $term ) { 3094 $terms[] = $term->name; 3095 } 3096 $terms = !empty( $terms ) ? implode( $sep, $terms ) : ''; 3097 3098 return apply_filters( 'bbp_get_topic_tags', $terms, $topic_id ); 3099 } 3100 3071 3101 /** Autoembed *****************************************************************/ 3072 3102
Note: See TracChangeset
for help on using the changeset viewer.