Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product

Ready to contribute?

Amazing! Sign our contributors' agreement and then join us on GitHub.

Update for critical security issue in PHPMailer included in release Vanilla 2.3.1
Please upgrade to 2.3 here. The 2.2 and earlier branches are no longer being updated.

Tagged error when deleting post

edited December 2010 in Vanilla 2.0 - 2.2
When deleting a post with tags, the number of this tag is not refreshed. For example a post with the tag "board" is deleted, then the number behind the tag "board" is the same.

Comments

  • LincLinc Vanilla's Bard (and Lead Developer) Detroit Vanilla Staff
  • For those who want the fix, just add this to your "class TaggingPlugin extends Gdn_Plugin" definition in class.tagging.plugin.php:


    /** * !!!! TEMPORARY FIX (by sprockett) !!!!! * Reduce counts, Remove tags, and Remove tag-discussion mapping upon deletion of Discussion */ public function DiscussionModel_DeleteDiscussion_Handler($Sender) { //Ensure this gets fired only if Tagging is enabled. if (!C('Plugins.Tagging.Enabled')) return; //Get discussionID that is being deleted $DiscussionID =$Sender->EventArguments['DiscussionID']; //Get List of tags to reduce count for $TagDataSet = Gdn::SQL()->Select('TagID') ->From('tagdiscussion') ->Where('DiscussionID =',$DiscussionID) ->Get(); while ($SingleTag = $TagDataSet->NextRow(DATASET_TYPE_ARRAY)) { $RemovedTagIDs[]=$SingleTag['TagID']; } //Check if there are even any tags to delete if (count($RemovedTagIDs) > 0) { // Step 1: Reduce count Gdn::SQL()->Update('Tag')->Set('CountDiscussions', 'CountDiscussions - 1', FALSE)->WhereIn('TagID', $RemovedTagIDs)->Put(); // Step 2: Delete tag entries from table if they hit zero count. $Sender->SQL->Where('CountDiscussions <=', '0')->Delete('Tag'); // Step 3: Delete mapping data between discussion and tag (tagdiscussion table) $Sender->SQL->Where('DiscussionID', $DiscussionID)->Delete('tagdiscussion'); } }
  • I have uploaded an modifed version of the original Tagging plugin. This addresses the above problem, and adds another feature where you can see tags that belong in one category.

    http://vanillaforums.org/addon/tagging-plugin-1.0.0
Sign In or Register to comment.