[How To] Add Warnings Count in a Member's posts

How-to's, little tricks, tutorials, code examples (snippets) and read-me's.

[How To] Add Warnings Count in a Member's posts

Postby Sniper_E » 07 Mar 2007, 17:26

If a member has been warned in a topic for his/her post....
This is how you can tag that member's posts and keep up with the warnings count they have.
Spoiler:
OPEN styles/subSilver/viewtopic_body.html

FIND
Code: Select all
              <table width="100%" cellspacing="0">
                <
tr valign="middle">
                  <
td class="gensmall" align="right"><!-- IF postrow.U_REPORT -->
                    <
a href="{postrow.U_REPORT}">{REPORT_IMG}</a>
                    <!-- ENDIF -->
                    <!-- IF 
postrow.U_INFO -->
                    <
a href="{postrow.U_INFO}">{INFO_IMG}</a>
                    <!-- ENDIF -->
                    <!-- IF 
postrow.U_WARN -->
                    <
a href="{postrow.U_WARN}">{WARN_IMG}</a>
                    <!-- ENDIF -->
                    <!-- IF 
postrow.U_DELETE -->
                    <
a href="{postrow.U_DELETE}">{DELETE_IMG}</a>
                    <!-- ENDIF -->
                  </
td>
                </
tr>
              </
table>         


ADD BEFORE
Code: Select all
                </table>

                <!-- IF 
U_MCP and postrow.POSTER_WARNINGS neq 0 -->
                <
tr>
                  <
td class="gensmall" align="right">
                  <
