Advertisement:

Author Topic: Number of Unapproved Posts and Topics in Header  (Read 12212 times)

Offline Diego Andrés

  • Customizer
  • SMF Hero
  • *
  • Posts: 3,768
  • Gender: Male
    • DiegoAndresCortes on GitHub
    • @bihgetter on Twitter
    • SMF Tricks - Free & Premium Themes
Number of Unapproved Posts and Topics in Header
« on: April 10, 2011, 10:42:15 PM »
Link to Mod

Link to Mod


This will show Number of unapproved posts and topics in your forum in the header. The count will be visible to only those users who have power to approve the posts.

Original Author and credits: Joker™

Change Log

Version 1.1
- Mod updated for SMF 2.0 final
- License added to mod


This mod is licensed under Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
« Last Edit: June 16, 2011, 10:47:16 AM by Joker™ »

SMF Tricks - Free & Premium Responsive Themes for SMF.

Offline Joomlamz

  • SMF Hero
  • ******
  • Posts: 2,639
  • Gender: Male
  • Suporte SmfPT
    • apllicmz on Facebook
    • apllicmz on GitHub
    • https://www.linkedin.com/in/aplic on LinkedIn
    • @aplichosting on Twitter
    • Webdesign
Re: Number of Unapproved Posts and Topics in Header
« Reply #1 on: June 03, 2011, 02:36:42 AM »
Nice work
when Update dont forget Update portuguese files

Code: [Select]
<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>



Offline beanflying

  • Semi-Newbie
  • *
  • Posts: 94
  • Gender: Male
  • Caffeine Addict
    • @seabreezecoffee on Twitter
    • Seabreeze Coffee
Re: Number of Unapproved Posts and Topics in Header
« Reply #2 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
Owner of many many shiny toys.

Offline Joker™

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,914
  • Gender: Male
    • siddhartha-gupta on GitHub
Re: Number of Unapproved Posts and Topics in Header
« Reply #3 on: October 15, 2011, 01:08:43 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

Offline imburner

  • Semi-Newbie
  • *
  • Posts: 40
Re: Number of Unapproved Posts and Topics in Header
« Reply #4 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

Offline Joker™

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,914
  • Gender: Male
    • siddhartha-gupta on GitHub
Re: Number of Unapproved Posts and Topics in Header
« Reply #5 on: November 11, 2011, 07:38:22 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

Offline HunterP

  • Sr. Member
  • ****
  • Posts: 976
  • Gender: Male
  • SMF 2.0.4
    • Hulpverleningsforum Nederland
Re: Number of Unapproved Posts and Topics in Header
« Reply #6 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?

Offline HunterP

  • Sr. Member
  • ****
  • Posts: 976
  • Gender: Male
  • SMF 2.0.4
    • Hulpverleningsforum Nederland
Re: Number of Unapproved Posts and Topics in Header
« Reply #7 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

Offline Joker™

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,914
  • Gender: Male
    • siddhartha-gupta on GitHub
Re: Number of Unapproved Posts and Topics in Header
« Reply #8 on: November 12, 2011, 10:09:45 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.



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

Offline HunterP

  • Sr. Member
  • ****
  • Posts: 976
  • Gender: Male
  • SMF 2.0.4
    • Hulpverleningsforum Nederland
Re: Number of Unapproved Posts and Topics in Header
« Reply #9 on: November 13, 2011, 04:40:43 AM »

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

Offline HunterP

  • Sr. Member
  • ****
  • Posts: 976
  • Gender: Male
  • SMF 2.0.4
    • Hulpverleningsforum Nederland
Re: Number of Unapproved Posts and Topics in Header
« Reply #10 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...?

Offline HunterP

  • Sr. Member
  • ****
  • Posts: 976
  • Gender: Male
  • SMF 2.0.4
    • Hulpverleningsforum Nederland
Re: Number of Unapproved Posts and Topics in Header
« Reply #11 on: November 13, 2011, 05:14:19 AM »
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.

Offline Joker™

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,914
  • Gender: Male
    • siddhartha-gupta on GitHub
Re: Number of Unapproved Posts and Topics in Header
« Reply #12 on: November 14, 2011, 07:19:22 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

Offline HunterP

  • Sr. Member
  • ****
  • Posts: 976
  • Gender: Male
  • SMF 2.0.4
    • Hulpverleningsforum Nederland
Re: Number of Unapproved Posts and Topics in Header
« Reply #13 on: November 14, 2011, 10:19:39 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.

Offline Joker™

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,914
  • Gender: Male
    • siddhartha-gupta on GitHub
Re: Number of Unapproved Posts and Topics in Header
« Reply #14 on: November 14, 2011, 10:23:14 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

Offline Diego Andrés

  • Customizer
  • SMF Hero
  • *
  • Posts: 3,768
  • Gender: Male
    • DiegoAndresCortes on GitHub
    • @bihgetter on Twitter
    • SMF Tricks - Free & Premium Themes
Re: Number of Unapproved Posts and Topics in Header
« Reply #15 on: December 04, 2011, 05:19:30 PM »
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.

Offline Joker™

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,914
  • Gender: Male
    • siddhartha-gupta on GitHub
Re: Number of Unapproved Posts and Topics in Header
« Reply #16 on: December 04, 2011, 09:30:16 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

Offline Diego Andrés

  • Customizer
  • SMF Hero
  • *
  • Posts: 3,768
  • Gender: Male
    • DiegoAndresCortes on GitHub
    • @bihgetter on Twitter
    • SMF Tricks - Free & Premium Themes
Re: Number of Unapproved Posts and Topics in Header
« Reply #17 on: December 05, 2011, 07:34:44 AM »
I know, but the link will go to the unapproved tabs where appear "topics" and "posts"

SMF Tricks - Free & Premium Responsive Themes for SMF.

Offline Joker™

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,914
  • Gender: Male
    • siddhartha-gupta on GitHub
Re: Number of Unapproved Posts and Topics in Header
« Reply #18 on: December 05, 2011, 09:46:52 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>';



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

Offline Diego Andrés

  • Customizer
  • SMF Hero
  • *
  • Posts: 3,768
  • Gender: Male
    • DiegoAndresCortes on GitHub
    • @bihgetter on Twitter
    • SMF Tricks - Free & Premium Themes
Re: Number of Unapproved Posts and Topics in Header
« Reply #19 on: December 05, 2011, 08:46:51 PM »
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>';



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

Perfect! Thank you.

SMF Tricks - Free & Premium Responsive Themes for SMF.