User defined rank color and custom rank

Viewtopic, viewforum, posting related hacks and MODs.
Viewing topics, forums, or posting add-ons.

User defined rank color and custom rank

Postby King Rhyono » 02 Feb 2008, 19:01

Classification: Improvement
phpBB Part: Topic

MOD Name: Rank Color & Custom Rank
Author: King Rhyono
MOD Description: Allows users to specify their rank and a color for their rank.

Works with:
  • 3.0.0 prosilver and prosilver based templates (not tested on subsilver)

Features:
  • Users can define their own rank.
  • Users can define their own rank color.

Language: English

Directions:
If you want to use the rank color, add the custom field "rankcolor" in the ACP, make it a "single text field" type.
If you want to use the custom rank, add the custom field "customrank" in the ACP, make it a "single text field" type.
OPEN styles/{your theme}/template/viewtopic_body.html
FIND
Code: Select all
<!-- IF postrow.RANK_TITLE or postrow.RANK_IMG -->

Replace that section with

Rank Color (no user requirements):
Spoiler:
Code: Select all
<!-- IF postrow.RANK_TITLE --><dd><strong><font color="{postrow.PROFILE_RANKCOLOR_VALUE}">{postrow.RANK_TITLE}</font></strong><!-- ENDIF -->
<!-- IF postrow.RANK_TITLE and postrow.RANK_IMG --><br />{postrow.RANK_IMG}</dd><!-- ENDIF -->

CLOSE and SAVE


Custom Rank (no user requirements):
Spoiler:
Code: Select all
<!-- IF postrow.PROFILE_CUSTOMRANK_VALUE != '' --><dd><strong>{postrow.PROFILE_CUSTOMRANK_VALUE}</strong><!-- ELSE --><dd><strong>{postrow.RANK_TITLE}</strong><!-- ENDIF -->
<!-- IF postrow.RANK_TITLE and postrow.RANK_IMG --><br />{postrow.RANK_IMG}</dd><!-- ENDIF -->


Rank Color and Custom Rank (no user requirements):
Spoiler:
Code: Select all
<!-- IF postrow.RANK_TITLE or postrow.PROFILE_RANKCOLOR_VALUE != '' --><dd><strong><font color="{postrow.PROFILE_RANKCOLOR_VALUE}"><!-- ENDIF -->
<!-- IF postrow.PROFILE_CUSTOMRANK_VALUE -->{postrow.PROFILE_CUSTOMRANK_VALUE}</font></strong><!-- ELSE -->{postrow.RANK_TITLE}</font></strong><!-- ENDIF -->
<!-- IF postrow.RANK_TITLE and postrow.RANK_IMG --><br />{postrow.RANK_IMG}</dd><!-- ENDIF -->


Rank Color if user has posted 100+ times:
Spoiler:
Code: Select all
<!-- IF postrow.POSTER_POSTS > '99' and postrow.RANK_TITLE --><dd><strong><font color="{postrow.PROFILE_RANKCOLOR_VALUE}">{postrow.RANK_TITLE}</font></strong><!-- ENDIF -->
<!-- IF postrow.POSTER_POSTS < '100' and postrow.RANK_TITLE --><dd><strong>{postrow.RANK_TITLE}</strong><!-- ENDIF -->
<!-- IF postrow.RANK_TITLE and postrow.RANK_IMG --><br />{postrow.RANK_IMG}</dd><!-- ENDIF -->

CLOSE and SAVE


Rank Color if user has posted 100+ times and Custom Rank if user has posted 250+ times:
Spoiler:
Code: Select all
<!-- IF postrow.POSTER_POSTS > '99' --><!-- IF postrow.POSTER_POSTS > '249' and postrow.PROFILE_CUSTOMRANK_VALUE != '' --><dd><strong><font color="{postrow.PROFILE_RANKCOLOR_VALUE}">{postrow.PROFILE_CUSTOMRANK_VALUE}</font></strong><!-- ELSE --><dd><strong><font color="{postrow.PROFILE_RANKCOLOR_VALUE}">{postrow.RANK_TITLE}</font></strong><!-- ENDIF --><!-- ENDIF -->
<!-- IF postrow.POSTER_POSTS < '100' and postrow.RANK_TITLE --><dd><strong>{postrow.RANK_TITLE}</strong><!-- ENDIF -->
<!-- IF postrow.RANK_TITLE and postrow.RANK_IMG --><br />{postrow.RANK_IMG}</dd><!-- ENDIF -->

CLOSE and SAVE
Last edited by King Rhyono on 29 Nov 2010, 22:47, edited 3 times in total.
King Rhyono
MOD Author
MOD Author
 
Posts: 174
Joined: 01 Aug 2007, 11:20
Gender: Male


Re: User defined rank color

Postby Highway of Life » 02 Feb 2008, 19:05

Excellent! :good:

Quick tip: <font> tag is depreciated, use <span style="color:xxxxxx;">
;)

Edit: Also, instead of <strong><font>, you would use: <span style="font-weight:bold; color:xxxxx">
Watch out! I might do a code wheelie!

User avatar
Highway of Life    
STG Jedi Master
STG Jedi Master
 
