Fossil SCM
Only show the "Moderation Requests" submenu button if there exist one or more posts in need of moderation.
Commit
397c32b6bbf461f893bf25512355a1f13f87ecb7a5c9a58bbbef425ee703893a
Parent
a9e5a1eefd71c5b…
2 files changed
+1
-1
+9
+1
-1
| --- src/forum.c | ||
| +++ src/forum.c | ||
| @@ -913,11 +913,11 @@ | ||
| 913 | 913 | } |
| 914 | 914 | style_header("Forum"); |
| 915 | 915 | if( g.perm.WrForum ){ |
| 916 | 916 | style_submenu_element("New Message","%R/forumnew"); |
| 917 | 917 | } |
| 918 | - if( g.perm.ModForum ){ | |
| 918 | + if( g.perm.ModForum && moderation_needed() ){ | |
| 919 | 919 | style_submenu_element("Moderation Requests", "%R/modreq"); |
| 920 | 920 | } |
| 921 | 921 | if( search_screen(SRCH_FORUM, 0) ){ |
| 922 | 922 | style_submenu_element("Recent Threads","%R/forum"); |
| 923 | 923 | style_footer(); |
| 924 | 924 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -913,11 +913,11 @@ | |
| 913 | } |
| 914 | style_header("Forum"); |
| 915 | if( g.perm.WrForum ){ |
| 916 | style_submenu_element("New Message","%R/forumnew"); |
| 917 | } |
| 918 | if( g.perm.ModForum ){ |
| 919 | style_submenu_element("Moderation Requests", "%R/modreq"); |
| 920 | } |
| 921 | if( search_screen(SRCH_FORUM, 0) ){ |
| 922 | style_submenu_element("Recent Threads","%R/forum"); |
| 923 | style_footer(); |
| 924 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -913,11 +913,11 @@ | |
| 913 | } |
| 914 | style_header("Forum"); |
| 915 | if( g.perm.WrForum ){ |
| 916 | style_submenu_element("New Message","%R/forumnew"); |
| 917 | } |
| 918 | if( g.perm.ModForum && moderation_needed() ){ |
| 919 | style_submenu_element("Moderation Requests", "%R/modreq"); |
| 920 | } |
| 921 | if( search_screen(SRCH_FORUM, 0) ){ |
| 922 | style_submenu_element("Recent Threads","%R/forum"); |
| 923 | style_footer(); |
| 924 |
+9
| --- src/moderate.c | ||
| +++ src/moderate.c | ||
| @@ -70,10 +70,19 @@ | ||
| 70 | 70 | @ <span class="modpending">(Awaiting Moderator Approval)</span> |
| 71 | 71 | } |
| 72 | 72 | return pending; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | + | |
| 76 | +/* | |
| 77 | +** Return TRUE if there any pending moderation requests. | |
| 78 | +*/ | |
| 79 | +int moderation_needed(void){ | |
| 80 | + if( !moderation_table_exists() ) return 0; | |
| 81 | + return db_exists("SELECT 1 FROM modreq"); | |
| 82 | +} | |
| 83 | + | |
| 75 | 84 | /* |
| 76 | 85 | ** Check to see if the object identified by RID is used for anything. |
| 77 | 86 | */ |
| 78 | 87 | static int object_used(int rid){ |
| 79 | 88 | static const char *const aTabField[] = { |
| 80 | 89 |
| --- src/moderate.c | |
| +++ src/moderate.c | |
| @@ -70,10 +70,19 @@ | |
| 70 | @ <span class="modpending">(Awaiting Moderator Approval)</span> |
| 71 | } |
| 72 | return pending; |
| 73 | } |
| 74 | |
| 75 | /* |
| 76 | ** Check to see if the object identified by RID is used for anything. |
| 77 | */ |
| 78 | static int object_used(int rid){ |
| 79 | static const char *const aTabField[] = { |
| 80 |
| --- src/moderate.c | |
| +++ src/moderate.c | |
| @@ -70,10 +70,19 @@ | |
| 70 | @ <span class="modpending">(Awaiting Moderator Approval)</span> |
| 71 | } |
| 72 | return pending; |
| 73 | } |
| 74 | |
| 75 | |
| 76 | /* |
| 77 | ** Return TRUE if there any pending moderation requests. |
| 78 | */ |
| 79 | int moderation_needed(void){ |
| 80 | if( !moderation_table_exists() ) return 0; |
| 81 | return db_exists("SELECT 1 FROM modreq"); |
| 82 | } |
| 83 | |
| 84 | /* |
| 85 | ** Check to see if the object identified by RID is used for anything. |
| 86 | */ |
| 87 | static int object_used(int rid){ |
| 88 | static const char *const aTabField[] = { |
| 89 |