<?php/**
* Delete all tags for a given content object
*///allow only the app owner to delete tags from any object
if (!XN_Profile::current()->isOwner()) {
$signInUrl=XN_Request::signInUrl();echo'Not allowed <a href="'.$signInUrl.'" >Sign in</a> if you are the owner of this app.';die();
}
?><formaction=""method="POST">
Object Id:<inputtype="text"name="object_id"/><inputtype="submit"value="Delete All Tags"/></form><?phpif ($_SERVER['REQUEST_METHOD'] =='POST') {
$content=XN_Content::load($_REQUEST['object_id']);$tagQuery=XN_Query::create('Tag');$tagQuery->filter('content','=', $content);$tagsQueryResults=$tagQuery->execute();$tags=array();foreach($tagsQueryResultsas$tag){
//add quotes tothe tags to ensure the full value is considered
$tags[] ='"'.$tag->value.'"';;
}
$tagString=implode(', ',$tags);echo'<p>Content '.$content->id.' had the following tags: '.htmlentities($tagString).'</p>';XN_Tag::deleteTags( $content , $tagString);echo"<p>They are history.</p>";
}
?>