Commit 25944ac5 authored by Tristan Olive's avatar Tristan Olive

Bypass user_access check on boincuser_moderation_queue_count() when calling...

Bypass user_access check on boincuser_moderation_queue_count() when calling from cron (this may be preventing notifications from being sent to moderators, as the function is returning NULL, suggesting to cron that there are no items in the queue)

(DBOINCP-102)
parent c6bdf295
......@@ -165,7 +165,7 @@ function boinccore_enable() {
*/
function boinccore_cron() {
// Notify moderators if there is site content that requires moderator action
$items_in_queue = boincuser_moderation_queue_count();
$items_in_queue = boincuser_moderation_queue_count('cron');
$last_notification = variable_get('boinccore_last_content_moderation_reminder', 0);
if ($items_in_queue AND $last_notification < time() - 24*60*60) {
global $base_url;
......
......@@ -1351,8 +1351,17 @@ function boincuser_moderate_community_access() {
/**
* Get the count of items in the moderation queue
*/
function boincuser_moderation_queue_count() {
if (user_access('edit any profile content')) {
function boincuser_moderation_queue_count($caller = 'user') {
$allowed = FALSE;
switch ($caller) {
case 'cron':
$allowed = TRUE;
break;
case 'user':
default:
$allowed = user_access('edit any profile content');
}
if ($allowed) {
return db_result(db_query("
SELECT COUNT(*)
FROM {node}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment