MyBB Community Forums

Full Version: Tag System - Delete or edit tags
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How to delete or edit tags using Tag System plugin?
Assuming you mean this 'Tag System', you can edit the tags in your mySQL (or other type) database, under the table your_prefix_tags. When you install the plugin, it creates a table titled tags (and shown in the code of systemtag.php).

		$db->query("CREATE TABLE IF NOT EXISTS `".TABLE_PREFIX."tags` (
  `aid` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
  `tid` int(10) NOT NULL,
  `tags` text NOT NULL,
  PRIMARY KEY (`aid`)
) ENGINE=MyISAM;");

Good luck. Smile
Thanks you very much could you please tell me how to create an option to for this in the template so that admin or moderator can edit it using moderation system
Ah!

So you wanted to create something that will allow staff members to edit the tags?

If it's not already implemented into the plugin - you'll need to add something yourself. Something that would allow you to input the new tags for that thread id then create a function like:

function mod_action_tags(&$thread) {
	global $tid, $db, $mybb;
		$db->delete_query("tags", "tid='$tid'"); // Deletes pre-existing tags
		$stags = strip_tags($mybb->input['tags']); // Gets new tags as specified (&tags=)
		$tagsht = htmlspecialchars_uni($stags); // Validates tags
		$searchcodes = explode(",", $mybb->input['systemtag_disablecodes']); // Seperates tags by ','
		$rtags = str_replace($searchcodes, " ", $tagsht); // Validates tags
		$rtagsp_br = preg_replace("/\r\n|\r/", " ", $rtags); // Validates tags
		$tags = trim($rtagsp_br); // Validates tags
		$explode = explode(",", $tags); // Validates tags
		$array = array(); // Creates array
		foreach($explode as $tag) // For each tag
		{
			if(strlen($tag) >= 4) // If tag length is longer or equal to 4
			{	
				$array[] = $tag; // Set tag in array
			}
		}
		$insert = implode(", ",$array); // Puts tags together
		$insert = $db->escape_string($insert);
		$inserttags = array(
			"tid" => $thread->tid,
			"tags" => $insert
		);	
		$aid = $db->insert_id(); 
		$db->insert_query("tags", $inserttags); // Inserts tags
}

Note this is a very rough function made by the functions used in the systemtags.php.
Buddy thanks very much look like you know a lot about PHP could you please help me to create a plugin like this one: http://community.mybb.com/thread-150845.html