Changeset 4166 for branches/plugin/bbp-includes/bbp-topic-functions.php
- Timestamp:
- 08/21/2012 07:11:11 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.