Posts: 10458
Joined: 08 May 2006, 05:23
Location: Beware of Programmers carrying screwdrivers
Gender: Male
phpBB Knowledge: 10

Re: User defined rank color

Postby King Rhyono » 02 Feb 2008, 19:15

Highway of Life wrote:Excellent! :good:

Quick tip: <font> tag is depreciated, use <span style="color:xxxxxx;">
;)

Edit: Also, instead of <strong><font>, you would use: <span style="font-weight:bold; color:xxxxx">

That gives a rather different result, I know what I used is depreciated, but I used it to give me the specific result I was going for.
King Rhyono
MOD Author
MOD Author
 
Posts: 174
Joined: 01 Aug 2007, 11:20
Gender: Male

Re: User defined rank color

Postby Highway of Life » 02 Feb 2008, 19:24

King Rhyono wrote:That gives a rather different result, I know what I used is depreciated, but I used it to give me the specific result I was going for.
What kind of result does it give you? :confused:
If it displays as a block-level element instead of of in-line (due to the CSS applied do that location), then simply use: display: in-line; within the style attribute.
Watch out! I might do a code wheelie!

User avatar
Highway of Life    
STG Jedi Master
STG Jedi Master
 
Posts: 10458
Joined: 08 May 2006, 05:23
Location: Beware of Programmers carrying screwdrivers
Gender: Male
phpBB Knowledge: 10

Re: User defined rank color

Postby King Rhyono » 02 Feb 2008, 19:40

I used strong because in the event the person chooses not to use a rank color, or doesn't qualify, their rank is black, instead of the dull color of a profile field value.
King Rhyono
MOD Author
MOD Author
 
Posts: 174
Joined: 01 Aug 2007, 11:20
Gender: Male

Re: User defined rank color

Postby Sniper_E » 02 Feb 2008, 20:15

I use this in SniperBlue:
Code: Select all
<td class="postdetails" align="center"><b class="genmed"<!-- IF postrow.POST_AUTHOR_COLOUR --> style="color: {postrow.POST_AUTHOR_COLOUR}"<!-- ENDIF -->>{postrow.RANK_TITLE}</b></td>
Maybe I should alter my codes a little also. :good:
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: 6981
Joined: 31 May 2006, 06:29
Location: Shreveport, LA
Favorite Team: The STG Team
Gender: Male
phpBB Knowledge: 6

Re: User defined rank color

Postby Highway of Life » 02 Feb 2008, 21:00

Sniper_E wrote:I use this in SniperBlue:
Code: Select all
<td class="postdetails" align="center"><b class="genmed"<!-- IF postrow.POST_AUTHOR_COLOUR --> style="color: {postrow.POST_AUTHOR_COLOUR}"<!-- ENDIF -->>{postrow.RANK_TITLE}</b></td>
Maybe I should alter my codes a little also. :good:
Instead of <b> you can use <strong>[/b] but instead of [c]<strong><span> or <strong><font> combination, it?s best to use <span style="font-weight:bold;"> font-weight:bold will achieve the same long as <strong> or <b>. In this case, you might use all three elements in the style attribute: <span style="font-weight:bold; display:in-line;<!-- IF colour token --> color: {colour token};<!-- ENDIF -->">. This will allow the "bold look", but if you want to have a black look, you can set <!-- ELSE --> for the if colour token and set color:black;
If it appears to be a "block" or wraps unexpectedly, this is because of an inherited style, display:in-line will solve that. :good:
Watch out! I might do a code wheelie!

User avatar
Highway of Life    
STG Jedi Master
STG Jedi Master
 
Posts: 10458
Joined: 08 May 2006, 05:23
Location: Beware of Programmers carrying screwdrivers
Gender: Male
phpBB Knowledge: 10

Re: User defined rank color

Postby Sniper_E » 02 Feb 2008, 21:55

Cool! :good: Got it....
Code: Select all
<td class="postdetails" align="center"><span class="genmed" style="font-weight:bold; display:in-line;<!-- IF postrow.POST_AUTHOR_COLOUR --> color: {postrow.POST_AUTHOR_COLOUR};<!-- ENDIF -->">{postrow.RANK_TITLE}</b></td>
I'll have to look at this format in other places also.
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: 6981
Joined: 31 May 2006, 06:29
Location: Shreveport, LA
Favorite Team: The STG Team
Gender: Male
phpBB Knowledge: 6

Re: User defined rank color and custom rank

Postby windstarfire » 08 Apr 2008, 06:37

thanks for this cool mod.

However is it possible to make it so that only custom ranks can be added in acp? (nothing to do with posts)
windstarfire
Crewman
Crewman
 
Posts: 1
Joined: 07 Feb 2008, 23:02
Gender: Male

Re: User defined rank color and custom rank

Postby King Rhyono » 10 Apr 2008, 15:39

windstarfire wrote:thanks for this cool mod.

However is it possible to make it so that only custom ranks can be added in acp? (nothing to do with posts)

I don't quite know what you mean.
King Rhyono
MOD Author
MOD Author
 
Posts: 174
Joined: 01 Aug 2007, 11:20
Gender: Male

Next

Return to Topic, Forum, Posting MOD Downloads

Who is online

Users browsing this forum: No registered users and 5 guests