Skip to:
Content

BuddyPress.org

Opened 15 years ago

Closed 14 years ago

Last modified 13 years ago

#2281 closed enhancement (fixed)

Missing Tags input field in Edit Forum Topic Page

Reported by: mercime's profile mercime Owned by:
Milestone: 1.5 Priority: normal
Severity: Version:
Component: Groups Keywords:
Cc:

Description

More often than not, users forget to add Tags to their forum posts. When they try to edit the forum topic to add the tags, there is no field to add the tags.
http://trac.buddypress.org/browser/trunk/bp-themes/bp-default/groups/single/forum/edit.php

Request to add the tags field to above edit.php
`<label><?php _e( 'Tags (comma separated):', 'buddypress' ) ?></label>
<input type="text" name="topic_tags" id="topic_tags" value="" />`
Reference: Tags field from http://trac.buddypress.org/browser/trunk/bp-themes/bp-default/groups/single/forum.php

Tested this and it's working well in WPMU 2.9.2 and BP 1.2.3

Change History (17)

#1 follow-up: @DJPaul
15 years ago

  • Type changed from defect to enhancement

#2 in reply to: ↑ 1 @dwenaus
14 years ago

Replying to DJPaul:
it seems to me that this is a defect, albeit a minor one.

#3 @DJPaul
14 years ago

  • Milestone changed from 1.2.4 to 1.3

It's a enhancement because the code to do this isn't in BuddyPress at the moment, so it's a new feature. 1.2.4 is mainly a compatibility release for WordPress 3.0, and BuddyPress 1.3 won't be too far behind that, so marking this for 1.3 as it's a new feature.

#4 @pisanojm
14 years ago

Would have loved to see this in 1.2.6 (enhancement or defect). The more I use BP the more I realize this gapping hole... Please ping me when there is a patch/mod to try and I will be very eager and quick to patch it. Thanks all.

#5 @mercime
14 years ago

No surprise revised edit.php still working in BP 1.2.5.2 and WP 3.0.1

#6 @pisanojm
14 years ago

The above code worked to add the input line in the edit.php:
`<div id="edit-topic">

<?php do_action( 'bp_group_before_edit_forum_topic' ) ?>

<p><strong><?php _e( 'Edit Topic:', 'buddypress' ) ?></strong></p>

<label for="topic_title"><?php _e( 'Title:', 'buddypress' ) ?></label>
<input type="text" name="topic_title" id="topic_title" value="<?php bp_the_topic_title() ?>" />

<label for="topic_text"><?php _e( 'Content:', 'buddypress' ) ?></label>
<textarea name="topic_text" id="topic_text"><?php bp_the_topic_text() ?></textarea>

<?php do_action( 'bp_group_after_edit_forum_topic' ) ?>
<!-- HERE IS WHERE I ADDED ABOVE -->
<label><?php _e( 'Add Additional Tags (comma separated):', 'buddypress' ) ?></label>

<input type="text" name="topic_tags" id="topic_tags" value="" />`

However, the tags themselves did not save after clicking "save changes".

The following change to, bp-groups.php fixed the issue with saving the new and newly added tags for me:

`add this

if(!empty($_POSTtopic_tags?))

bb_add_topic_tags($topic_id,$_POSTtopic_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 . '/' );

}

`

You can see this discussion here:
http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/adding-topic-tags-after-topic-creation/

Thanks to @r-a-y @mercime and @brajesh

#7 @boonebgorges
14 years ago

I definitely want to see this in 1.3. Can anyone test these changes against the trunk? They look like they should be fine, but verification would be nice.

#9 @r-a-y
14 years ago

While the current, proposed solution is a simple code addition, I'm not a fan of it as it doesn't follow BP's own code conventions.

I'm about to attach a patch, but was wondering if a user should be able to add topic tags from the edit forum post screen as well (apart from the edit topic screen).

#10 @boonebgorges
14 years ago

r-a-y - I agree that the real solution should hew closer to BP's code standards. I was planning on revising the patches above (probably wrapping them in a BP function or two) before committing them. But I would be tickled pink if you did it instead ;)

The ability to edit tags from the edit post screen seems like a nice touch, if it's not too hard to do.

#12 @dubcheck
14 years ago

Well, I came across the same issue but just adding tags is not sufficient for my scenario. Please review this - it's a patch to allow adding, removing and changing tags for a forum topic. (These two code snippets are all you need, none of the other patches is required.) I copied some context to allow orientation in the files, all changes are between 'patch' and 'end patch' comments.

First add this to your template 'groups/single/forum/edit.php':

<textarea name="topic_text" id="topic_text"><?php bp_the_topic_text() ?></textarea>

<!-- 2011-01-18 enbiz Gerd Stammwitz: Patch to edit topic tags -->
<?php
  // Get list of existing tags for this topic
  $arrayOfTags=bb_get_topic_tags(bp_get_the_topic_id());
  $tags="";
  foreach ($arrayOfTags as $tag){$tags.=($tags==""?"":", ").$tag->name;}
?>
<label for="topic_tags"><?php _e( 'Tags (comma separated):', 'buddypress' ) ?></label>
<input type="text" name="topic_tags" id="topic_tags" value="<?php print $tags; ?>" />
<p></p>
<!-- End Patch -->

<?php do_action( 'bp_group_after_edit_forum_topic' ) ?>

Then you have to patch 'plugins/buddypress/bp-groups.php':

function groups_screen_group_forum() {
// skipped ..

  if ( !groups_update_group_forum_topic( $topic_id, $_POST['topic_title'], $_POST['topic_text'] ) )
    bp_core_add_message( __( 'There was an error when editing that topic', 'buddypress'), 'error' );
  else
    bp_core_add_message( __( 'The topic was edited successfully', 'buddypress') );

// -- 2011-01-18 enbiz Gerd Stammwitz
// -- Patch: Added Functionality to save topic tags
if (isset($_POST["topic_tags"]))
{
  // Remove ALL tags from topic
  bb_remove_topic_tags($topic_id);
  // Add tags from input field
  bb_add_topic_tags($topic_id,$_POST["topic_tags"]);
}
// End Patch

  do_action( 'groups_edit_forum_topic', $topic_id );

The first snippet adds an input field to your edit form and fills it with the currently set tags. The second code is a patch for the save handler (which is triggered when you save your tags): it removes all current tags and sets the (new) tags from the input field.

Please add this functionality (not necessarily this code) to BP - it is really important!

#13 @boonebgorges
14 years ago

(In [4147]) Adds tag editing field to Topic Edit screen. References #2281

#14 @boonebgorges
14 years ago

Shit, I forgot to give props to dubcheck in that commit - I used a line of your code. Props anyway!!

Last edited 14 years ago by boonebgorges (previous) (diff)

#15 @boonebgorges
14 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [4149]) Modifies bp_forum_topic_tag_list() to use tag data from the topic_template global. Displays the topic tags underneath the topic title on the single topic page. Fixes #2281

#16 @Sadr
14 years ago

Could this be bumped to a 1.2 enhancement release instead of 1.3? The tags functionality has been practically nothing but a mock feature for the past year; I'd hate to see such an important fix risk not seeing the light of day for another few months, considering the impact it could have on our BuddyPress-powered (forum-centric) site.

#17 @dwenaus
13 years ago

nice to see this got some traction. scratch that request of mine to add it to 1.2 - it looks like the codebase is totally new following 1.3, bp-forums is totally reorganized.

Last edited 13 years ago by dwenaus (previous) (diff)
Note: See TracTickets for help on using tickets.