strong style="color: red;">{L_WARNINGS» {postrow.POSTER_WARNINGS}</strong>
                  </
td>
                </
tr>
                <!-- ENDIF -->         


CLOSE and SAVE

code by Belak
The warnings count will show up below the warn button at the bottom right of a warned member's post for only moderators to see.


This is how you can spruce it up a bit with a background image to make it look like it belongs in the page.
Spoiler:
First you will need to create a background image like this....
Then save it in your imageset directory as styles/subSilver/imageset/en/icon_post_warnings.gif

Then you will need to edit the code.
Code: Select all
// OPEN styles/subSilver/viewtopic_body.html

// GOTO code

                <!-- IF U_MCP and postrow.POSTER_WARNINGS neq 0 -->
                <tr>
                  <td class="gensmall" align="right">
                  <strong style="color: red;">{L_WARNINGS} » {postrow.POSTER_WARNINGS}</strong>
                  </td>
                </tr>
                <!-- ENDIF -->

// FIND

                  <td class="gensmall" align="right">

// RELACE WITH

                  <td background="{T_IMAGESET_PATH}/en/icon_post_warnings.gif" width="86" height="22" align="center" valign="middle">

// CLOSE and SAVE
Now your warnings text and count will be placed on top of your background image.


This is how you can link the warnings tag to the member's warnings report.
Spoiler:
Code: Select all
// OPEN viewtopic.php

// FIND

          
'U_WARN'            => ($auth->acl_getf_global('m_warn') && $poster_id != $user->data['user_id'] && $poster_id != ANONYMOUS) ? append_sid("{$phpbb_root_path}mcp.$phpEx"'i=warn&amp;mode=warn_post&amp;f=' $forum_id '&amp;p=' $row['post_id'], true$user->session_id) : '',

// AFTER, ADD

          
'U_WARNINGS'        => append_sid("{$phpbb_root_path}mcp.$phpEx""i=notes&mode=user_notes&u=$poster_id"),

// CLOSE and SAVE

// OPEN styles/subSilver/viewtopic_body.html

// FIND

                  
<strong style="color: red;">{L_WARNINGS} = {postrow.POSTER_WARNINGS}</strong>

// REPLACE WITH

                  
<a href="{postrow.U_WARNINGS}"><strong style="color: red;">{L_WARNINGS} = {postrow.POSTER_WARNINGS}</strong></a>

// CLOSE and SAVE

// code by Handyman           
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!
User avatar
Sniper_E    
STG Jedi Master
STG Jedi Master
 
Posts: 6991
Joined: 31 May 2006, 06:29
Location: Shreveport, LA
Favorite Team: The STG Team
Gender: Male
phpBB Knowledge: 6




phpBB Academy at StarTrekGuide
Support STG
Using PayPal Donate

Re: [How To] Add Warnings Count in a Member's posts

Postby Handyman » 07 Mar 2007, 18:14

Shock did you give yourself 14 warnings? Glare
Please contact me if you have any news to submit to SCOFF News.
SCOFFing at the candidates while you sleep.
My Mods || My Mod Queue
Image
User avatar
Handyman    
Rear Fleet Admiral
Rear Fleet Admiral
 
Posts: 7457
Joined: 08 May 2006, 04:45
Location: Where no man has gone before!
Favorite Team: Seattle Seahawks
Gender: Male

Re: [How To] Add Warnings Count in a Member's posts

Postby LiamMac » 07 Mar 2007, 23:39

Code: Select all
                  <table width="100%" cellspacing="0">
                  <tr valign="middle">
                     <td class="gensmall" align="right">
                     <!-- IF not S_IS_BOT -->
                        <!-- IF postrow.U_REPORT --><a href="{postrow.U_REPORT}">{REPORT_IMG}</a> <!-- ENDIF -->
                        <!-- IF postrow.U_INFO --><a href="{postrow.U_INFO}">{INFO_IMG}</a> <!-- ENDIF -->
                        <!-- IF postrow.U_WARN --><a href="{postrow.U_WARN}">{WARN_IMG}</a> <!-- ENDIF -->
                        <!-- IF postrow.U_DELETE --><a href="{postrow.U_DELETE}">{DELETE_IMG}</a> <!-- ENDIF -->
                     <!-- ENDIF -->
                     </td>
                  </tr>
                  </table>


Just a note, this is the format it is displayed in the file. So a copy/find of the the first one wont source it. If anyone really cares Tongue
Star Trek Guide Forums Moderation Team
Image
phpBB3 MODs and Styles Development - Olympus MOD Database - phpBB / PHP programming Academy and Discussion Forum
User avatar
LiamMac    
Supporter
Supporter
 
Posts: 535
Joined: 12 Sep 2006, 00:10
Location: The Land of Aoteroa or New Zealand
Gender: Male
phpBB Knowledge: 4

Re: [How To] Add Warnings Count in a Member's posts

Postby Sniper_E » 08 Mar 2007, 00:09

Are you saying this want source it LiamMac?
Code: Select all
                  <table width="100%" cellspacing="0">
                  <tr valign="middle">
                     <td class="gensmall" align="right">
                     <!-- IF not S_IS_BOT -->
                        <!-- IF postrow.U_REPORT --><a href="{postrow.U_REPORT}">{REPORT_IMG}</a> <!-- ENDIF -->
                        <!-- IF postrow.U_INFO --><a href="{postrow.U_INFO}">{INFO_IMG}</a> <!-- ENDIF -->
                        <!-- IF postrow.U_WARN --><a href="{postrow.U_WARN}">{WARN_IMG}</a> <!-- ENDIF -->
                        <!-- IF postrow.U_DELETE --><a href="{postrow.U_DELETE}">{DELETE_IMG}</a> <!-- ENDIF -->
                     <!-- ENDIF -->
                     </td>
                  </tr>
                  <!-- IF U_MCP and postrow.POSTER_WARNINGS neq 0 -->
                  <tr>
                     <td class="gensmall" align="right"><strong style="color: red;">{L_WARNINGS}: {postrow.POSTER_WARNINGS}</strong>
                     </td>
                  </tr>
                  <!-- ENDIF -->
                  </table>

I beg to differ! Tongue
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!
User avatar
Sniper_E    
STG Jedi Master
STG Jedi Master
 
Posts: 6991
Joined: 31 May 2006, 06:29
Location: Shreveport, LA
Favorite Team: The STG Team
Gender: Male
phpBB Knowledge: 6

Re: [How To] Add Warnings Count in a Member's posts

Postby Semi_Deus » 08 Mar 2007, 03:58

looks nice, installed it ammediatly (good english??)
Former Moderator & Styles team member
Image
User avatar
Semi_Deus
Admiral
Admiral
 
Posts: 2479
Joined: 13 Feb 2007, 13:53
Location: Netherlands
Favorite Team: Ajax
Gender: Male
phpBB Knowledge: 8

Re: [How To] Add Warnings Count in a Member's posts

Postby Case » 08 Mar 2007, 04:29

*immediately Smile
Case
Lt. Jr Grade
Lt. Jr Grade
 
Posts: 152
Joined: 07 Jul 2006, 16:25
Location: Up Norf
Favorite Team: Spurs
Gender: Male

Re: [How To] Add Warnings Count in a Member's posts

Postby Semi_Deus » 08 Mar 2007, 07:00

ok thanks, now i shall have a 10 next time i have an english test!
(10 = A+ for USA)
(10 = 1 for Germany) Wink
Former Moderator & Styles team member
Image
User avatar
Semi_Deus
Admiral
Admiral
 
Posts: 2479
Joined: 13 Feb 2007, 13:53
Location: Netherlands
Favorite Team: Ajax
Gender: Male
phpBB Knowledge: 8

Re: [How To] Add Warnings Count in a Member's posts

Postby LiamMac » 12 Mar 2007, 20:41

Sniper_E wrote:Are you saying this want source it LiamMac?
Code: Select all
                  <table width="100%" cellspacing="0">
                  <tr valign="middle">
                     <td class="gensmall" align="right">
                     <!-- IF not S_IS_BOT -->
                        <!-- IF postrow.U_REPORT --><a href="{postrow.U_REPORT}">{REPORT_IMG}</a> <!-- ENDIF -->
                        <!-- IF postrow.U_INFO --><a href="{postrow.U_INFO}">{INFO_IMG}</a> <!-- ENDIF -->
                        <!-- IF postrow.U_WARN --><a href="{postrow.U_WARN}">{WARN_IMG}</a> <!-- ENDIF -->
                        <!-- IF postrow.U_DELETE --><a href="{postrow.U_DELETE}">{DELETE_IMG}</a> <!-- ENDIF -->
                     <!-- ENDIF -->
                     </td>
                  </tr>
                  <!-- IF U_MCP and postrow.POSTER_WARNINGS neq 0 -->
                  <tr>
                     <td class="gensmall" align="right"><strong style="color: red;">{L_WARNINGS}: {postrow.POSTER_WARNINGS}</strong>
                     </td>
                  </tr>
                  <!-- ENDIF -->
                  </table>

I beg to differ! Tongue

I copied the text from the first spoiler and it wasnt until I searched for a specific line that I found the code because it didn't follow the same format that was in the spoiler. However the code you have just posted would because its the same as what I just posted.

What might have happened is that the spoiler change the line lenght so it moved the ENDIF's to the next line.

Code: Select all
<table width="100%" cellspacing="0">
                <tr valign="middle">
                  <td class="gensmall" align="right"><!-- IF postrow.U_REPORT -->
                    <a href="{postrow.U_REPORT}">{REPORT_IMG}</a>
                    <!-- ENDIF -->
                    <!-- IF postrow.U_INFO -->
                    <a href="{postrow.U_INFO}">{INFO_IMG}</a>
                    <!-- ENDIF -->
                    <!-- IF postrow.U_WARN -->
                    <a href="{postrow.U_WARN}">{WARN_IMG}</a>
                    <!-- ENDIF -->
                    <!-- IF postrow.U_DELETE -->
                    <a href="{postrow.U_DELETE}">{DELETE_IMG}</a>
                    <!-- ENDIF -->
                  </td>
                </tr>
              </table>

Star Trek Guide Forums Moderation Team
Image
phpBB3 MODs and Styles Development - Olympus MOD Database - phpBB / PHP programming Academy and Discussion Forum
User avatar
LiamMac    
Supporter
Supporter
 
Posts: 535
Joined: 12 Sep 2006, 00:10
Location: The Land of Aoteroa or New Zealand
Gender: Male
phpBB Knowledge: 4

Re: [How To] Add Warnings Count in a Member's posts

Postby stitch626 » 14 Mar 2007, 14:49

I am having a problem with this. here is my code
Code: Select all
<!-- IF U_MCP and postrow.POSTER_WARNINGS neq 0 -->
                <tr>
                  <td background="{T_IMAGESET_PATH}/en/icon_post_warnings.gif" width="86" height="22" align="center" valign="middle">
                  <strong style="color: red;">{L_WARNINGS} » {postrow.POSTER_WARNINGS}</strong>
                  </td>
                </tr>
                <!-- ENDIF -->

                  <table width="100%" cellspacing="0">
                  <tr valign="middle">
                     <td class="gensmall" align="right">
                     <!-- IF not S_IS_BOT -->
                        <!-- IF postrow.U_REPORT --><a href="{postrow.U_REPORT}">{REPORT_IMG}</a> <!-- ENDIF -->
                        <!-- IF postrow.U_INFO --><a href="{postrow.U_INFO}">{INFO_IMG}</a> <!-- ENDIF -->
                        <!-- IF postrow.U_WARN --><a href="{postrow.U_WARN}">{WARN_IMG}</a> <!-- ENDIF -->
                        <!-- IF postrow.U_DELETE --><a href="{postrow.U_DELETE}">{DELETE_IMG}</a> <!-- ENDIF -->
                     <!-- ENDIF -->
                     </td>
                  </tr>
                  </table>


What is happening is that my background image is being displayed over and over all along the bottom of the text area. The Warning text is inside the first image which is being displayed at the extreme left bottom corner of the text area. Also I would like to mention that there is a question mark after warning. I.E. Warnings ? 1
User avatar
stitch626    
STG Moderator Leader
STG Moderator Leader
 
Posts: 3185
Joined: 08 Feb 2007, 20:47
Location: Michigan
Favorite Team: Detroit Red Wings
Gender: Male
phpBB Knowledge: 7

Re: [How To] Add Warnings Count in a Member's posts

Postby Sniper_E » 14 Mar 2007, 15:53

Yes, the image would duplicate clear across the message area, 100%
Highway changed it up a bit to make it set right.
Code: Select all
<table width="100%" cellspacing="0">
                <tr valign="middle">
                <!-- IF U_MCP and postrow.POSTER_WARNINGS neq 0 -->
                  <td align="right" valign="middle"><div style="background-image:url('{T_IMAGESET_PATH}/en/icon_post_warnings.gif'); width:90px; height:22px;"><a class="warn" href="{postrow.U_WARNINGS}" title="{L_VIEW_NOTES}">{L_WARNINGS} » {postrow.POSTER_WARNINGS}</a></div></td>
                  <!-- ENDIF -->
                  <td class="gensmall" align="right" style="width:15%;"><!-- IF postrow.U_REPORT -->
                    <a href="{postrow.U_REPORT}">{REPORT_IMG}</a>
                    <!-- ENDIF -->
                    <!-- IF postrow.U_INFO -->
                    <a href="{postrow.U_INFO}">{INFO_IMG}</a>
                    <!-- ENDIF -->
                    <!-- IF postrow.U_WARN -->
                    <a href="{postrow.U_WARN}">{WARN_IMG}</a>
                    <!-- ENDIF -->
                    <!-- IF postrow.U_DELETE -->
                    <a href="{postrow.U_DELETE}">{DELETE_IMG}</a>
                    <!-- ENDIF -->
                  </td>
                </tr>
              </table>
I'll have to get you the settings in the warn class that we created.
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!
User avatar
Sniper_E    
STG Jedi Master
STG Jedi Master
 
Posts: 6991
Joined: 31 May 2006, 06:29
Location: Shreveport, LA
Favorite Team: The STG Team
Gender: Male
phpBB Knowledge: 6

Next

Return to Tutorials and How-Tos

Who is online

Users browsing this forum: Google [Bot] and 3 guests