Link to the mod (https://custom.simplemachines.org/index.php?mod=2952)
(https://smftricks.com/logos/logo.png) (https://smftricks.com/)
(https://img.shields.io/badge/License-MPL%202.0-248049) (https://img.shields.io/badge/Hooks%20Only-Yes-6041a3) (https://img.shields.io/badge/SMF-2.1-3f73a0)
Unapproved Attachments, Posts and Topics in ModDeveloped by Diego Andrés (https://smftricks.com/index.php?action=profile;u=1)
Original Developer: Joker™ (https://www.simplemachines.org/community/index.php?action=profile;u=226111)
IntroductionUnapproved Attachments, Posts and Topics in Mod will display the number of unapproved attachments, posts and topics in the mod menu counter.
Changelog (https://github.com/SMFTricks/Unapproved-Attachments-Posts-and-Topics-in-Mod/blob/main/CHANGELOG.md)GitHub (https://github.com/SMFTricks/Unapproved-Attachments-Posts-and-Topics-in-Mod)
Nice work
when Update dont forget Update portuguese files
<file name="$languagedir/Modifications.portuguese_pt.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[$txt['total_unapproved_topics'] = 'Total de tópicos não aprovados';
$txt['total_unapproved_posts'] = 'Total postes não aprovado';
]]></add>
</operation>
</file>
<file name="$languagedir/Modifications.portuguese_pt-utf8.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[$txt['total_unapproved_topics'] = 'Total de tópicos não aprovados';
$txt['total_unapproved_posts'] = 'Total postes não aprovado';
]]></add>
</operation>
</file>
<file name="$languagedir/Modifications.portuguese_brazillian.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[$txt['total_unapproved_topics'] = 'Total de tópicos não aprovados';
$txt['total_unapproved_posts'] = 'Total postes não aprovado';
]]></add>
</operation>
</file>
<file name="$languagedir/Modifications.portuguese_brazillian-utf8.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[$txt['total_unapproved_topics'] = 'Total de tópicos não aprovados';
$txt['total_unapproved_posts'] = 'Total postes não aprovado';
]]></add>
</operation>
</file>
Simple question and I am sure I am missing something obvious. Nice little addon too :)
Admins can see the posts awaiting approval but mods and the high post count group I have set up for approving newbies posts/topics can't see the text in their headers?
Any idea of what permission or setting I need to change as I have looked at them and can't see an obvious one.
TIA
Quote from: beanflying on October 14, 2011, 10:35:33 PM
Simple question and I am sure I am missing something obvious. Nice little addon too :)
Admins can see the posts awaiting approval but mods and the high post count group I have set up for approving newbies posts/topics can't see the text in their headers?
Any idea of what permission or setting I need to change as I have looked at them and can't see an obvious one.
TIA
The only permission placed in the mod is "allowedTo('approve_posts')" which means if a user has the ability to approve posts can see the number pf unapproved posts/topics in header. It's bit hard to tell the exact issue with your forum.
Can you cross check the permissions once more :).
This sounds great to weed out spammers. How do I go about setting it up this way? Thanks
Quote from: imburner on November 11, 2011, 05:21:15 AM
This sounds great to weed out spammers. How do I go about setting it up this way? Thanks
Which setting are we talking about here?
Just installed your mod (without errors) but don't get to see anything in the header. I'm running the core theme and installed the mod also for this theme.
Any ideas?
Ok wait a sec. I get to see it when I'm reading a topic, but not when I want to see the recent/unread topics list or when I go to the forum index. I also see it when I go to a board, but not on all pages :o
Quote from: HunterP on November 12, 2011, 06:30:31 PM
Just installed your mod (without errors) but don't get to see anything in the header. I'm running the core theme and installed the mod also for this theme.
Any ideas?
Funny thing, for sure on core theme the mod is going to show some errors while installing.
Quote from: HunterP on November 12, 2011, 06:34:38 PM
Ok wait a sec. I get to see it when I'm reading a topic, but not when I want to see the recent/unread topics list or when I go to the forum index. I also see it when I go to a board, but not on all pages :o
The area where this mod works is served by index.template.php so I'm not sure how even this is possible that you are able to see the mod working at only few pages.
As per my knowledge either the mod works properly or show nothing at all.
Weird, I'll try to figure it out myself and will keep you updated.
Found something. On the pages where this information doesn't appear, allowedTo('approve_posts') seems to return false...?
Think I've solved it. As far as I know it is not necessary to test for allowedTo('approve_posts') in index.template.php , so :
if (!empty($context['total_unapproved_topics']) && allowedTo('approve_posts'))
echo '
<li><a href="', $scripturl, '?action=moderate;area=postmod;sa=topics">', $txt['total_unapproved_topics'], ': ', $context['total_unapproved_topics'], '</a></li>';
if (!empty($context['total_unapproved_posts']) && allowedTo('approve_posts'))
echo '
<li><a href="', $scripturl, '?action=moderate;area=postmod;sa=posts">', $txt['total_unapproved_posts'], ': ', $context['total_unapproved_posts'], '</a></li>';
This works for me.
Quote from: HunterP on November 13, 2011, 05:01:53 AM
Found something. On the pages where this information doesn't appear, allowedTo('approve_posts') seems to return false...?
Umm not sure whats exactly happening on your forum, but have you checked whether only people having power to approve the posts are able to see the number of unapproved posts and topics in header?
Quote from: Joker™ on November 14, 2011, 07:19:22 AM
Quote from: HunterP on November 13, 2011, 05:01:53 AM
Found something. On the pages where this information doesn't appear, allowedTo('approve_posts') seems to return false...?
Umm not sure whats exactly happening on your forum, but have you checked whether only people having power to approve the posts are able to see the number of unapproved posts and topics in header?
Yes, for sure.
Quote from: HunterP on November 14, 2011, 10:19:39 AM
Quote from: Joker™ on November 14, 2011, 07:19:22 AM
Quote from: HunterP on November 13, 2011, 05:01:53 AM
Found something. On the pages where this information doesn't appear, allowedTo('approve_posts') seems to return false...?
Umm not sure whats exactly happening on your forum, but have you checked whether only people having power to approve the posts are able to see the number of unapproved posts and topics in header?
Yes, for sure.
Thanks for the feedback. I'll try to take a look into the code about this soon.
how will be the code, for show a single item.
I mean, I want the topics and posts stay in the same think. For example, if I have one unapproved topic and one unapproved post, I want that the text in the header appear like this: Total Unapproved Posts 2
Thank you ;D
Quote from: Diego Andrés on December 04, 2011, 05:19:30 PM
I mean, I want the topics and posts stay in the same think. For example, if I have one unapproved topic and one unapproved post, I want that the text in the header appear like this: Total Unapproved Posts 2
Yup easily possible, but there is a difference between posts and topics and what you are asking for is going to create confusion on your forum, i.e for those who will be able to see it in header.
I know, but the link will go to the unapproved tabs where appear "topics" and "posts"
Quote from: Diego Andrés on December 05, 2011, 07:34:44 AM
I know, but the link will go to the unapproved tabs where appear "topics" and "posts"
Here you go, the code should work most probably :P
themes\<theme you are using>\index.template.php (
Make backup of file before editing it)
if (!empty($context['total_unapproved_topics']) && allowedTo('approve_posts'))
echo '
<li><a href="', $scripturl, '?action=moderate;area=postmod;sa=topics">', $txt['total_unapproved_topics'], ': ', $context['total_unapproved_topics'], '</a></li>';
if (!empty($context['total_unapproved_posts']) && allowedTo('approve_posts'))
echo '
<li><a href="', $scripturl, '?action=moderate;area=postmod;sa=posts">', $txt['total_unapproved_posts'], ': ', $context['total_unapproved_posts'], '</a></li>'; if (!empty($context['total_unapproved_posts']) || !empty($context['total_unapproved_topics']) && allowedTo('approve_posts'))
echo '
<li><a href="', $scripturl, '?action=moderate;area=postmod;sa=posts">', $txt['total_unapproved_posts'], ': ', ($context['total_unapproved_posts'] + $context['total_unapproved_topics']), '</a></li>';Quote from: Joker™ on November 14, 2011, 07:19:22 AM
Quote from: HunterP on November 13, 2011, 05:01:53 AM
Found something. On the pages where this information doesn't appear, allowedTo('approve_posts') seems to return false...?
Umm not sure whats exactly happening on your forum, but have you checked whether only people having power to approve the posts are able to see the number of unapproved posts and topics in header?
yeah the source file function is taking care of it.
Note - Next feature of mod - Add option for admin to disable the mod
Quote from: Joker™ on December 05, 2011, 09:46:52 AMHere you go, the code should work most probably :P
Perfect! Thank you.
Thanks. Very good. Vongratulations.
if used code total see the moderators
// Count how many post and topics are there to be approved
function Posttoapprove()
{
global $context, $smcFunc;
$approve_boards = boardsAllowedTo('approve_posts');
if ($approve_boards == array(0))
$approve_query = '';
elseif (!empty($approve_boards))
$approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')';
else
$approve_query = ' AND 0';
$request = $smcFunc['db_query']('', '
SELECT COUNT(m.id_topic)
FROM {db_prefix}topics AS m
INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board)
WHERE m.approved = {int:not_approved}
AND {query_see_board}
' . $approve_query,
array(
'not_approved' => 0,
)
);
list ($totalUnapprovedTopics) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
$context['total_unapproved_topics'] = $totalUnapprovedTopics;
$request = $smcFunc['db_query']('', '
SELECT COUNT(*)
FROM {db_prefix}messages AS m
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic AND t.id_first_msg != m.id_msg)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
WHERE m.approved = {int:not_approved}
AND {query_see_board}
' . $approve_query,
array(
'not_approved' => 0,
)
);
list ($totalUnapprovedPosts) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
$context['total_unapproved_posts'] = $totalUnapprovedPosts;
}
but
if used code total see the moderators all user
How do I change the code?
?
used code (risk)?
function posttoapprove()
{
global $approve_query, $context, $smcFunc;
$request = $smcFunc['db_query']('', '
SELECT COUNT(m.id_topic)
FROM {db_prefix}topics AS m
INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board)
WHERE m.approved = {int:not_approved}
AND {query_see_board}
' . $approve_query,
array(
'not_approved' => 0,
)
);
list ($totalUnapprovedTopics) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
// Update the tabs with the correct number of posts.
$context['total_unapproved_topics'] = $totalUnapprovedTopics;
}
Are you trying to achieve that everyone can see the count of how many topics are unapproved?
Yes.
index.template.php code edit: ok. We took care of
ModerationCenter.php code edit: ?. I could not
Note - Make backup of file before editing it
// Count how many post and topics are there to be approved
function Posttoapprove()
{
global $context, $smcFunc;
$request = $smcFunc['db_query']('', '
SELECT COUNT(m.id_topic)
FROM {db_prefix}topics AS m
INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board)
WHERE m.approved = {int:not_approved}
AND {query_see_board}',
array(
'not_approved' => 0,
)
);
list ($totalUnapprovedTopics) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
$context['total_unapproved_topics'] = $totalUnapprovedTopics;
$request = $smcFunc['db_query']('', '
SELECT COUNT(*)
FROM {db_prefix}messages AS m
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic AND t.id_first_msg != m.id_msg)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
WHERE m.approved = {int:not_approved}
AND {query_see_board}',
array(
'not_approved' => 0,
)
);
list ($totalUnapprovedPosts) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
$context['total_unapproved_posts'] = $totalUnapprovedPosts;
}
thanks.
Still installs on 2.0.9 using emulation to 2.0.1. Manual mod needed to custom theme but works great as always.
Work in progress unless someone has already done it. I am going to try and have it show Unapproved members too under the posts and topics on my custom theme. **Sorted it and Done :)
1.0 - 02 October 2021
(https://smftricks.com/Themes/SMFTricks/images/changelog/tag--pencil.png) Display number of unapproved attachments, posts and topics in the mod button counter.
(https://smftricks.com/Themes/SMFTricks/images/changelog/tag--plus.png) Added support for unapproved attachments.
(https://smftricks.com/Themes/SMFTricks/images/changelog/tag--plus.png) Initial Release for SMF 2.1
this is a very useful mod to have especially when you have large and busy forums.
Hi,
Compatible With 2.1.1 Thanks
@Diego Andrés