PDA

View Full Version : Modifying reportpost_newthread phrase to show moderator User IDs


tambo
04-29-2012, 11:15 AM
Hi there,

Is it possible to change the "reportpost_newthread" phrase in a way that will show the assigned moderator's User IDs?

Currently, the phrase is:


]$reportinfo[rusername] ($reportinfo[reporterlink) has reported a post.

Reason:$reportinfo[reason]
Post: ]$reportinfo[prefix_plain]$reportinfo[threadtitle] ($reportinfo[postlink)
Forum: $reportinfo[forumtitle]
Assigned Moderators: $reportinfo[modlist]

Posted by: ]$reportinfo[pusername] ($reportinfo[posterlink)
Original Content: $reportinfo[pagetext]



Can the Assigned Moderators: $reportinfo[modlist] part be modified to either link to the specific moderators profile, or simply display their User ID?

So the reported post would read:

Assigned Moderators: Mod1 (1234), Mod2 (5678), Mod3 (9101)
or
Assigned Moderators: Mod1 (http://www.google.com), Mod2 (http://www.google.com), Mod3 (http://www.google.com)


Any ideas?

kh99
04-29-2012, 12:58 PM
There's no way to simply edit the phrase, you'd need a plugin. If you look at file includes/class_reportitem.php around line 194 you can see how the list is built, and at the same time an array called $mods is built with all the moderator info. So you could write a plugin using hook location report_do_report (which is called just after the array is built) which rebuilds $reportinfo['modlist'] using the info in the $mods array to include the moderator id.

The code could be something like:

if (!empty($mods))
{
$reportinfo['modlist'] = '';
foreach ($mods AS $moderator)
{
$reportinfo['modlist'] .= (!empty($reportinfo['modlist']) ? ', ' : '') . unhtmlspecialchars($moderator['username']) . ' (' . $moderator['userid'] . ')';
}
}

tambo
04-29-2012, 01:54 PM
Thank you for your response. It's much appreciated, as is the clarity.

I suspected that it wouldn't be as easy as I'd hoped and that it would require some sort of 'under the hood' tweaking.

That's fine. Honestly, it's probably a little beyond my current technical skill and understanding, but it does give me a discrete project on which to build and improve those skills, along with some guidance of how the end product might work.

That's valuable information for any learner, so thanks again.

kh99
04-29-2012, 01:57 PM
Well, you could just try to add a new plugin using hook location report_do_report and the code from above. I haven't actually tried it but with a little luck it should work.

If you're not familiar with creating a plugin, you can search for "Adding or Editing a Plugin" in the vbulletin manual: https://www.vbulletin.com/docs/html/ (it's really not very difficult).

tambo
04-29-2012, 02:17 PM
It works!

Excellent. Now I just need to understand what the hell I (you) just did. Haha! :D

My PHP skills really are abysmal, but you've got to start somewhere.

Many, many thanks. :up: