Browse Source

Add various poll-related actions to the mod log (fixes #1277)

Signed-off-by: Michael Eshom <[email protected]>
Michael Eshom 10 years ago
parent
commit
bbf51bdeef
2 changed files with 32 additions and 0 deletions
  1. 24 0
      Sources/Poll.php
  2. 8 0
      Themes/default/languages/Modlog.english.php

+ 24 - 0
Sources/Poll.php

@@ -280,6 +280,8 @@ function LockVoting()
 		)
 	);
 
+	logAction(($voting_locked ? '' : 'un') . 'lock_poll', array('topic' => $topic));
+
 	redirectexit('topic=' . $topic . '.' . $_REQUEST['start']);
 }
 
@@ -885,6 +887,25 @@ function EditPoll2()
 
 	call_integration_hook('integrate_poll_add_edit', array($bcinfo['id_poll'], $isEdit));
 
+	/* Log this edit, but don't go crazy.
+		Only specifically adding a poll	or resetting votes is logged.
+		Everything else is simply an edit.*/
+	if (isset($_REQUEST['add']))
+	{
+		// Added a poll
+		logAction('add_poll', array('topic' => $topic));
+	}
+	elseif (isset($_REQUEST['deletevotes']))
+	{
+		// Reset votes
+		logAction('reset_poll', array('topic' => $topic));
+	}
+	else
+	{
+		// Something else
+		logAction('editpoll', array('topic' => $topic));
+	}
+
 	// Off we go.
 	redirectexit('topic=' . $topic . '.' . $_REQUEST['start']);
 }
@@ -980,6 +1001,9 @@ function RemovePoll()
 	// A mod might have logged this (social network?), so let them remove, it too
 	call_integration_hook('integrate_poll_remove', array($pollID));
 
+	// Log this!
+	logAction('remove_poll', array('topic' => $topic));
+
 	// Take the moderator back to the topic.
 	redirectexit('topic=' . $topic . '.' . $_REQUEST['start']);
 }

+ 8 - 0
Themes/default/languages/Modlog.english.php

@@ -100,4 +100,12 @@ $txt['modlog_ac_close_report'] = 'Closed {report} on &quot;{message}&quot;';
 $txt['modlog_ac_ignore_report'] = 'Disregarded {report} on &quot;{message}&quot;';
 $txt['modlog_ac_open_report'] = 'Reopened {report} on &quot;{message}&quot;';
 $txt['modlog_ac_unignore_report'] = 'Undone disregard of {report} on &quot;{message}&quot;';
+
+// Poll stuff
+$txt['modlog_add_poll'] = 'Added a poll to &quot;{topic}&quot;';
+$txt['modlog_edit_poll'] = 'Edited the poll in &quot;{topic}&quot;';
+$txt['modlog_lock_poll'] = 'Locked voting in the poll in &quot;{topic}&quot;';
+$txt['modlog_remove_poll'] = 'Removed the poll from &quot;{topic}&quot;';
+$txt['modlog_reset_poll'] = 'Reset votes in the poll in &quot;{topic}&quot;';
+$txt['modlog_unlock_poll'] = 'Unlocked voting in the poll in &quot;{topic}&quot;';
 ?>