Re: Adding topic tags after topic creation?
@r-a-y @mercime I just got this from @Brajesh and it is working great! Thank you both so much for your help with this.
Add this to the buddypress/bp-groups.php, around line 476, in addition to the above suggested add (this is a core change, not a theme change):
`
//add this
if(!empty($_POST[“topic_tags”]))
bb_add_topic_tags($topic_id,$_POST[“topic_tags”]);//add the new tags
//end add
do_action( ‘groups_edit_forum_topic’, $topic_id );
bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . ‘forum/topic/’ . $topic_slug . ‘/’ );
}
`
Also, just for reference, here is the function I added to the functions.php to get the tags to go in a row. (associated with the code I posted above)…
`
//topic tags as row
function bb_row_tags( $args = null ) {
$defaults = array(
‘tags’ => false,
‘format’ => ‘row’,
‘topic’ => 0,
);
$args = wp_parse_args( $args, $defaults );
extract( $args, EXTR_SKIP );
if ( !$topic = get_topic( get_topic_id( $topic ) ) ) {
return false;
}
if ( !is_array( $tags ) ) {
$tags = bb_get_topic_tags( $topic->topic_id );
}
if ( !$tags ) {
return false;
}
$r = ”;
switch ( strtolower( $format ) ) {
case ‘row’ :
default :
$args = ‘row’;
foreach ( $tags as $tag ) {
$r .= _bb_row_tag_item( $tag, $args );
}
break;
}
echo $r;
}
function _bb_row_tag_item( $tag, $args ) {
$url = esc_url( bb_get_tag_link( $tag ) );
$name = esc_html( bb_get_tag_name( $tag ) );
if ( ‘row’ == $args ) {
$id = ‘tag-‘ . $tag->tag_id . ‘_’ . $tag->user_id;
return “t” . ‘‘ . $name . ‘‘ . “n”;
}
}
`