Unapproved Attachments, Posts and Topics in Mod

Started by Diego Andrés, April 10, 2011, 10:42:15 PM

Previous topic - Next topic

Diego Andrés

Link to the mod




Unapproved Attachments, Posts and Topics in Mod
Developed by Diego Andrés
Original Developer: Joker™




Introduction
Unapproved Attachments, Posts and Topics in Mod will display the number of unapproved attachments, posts and topics in the mod menu counter.


Changelog
GitHub

SMF Tricks - Free & Premium Responsive Themes for SMF.

Apllicmz

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&oacute;picos n&atilde;o aprovados';
$txt['total_unapproved_posts'] = 'Total postes n&atilde;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&oacute;picos n&atilde;o aprovados';
$txt['total_unapproved_posts'] = 'Total postes n&atilde;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&oacute;picos n&atilde;o aprovados';
$txt['total_unapproved_posts'] = 'Total postes n&atilde;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&oacute;picos n&atilde;o aprovados';
$txt['total_unapproved_posts'] = 'Total postes n&atilde;o aprovado';

]]></add>
        </operation>
    </file>




beanflying

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
Owner of many many shiny toys.

Joker™

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 :).
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

imburner

This sounds great to weed out spammers. How do I go about setting it up this way? Thanks

Joker™

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?
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

HunterP


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?

HunterP


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

Joker™

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.
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

HunterP


Weird, I'll try to figure it out myself and will keep you updated.

HunterP

Found something. On the pages where this information doesn't appear, allowedTo('approve_posts') seems to return false...?

HunterP

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.

Joker™

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?
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

HunterP

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.

Joker™

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.
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Diego Andrés

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

SMF Tricks - Free & Premium Responsive Themes for SMF.

Joker™

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.
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Diego Andrés

I know, but the link will go to the unapproved tabs where appear "topics" and "posts"

SMF Tricks - Free & Premium Responsive Themes for SMF.

Joker™

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)

Code (Find:) Select
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>';



Code (Replace it with:) Select
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
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Diego Andrés

#19
Quote from: Joker™ on December 05, 2011, 09:46:52 AMHere you go, the code should work most probably :P

Perfect! Thank you.

SMF Tricks - Free & Premium Responsive Themes for SMF.

Advertisement: