![]() |
Approved MyBB - Find Users with 0 Posts - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Design (https://sinister.ly/Forum-Design) +--- Forum: Web Design (https://sinister.ly/Forum-Web-Design) +--- Thread: Approved MyBB - Find Users with 0 Posts (/Thread-Approved-MyBB-Find-Users-with-0-Posts) |
MyBB - Find Users with 0 Posts - Sapientia - 08-24-2013 Property of Sapientia from Discussion Zone. Hey guys! I made a little script that will pull right from the database, and tell you how many users on your forum have no posts(0) which will let you know if your forum is inactive or active! For our first step, we are going to create a configuration file with the database details in it for our PDO statement. Make a file called DatabaseConfig.php, and here is what I use: Code: <?php This will configure our database details so that we can call them from the PDO statements. Next create a page called 'PostCount.php' and lets go step by step with this. First, what we are going to do is put down our basic opening and closing tags, and then require the config file like so: Code: <?php Next, we are going to get the total number of users on your forum, then get the number of users with 0 posts using two simple queries like so. Code: <?php Next, lets echo the statements telling us how many users we have, and how many have 0 posts, and how many active users we have like this: Code: echo "<h1>There are: " . $PostCountResult . " users with only 0 posts.</h1>" Here is the whole code, and what the web page should look like! Code: <?php Spoiler: RE: MyBB - Find Users with 0 Posts - Blue - 08-24-2013 wow nice Sap. This should be pretty useful for myBB forum owners! RE: MyBB - Find Users with 0 Posts - Sapientia - 08-24-2013 I used it with Code Community when I wanted to see the inactive users. RE: MyBB - Find Users with 0 Posts - Blue - 08-24-2013 (08-24-2013, 05:05 AM)Sapientia Wrote: I used it with Code Community when I wanted to see the inactive users. Oh okay cool. Didn't ever know you did. RE: MyBB - Find Users with 0 Posts - Harvey - 08-24-2013 Good stuff mate. I'm assuming this is what user pruning is based on. RE: MyBB - Find Users with 0 Posts - Sapientia - 08-24-2013 Maybe something like this, but a lot more advanced. I may make a tutorial on how to do that with a custom script :3 RE: MyBB - Find Users with 0 Posts - Eclipse - 08-24-2013 Nice! This will be useful for many mybb forum owners. Whether the forum is big or small. RE: MyBB - Find Users with 0 Posts - Cyan - 08-24-2013 Nice shit bro hoe ![]() lol but nice very very nice ![]() RE: MyBB - Find Users with 0 Posts - Banadmin - 08-24-2013 Nice post but.. Code: SELECT * FROM `mybb_users` WHERE `postnum` = 0 Code: SELECT username FROM `mybb_users` WHERE `postnum` = 0 In SQL via PHPMyAdmin. ![]() RE: MyBB - Find Users with 0 Posts - Sapientia - 08-24-2013 I know you can do that, but this will show the total number of users, the total number of inactive, and active users on a page with text. |