UPDATES EasyBlog 6.0.11 Released! Update to the latest version now!

Helpdesk

Your Time
Our Time
Response Time
24 — 48 hours
We strive to provide the fastest ever response possible. However, we are not super beings.

Allow at least 24 — 48 hours
  Support is offline
It is currently off working hours and most of us aren't around

Rest assured that we will get back to you as soon as the day starts tomorrow!
  Support is offline

Is there a way to mass add discussions to tags?

Alex Lee · ·
11:24 PM Friday, 23 January 2015
None
How's it going guys, So i've just moved from Kunana over to EasyDiscuss loving the ease that was. to migrate thanks for making my life easier.

Any how, now that i've got the Tagging system in place i'm looking to add my discussions to each relevent Tag, i've got over 2k discussions and it would be a seirous waste of time for me if i need to go into each discussion one by one to add the tag.

Make any sence O.o

Best

Quick edit: i manged by doing this i figured out the link between the catergorys and tags and then mappend them

//Query Gets Posts IDs where the posts Categroy ID and Category ID are the same
$PostID = "SELECT at6ln_discuss_posts.id
FROM at6ln_discuss_posts
INNER JOIN at6ln_discuss_category ON at6ln_discuss_posts.category_id = at6ln_discuss_category.id";
$resultPostID= $conn->query($PostID);
//Query Gets catergory ID where the Categroy and Tag Alias is the same
$CategoryID = "SELECT at6ln_discuss_category.id
FROM at6ln_discuss_category
INNER JOIN at6ln_discuss_tags ON at6ln_discuss_category.alias = at6ln_discuss_tags.alias";
$resultCategoryID= $conn->query($CategoryID);
//Query Gets Posts catergory ID where the Categroy and Tag Alias is the same
$PostsCategoryID = "SELECT at6ln_discuss_posts.category_id, at6ln_discuss_category.alias
FROM at6ln_discuss_posts, at6ln_discuss_category
WHERE (at6ln_discuss_posts.category_id = at6ln_discuss_category.id)";
$resultPostsCategoryID= $conn->query($PostsCategoryID);
//Query Gets catergory Alais where the Categroy and Tag Alias is the same
$PostsCategoryAlias = "SELECT at6ln_discuss_category.alias
FROM at6ln_discuss_category
INNER JOIN at6ln_discuss_tags ON at6ln_discuss_category.alias = at6ln_discuss_tags.alias";
$resultPostsCategoryAlias= $conn->query($PostsCategoryAlias);
$sql = 'INSERT INTO at6ln_discuss_posts_tags (post_id,tag_id) VALUES (?,?)';
$stmt = $conn->prepare($sql);
if ($resultTagID->num_rows > 0) {
echo "<table>";
echo "<tr>";
echo "<th> Post ID </th>";
echo "<th> Tag ID </th>";
echo "<th> Post Catergory ID </th>";
echo "</tr>";
// output data of each row
while ($posts = $resultPostID->fetch_assoc()) {
// output data of each row
$category = $resultCategoryID->fetch_assoc();
$postscatID = $resultPostsCategoryID->fetch_assoc();
// output data of each row
$idcategory = $category["id"];
$idposts = $posts["id"];
$idpostcat = $postscatID["category_id"];
if ($idpostcat >= 5){
switch($idpostcat) {
case 5:
$TagID = 10;
break;
case 7:
$TagID = 12;
break;
case 13:
$TagID = 17;
break;
case 14:
$TagID = 18;
break;
case 15:
$TagID = 19;
break;
case 16:
$TagID = 20;
break;
case 27:
$TagID = 29;
break;
case 28:
$TagID = 30;
break;
case 30:
$TagID = 32;
break;
case 34:
$TagID = 35;
break;
case 35:
$TagID = 36;
break;
case 37:
$TagID = 38;
break;
case 38:
$TagID = 39;
break;
case 49:
$TagID = 47;
break;
case 50:
$TagID = 48;
break;
case 52:
$TagID = 50;
break;
case 53:
$TagID = 51;
break;
case 55:
$TagID = 46;
break;

}

$stmt->bind_param('ii', $idposts, $TagID);
$stmt->execute();
echo "<tr>";
echo "<td>" . $idposts . "</td>";
echo "<td>" . $TagID . "</td>";
echo "<td>" . $idpostcat . "</td>";
echo "</tr>";
}
}
The replies under this section are restricted to logged in users or users with an active subscription with us