MyBB Central

Full Version: [Plugin] View Member Reported Posts
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Plugin Name: View Member Reported Posts
Plugin Author: xerotic
Plugin Version: 1.0
Plugin Updates: 0
Plugin Description: This plugin lets users view any member's reported posts. Accessed from the member's profile page.

Specifics:
-Creates a new field under 'Reputation' on profiles that links to the page. Link is the number of reports that member has
-You can specify which groups have access to this plugin
-You can easily allow all usergroups access
-Default only admins have access (Usergroup 4)
-Displays post name with link
-Displays reported reason
-Displays moderation status
-Displays date reported

Installation:

1. Upload the file from the ZIP to your plugin directory.

2. Login to AdminCP and activate the plugin via the Plugin Manager (View Member Reported Posts)

3. Utilize plugin.

--Previews--

[attachment=2070]
[attachment=2069]
[attachment=2071]

--Note--

Please alert me with any problems that you may have.


Thanks,
xerotic
I'll check it out, thanks again!
Thanks for this great plugin.
Not bad. I like your settings input array setup. I might use it for large plugins with many settings.

I'd change your $_GET to $mybb->input. It will work fine and in case MyBB adds sanitizing or other functions to input() you will be built in.

This query seems wrong too.

$query = $db->query("
SELECT ".TABLE_PREFIX."reportedposts.pid, ".TABLE_PREFIX."reportedposts.reportstatus, ".TABLE_PREFIX."reportedposts.reason, ".TABLE_PREFIX."reportedposts.dateline, ".TABLE_PREFIX."posts.subject
FROM ".TABLE_PREFIX."reportedposts INNER JOIN ".TABLE_PREFIX."posts ON ".TABLE_PREFIX."reportedposts.pid = ".TABLE_PREFIX."posts.pid
WHERE ".TABLE_PREFIX."reportedposts.uid='".$uid."'
ORDER BY dateline DESC
");

At least it's long winded.


This should use simple_select().

$query = $db->query("
SELECT uid
FROM ".TABLE_PREFIX."reportedposts
WHERE uid='".$uid."'
");


$query = $db->simple_select("reportedposts", "uid", "uid='{$uid}'");

which btw reviewing it..it doesn't make sense. It's only grabbing the uid but it already knows the uid.

Function needs a rewrite:

function your_reported_posts_profile()
{
global $numReportsPosts,$uid,$db;
$query = $db->simple_select("reportedposts", "uid", "uid='{$uid}'");
$numReportsPosts = $db->num_rows($query);
}
My goodness, Jesse. You're amazing at PHP.
Updated plugin. Now you can allow users to only view their own posts, plus a setting to allow certain usergroups (like admins/super mods) to bypass the above setting.

--

@labrocca
Do you mind if I use some of that code in the next version update? Just now noticed your post as I was updating for version 1.1.

As for the first query.. I used full table names. Probably should condense them to simpler names. Such as 'reportedposts' to 'r'.

For the input, definitely, didn't think of that.

For the second query, I just count all of the rows with that UID so I can get a count of how many reported posts to display on their profile. Should change to a simple_select though.

Thanks for taking the time to write such a response though, I really appreciate it.
I sure hope this gets implemented on a forum I'm thinking of Wink
(Nov 26, 2011, 07:20 PM)alabama Wrote: [ -> ]I sure hope this gets implemented on a forum I'm thinking of Wink

Let me guess....HF?


                
Thank you xerotic, you're always releasing great scripts and plugins.
This one is going to go to good use, reputation has been given. Smile
Thanks, well needed plugin
Pages: 1 2