Skip to:
Content
Pages
Categories
Search
Top
Bottom

Adding topic tags after topic creation?

  • @rossagrant

    Participant

    Is this possible? There are topics with no tags that I would like to tag.
    Can I do this?

Viewing 12 replies - 1 through 12 (of 12 total)
  • @nuprn1

    Participant

    forgotten oversight in the templates/bp – sure it is possible if you dig deep into bbpress code for the proper function

    @rossagrant

    Participant

    @nuprn1 Cheers Rich, probably a bit out of my league but I’m sure this will get revised in the next release won’t it?

    @nuprn1

    Participant

    https://trac.buddypress.org/ticket/2281

    FWIW – the bbpress function name is bb_add_topic_tags (look at tag-add.php and functions.bb-template.php tag_form() )

    @pisanojm

    Participant

    I would love the ability for my moderators to add tags to already posted forum topics… Most people that are starting on our BuddyPress site (educators) have never really dealt with folksonomy (tags). This is a TOP needed BP core function.

    @pisanojm

    Participant

    @nuprn1 @r-a-y

    Asking for ideas of how/where could/should I use this code to accomplish the inputting of tags after a topic was created (specifically for users that did not put any in in the first place)? Would like to make it so a moderator/above could do it… From above trac:

    `
    `

    @r-a-y

    Keymaster

    @pisanojm – You should try inputting this in the edit forum post template:
    bp-default/groups/single/forum/edit.php

    Give it a shot!

    @pisanojm

    Participant

    @r-a-y

    Thanks and no-doubt the right file… Here is what I have:

    `


    <input type="text" name="topic_title" id="topic_title" value="” />




    <?php
    $ttags = bb_get_topic_tags( bp_get_the_topic_id() );
    if ( $ttags ) : ?>

    <?php printf(__('

    No tags added…

    ‘), bp_get_forum_directory_permalink() . ‘/#tags’ ); ?>

    <input type="submit" name="save_changes" id="save_changes" value="” />

    `

    Everything appears as it should… the box for the tag entry appears appears, BUT when I put tags in and click SAVE CHANGES -iit does not save them….

    Here is a Pict:
    http://mustech.net/holder/addtags.jpg

    @r-a-y

    Keymaster

    @pisanojm – Just looked into this… there’s a bit of patching that needs to be done across multiple files to get topic tags on the edit screen working.

    I’ve got a preliminary version working on my testbox. Will add a patch in the next day or so. Stay tuned on Trac!

    @pisanojm

    Participant

    @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”;
    }
    }
    `

    @mercime

    Participant

    @pisanojm 10-4 good news indeed :-)

    @spinhead

    Participant

    @Pisanojm in your tags-to-row function, the return t and n just seem to write the letters t and n before and after the tag. I can’t find anything in the function where these might be variables meaning something else. I’d think you’d just want a separator there.

    What did I miss?

    @pisanojm

    Participant

    @spinhead I didn’t program the function, but it was made for bbpress originally, I just hacked it together into something that worked for buddypress… That being said I may have omitted something above.

    My original post on buddypress.org included a link to the pastebin that I created here (makes sure to read the comments I put in as it is pasted together into one file):

    http://pastebin.com/fvM6LEnp

    Here is the original thread on buddypress…
    https://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/forum-topic-tags/?topic_page=1&num=15

    It is kind of crazy how hard it it to get the topic tags to appear as a row… this integration works for me.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Adding topic tags after topic creation?’ is closed to new replies.
Skip to toolbar