View Full Version : Edited Post Note Conditional
broncoshq
06-15-2014, 04:10 AM
Hi There.
One rule on our forum is that discussion of moderation decisions must be discussed in a private forum between us and the user.
We want to add a line under the edited post information, but only if an admin has edited the post, not when a member edits their own post.
Is this possible?
Of course it's possible, but probably requires a plugin. I think one issue is that the editlog table has the userid and username of the user that edited the post, but not the usergroup, so you'd either need to look that up or else modify that table to include the usergroup (and maybe a column for the text for your second line, if you need that). Then you could probably just have a vb:if in the template to check the usergroup and display your line if needed.
broncoshq
08-15-2014, 09:39 AM
Does anyone know if such a plugin exists. That is certainly well out of my element!
nerbert
08-16-2014, 03:14 AM
If you can do the appropriate template conditionals you can use boolean $post['edited_by_mod']
with this plugin code
if($post['edit_username'] != '')
{
$edited_by = $this->registry->db->query_first("
SELECT CONCAT(usergroupid, ',', membergroupids) AS groups
FROM " . TABLE_PREFIX . "user
WHERE username = '" . $this->registry->db->escape_string(htmlspecialchars_uni($post['edit_username'])) . "'
");
$post['edited_by_mod'] = (
in_array(5, array($edited_by['groups'])) OR
in_array(6, array($edited_by['groups'])) OR
in_array(7, array($edited_by['groups']))
);
}
in hook location postbit_display_complete
It returns true (1) for moderators (group 7) admins (group 6) and super moderators (group 5)
broncoshq
08-16-2014, 03:15 PM
Awesome thanks for your help.
nerbert
08-16-2014, 03:37 PM
If you don't want to mess with editing templates and template conditionals you could put a message right in the plugin.
Add some code like this at the bottom of the plugin
if($post['edited_by_mod'])
{
$post['edit_reason'] .= " To complain about this edit, post a thread in the Whine Pout and Complain forum";
}
broncoshq
08-17-2014, 10:32 AM
If you don't want to mess with editing templates and template conditionals you could put a message right in the plugin.
Add some code like this at the bottom of the plugin
if($post['edited_by_mod'])
{
$post['edit_reason'] .= " To complain about this edit, post a thread in the Whine Pout and Complain forum";
}
Where would I put that, sorry?
nerbert
08-17-2014, 01:30 PM
Just paste that in at the bottom of the plugin code I posted earlier with your own message text.
I assume you just want a generic message like that.
broncoshq
09-06-2014, 02:13 PM
Just paste that in at the bottom of the plugin code I posted earlier with your own message text.
I assume you just want a generic message like that.
Sorry about the late reply. Thank you very much for your help. It's working well. Is there anyway to only have the message show up with a staff member edits another member?
The message still displays when a staff member edit's their own posts.
nerbert
09-06-2014, 07:00 PM
Change the first line of the plugin to read
if($post['edit_username'] != '' AND $post['edit_username'] != $vbulletin->userinfo['username'])
broncoshq
09-07-2014, 02:03 AM
Change the first line of the plugin to read
if($post['edit_username'] != '' AND $post['edit_username'] != $vbulletin->userinfo['username'])
You're awesome. Thanks so much for your help.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.