By Alex Lee on Friday, 23 January 2015
Posted in Technical Issues
Likes 0
Views 687
Votes 0
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>";
}
}
Hello Alex,

Ah, perhaps you could run some some sql queries to actually pickup all those posts that are posted into the respective categories into the respective tags instead? It would be a little tedious though but if your being paid well, doesn't matter
·
Saturday, 24 January 2015 04:06
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Alex,

I am really sorry for the delay of this reply as it is a weekend for us here. Unfortunately there's no way to "mass assign" tags currently If you really need to, perhaps you could do this via phpmyadmin? It should be added in the table #__discuss_post_tags
·
Saturday, 24 January 2015 03:38
·
0 Likes
·
0 Votes
·
0 Comments
·
hahah Delay??? you guys rock! don't worry its should be the weekend for me also, guess we're all workaholic's

ah phpadmin sounds like a god idea, but i need to do it the other way round, my client wants to turn the subcatergorys in to tags, so all of the discussions under the sub catergory lets say "Vaccine logistics" needs to now be add to the tag Vaccine Logistics lol,

Talk about making my life complicated...
·
Saturday, 24 January 2015 03:54
·
0 Likes
·
0 Votes
·
0 Comments
·
haha good idea. hmm need to figure out how to ok, Thanks man Appreciate the great support.

Best
·
Sunday, 25 January 2015 21:31
·
0 Likes
·
0 Votes
·
0 Comments
·
No problem Alex
·
Monday, 26 January 2015 02:09
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post