Helpful PHP Script for Topic Review
Just wanted to share a PHP script here in case anyone else finds this useful.
My forum is growing rapidly thanks to wpForo and I was having trouble keeping up on all of the Topics using the email notifications. Some would get buried in my inbox.
So, I came up with a method to ensure that I keep up with every Topic. My rule is that, if I'm the most recent person to reply to a Topic or if I "liked" the most recent reply to a Topic, then I don't need to look at that Topic. If someone later replies to that Topic, then it needs to appear on my list of Topics to review for me to either reply to or "like" the most recent reply.
My list of Topics that I need to address is displayed using a PHP script. This is basically the queue that I work off of.
The PHP script is included below. If you want to use it, you need to replace the following:
- MyUser: Your database user
- MyPassword: Your database password
- MyDatabase: Your database name
- MyWebsite: Your website
- MywpForoPath: The path to your wpForo forum
- 5: The number 5 appears two times and it's my userid in the database (replace 5 in both places with your userid)
$mysqli = new mysqli("localhost", "MyUser", "MyPassword", "MyDatabase");
$posts = $mysqli->query("SELECT p.postid,p.created 'postcreated',pu.display_name 'postuser',t.topicid,t.created 'topiccreated',tu.display_name 'topicuser',t.title 'topictitle',CONCAT('https://www.MyWebsite.com/MywpForoPath/',f.slug,'/',t.slug) 'URL' FROM wp_tmee_wpforo_topics t JOIN wp_tmee_wpforo_posts p ON t.last_post=p.postid AND (SELECT COUNT(*) FROM wp_tmee_wpforo_likes WHERE postid=p.postid AND userid=5)=0 JOIN wp_tmee_wpforo_forums f ON t.forumid=f.forumid JOIN wp_tmee_users pu ON p.userid=pu.ID JOIN wp_tmee_users tu ON t.userid=tu.ID WHERE p.userid<>5 ORDER BY p.postid");
<table border='1' cellpadding='10' cellspacing='0'>
$counter = 1;
while($row = mysqli_fetch_array($posts))
echo "<td>" . $counter . "</td>";
echo "<td>" . $row['postid'] . "</td>";
echo "<td>" . $row['postcreated'] . "</td>";
echo "<td>" . $row['postuser'] . "</td>";
echo "<td>" . $row['topicid'] . "</td>";
echo "<td>" . $row['topiccreated'] . "</td>";
echo "<td>" . $row['topicuser'] . "</td>";
echo "<td>" . $row['topictitle'] . "</td>";
echo "<td><a href='".$row['URL']."' target='_blank'>click for post</a></td>";
Thank you for sharing this script.
In case you want to say thank you !)
We'd really appreciate and be thankful if you leave a good review on plugin page. This is the best way to say thank you to this project and support team.