MyBB Community Forums

Full Version: Display notice of awaiting moderation posts/threads
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
how can we display the mod cp's awaiting moderation posts/threads as a notice to staff on index page?
Not without a plugin.
I make some changes in file global.php and global.lang.php.

global.lang.php
find
$l['pending_joinrequests'] = "Group Leader Notice: You have {1} pending group membership join requests.";

replace
$l['pending_joinrequests'] = "Group Leader Notice: You have {1} pending group membership join requests.";
$l['awaiting_moderation_post'] = "Moderator Notice: There is 1 awaiting moderation post.";
$l['awaiting_moderation_posts'] = "Moderator Notice: You have {1} awaiting moderation posts.";
$l['awaiting_moderation_thread'] = "Moderator Notice: There is 1 awaiting moderation thread.";
$l['awaiting_moderation_threads'] = "Moderator Notice: You have {1} awaiting moderation threads.";
$l['awaiting_moderation_attachment'] = "Moderator Notice: There is 1 awaiting moderation attachment.";
$l['awaiting_moderation_attachments'] = "Moderator Notice: You have {1} awaiting moderation attachments.";

global.php
find
eval("\$unreadreports = \"".$templates->get("global_unreadreports")."\";");
	}
}

replace
eval("\$unreadreports = \"".$templates->get("global_unreadreports")."\";");
	}
}

$awaiting_moderation = '';
// This user is a moderator, super moderator or administrator
if($mybb->usergroup['cancp'] == 1 || $mybb->user['ismoderator'] && $mybb->usergroup['canmodcp'])
{
	// Unapproved threads
	$query = $db->simple_select("threads", "COUNT(tid) AS unapprovedthreads", "visible=0 {$flist}");
	$unapproved_threads = $db->fetch_field($query, "unapprovedthreads");

	// 0 or more unapproved threads currently exist
	if($unapproved_threads > 0)
	{
		if($unapproved_threads == 1)
		{
			$lang->awaiting_moderation = $lang->awaiting_moderation_thread;
		}
		else
		{
			$lang->awaiting_moderation = $lang->sprintf($lang->awaiting_moderation_threads, $unapproved_threads);
		}
		
		eval("\$awaiting_moderation = \"".$templates->get("global_awaiting_moderation_threads")."\";");
	}
	$unreadreports = $unreadreports . $awaiting_moderation;
	$awaiting_moderation = '';
	
	// Unapproved posts
	$query = $db->query("
		SELECT COUNT(pid) AS unapprovedposts
		FROM  ".TABLE_PREFIX."posts p
		LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
		WHERE p.visible='0' {$tflist} AND t.firstpost != p.pid
	");
	$unapproved_posts = $db->fetch_field($query, "unapprovedposts");

	// 0 or more unapproved posts currently exist
	if($unapproved_posts > 0)
	{
		if($unapproved_posts == 1)
		{
			$lang->awaiting_moderation = $lang->awaiting_moderation_post;
		}
		else
		{
			$lang->awaiting_moderation = $lang->sprintf($lang->awaiting_moderation_posts, $unapproved_posts);
		}
		
		eval("\$awaiting_moderation = \"".$templates->get("global_awaiting_moderation_posts")."\";");
	}
	$unreadreports = $unreadreports . $awaiting_moderation;
	$awaiting_moderation = '';
	
	
	// Unapproved attachments
	$query = $db->query("
		SELECT COUNT(aid) AS unapprovedattachments
		FROM  ".TABLE_PREFIX."attachments a
		LEFT JOIN ".TABLE_PREFIX."posts p ON (p.pid=a.pid)
		LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
		WHERE a.visible='0' {$tflist}
	");
	$unapproved_attachments = $db->fetch_field($query, "unapprovedattachments");

	// 0 or more unapproved attachments currently exist
	if($unapproved_attachments > 0)
	{
		if($unapproved_attachments == 1)
		{
			$lang->awaiting_moderation = $lang->awaiting_moderation_attachment;
		}
		else
		{
			$lang->awaiting_moderation = $lang->sprintf($lang->awaiting_moderation_attachments, $unapproved_attachments);
		}
		
		eval("\$awaiting_moderation = \"".$templates->get("global_awaiting_moderation_attachments")."\";");
	}
	$unreadreports = $unreadreports . $awaiting_moderation;
}


In administration make new templates:

global_awaiting_moderation_attachments
<div class="red_alert"><a href="modcp.php?action=modqueue&type=attachments">{$lang->awaiting_moderation}</a></div>
<br />

global_awaiting_moderation_posts
<div class="red_alert"><a href="modcp.php?action=modqueue&type=posts">{$lang->awaiting_moderation}</a></div>
<br />

global_awaiting_moderation_threads
<div class="red_alert"><a href="modcp.php?action=modqueue&type=threads">{$lang->awaiting_moderation}</a></div>
<br />
(2011-04-07, 10:16 PM)Yaldaram Wrote: [ -> ]There is already: http://yaldaram.com/showthread.php?tid=78

What does this have to do with what the OP is asking??

The op is asking to show the waiting approvals as a notice, the plugin you linked to shows the unapproved post to the author.