phpBB SnippetsNormal and Special Ranks Optimization

Post Reply
User avatar
Topic Starter
Restless Rancor
Great Britain

Site Admin
New Member
Posts: 48
Joined: October 15th, 2018, 3:14 pm
Age: 25
Location: Hampshire, England
Contact:

Normal and Special Ranks Optimization

#1

Post by Restless Rancor » October 15th, 2018, 7:32 pm


This snippet provides optimization for the Normal and Special Ranks ("NASR") extension, adds Normal and Special Ranks to the memberlist_body.html and memberlist_team.html pages and enables you to remove Rank Titles if a Rank Image is displayed.

It comes in three parts:
  1. NASR on memberlist_body.html and memberlist_team.html. [Go to...]
  2. NASR Optimization. [Go to...]
  3. Remove Rank Titles...
    1. ... if you followed Part 2. [Go to...]
    2. ... if you did not follow Part 2. [Go to...]
Note:
  • Part 1 and 3b do not technically need the NASR extension installed, however it is recommended.
  • Part 3 only removes Rank Titles if a Rank Image is displayed in the default Rank locations.
    • If that's only what you want to do, you can follow only Part 3b.
  • The Normal and Special Ranks extension was designed for phpBB 3.1.9, but works on 3.2.3 and is required for this snippet to fully function in its entirety.
Noted Contributors: GanstaZ



Tested On:

[Link]

Part 1: NASR on memberlist_body.html and memberlist_team.html: [Go to top]

Open: root/styles/prosilver/theme/common.css

Find:

Code: Select all

table.table1 span.rank-img {
	float: right;
	width: auto;
}
Add After:

Code: Select all

table.table1 span.vertical-align {
	vertical-align: middle;
}
Open root/memberlist.php

Find:

Code: Select all

'FORUMS'		=> $row['forums'],
'FORUM_OPTIONS'	=> (isset($row['forums_options'])) ? true : false,
'RANK_TITLE'	=> $user_rank_data['title'],
Add After:

Code: Select all

'U_POSTS'	    => $row['user_posts'],
Open root/styles/prosilver/template/memberlist_body.html

Find:

Code: Select all

<td><span class="rank-img"><!-- EVENT memberlist_body_rank_prepend --><!-- IF memberrow.RANK_IMG -->{memberrow.RANK_IMG}<!-- ELSE -->{memberrow.RANK_TITLE}<!-- ENDIF --><!-- EVENT memberlist_body_rank_append --></span><!-- IF S_IN_SEARCH_POPUP and not S_SELECT_SINGLE --><input type="checkbox" name="user" value="{memberrow.USERNAME}" /> <!-- ENDIF --><!-- EVENT memberlist_body_username_prepend -->{memberrow.USERNAME_FULL}<!-- IF memberrow.S_INACTIVE --> ({L_INACTIVE})<!-- ENDIF --><!-- EVENT memberlist_body_username_append --><!-- IF S_IN_SEARCH_POPUP --><br />[&nbsp;<a href="#" onclick="insert_single_user('#results', '{memberrow.A_USERNAME}'); return false;">{L_SELECT}</a>&nbsp;]<!-- ENDIF --></td>
In-Line Find:

Code: Select all

<td><span class="rank-img">
In-Line Add After:

Code: Select all

<span class="vertical-align">
In-Line Find:

Code: Select all

{memberrow.RANK_TITLE}<!-- ENDIF -->
In-Line Add After:

Code: Select all

{% if memberrow.USERNAME == "Special1" %}{% if memberrow.POSTS < 250 %}{% if not memberrow.RANK_IMG %}<br />Newbie{% else %}<br /><img src="images/ranks/new_member.png">{% endif %}{% endif %}{% endif %}
In that code:
  • Change Special1 to the exact username of a special ranked member.
  • Change 250 to the post count requirement of your first achievable normal rank.
  • Change Newbie to the title of your first normal rank.
  • Change images/ranks/new_member.png to the path and filename of that rank.
To add more special ranked members:
In-Line find the first:

Code: Select all

%}
In-Line Add Before:

Code: Select all

or memberrow.USERNAME == "Special2" 
  • Change Special2 to the new exact username.
  • Ensure there is a space either side of or and before %}.
  • Good: {% if memberrow.USERNAME == "special1" or memberrow.USERNAME == "special2" %}
  • Bad: {% if memberrow.USERNAME == "special1"ormemberrow.USERNAME == "special2"%}
To add more special ranks:
In-Line find the penultimate:

Code: Select all

{% endif %}
In-Line Add After:

Code: Select all

{% if memberrow.POSTS < 500 and memberrow.POSTS >= 250 %}{% if not memberrow.RANK_IMG %}<br />250 Posts!{% else %}<br /><img src="images/ranks/250_posts.png">{% endif %}{% endif %}
  • Change 500 to the post count requirement of the next achievable normal rank.
  • Change 250, 250 Posts! and images/ranks/250_posts.png to correspond with the new rank.
    • The first value should correspond with what you changed 250 to earlier.
Example Usage:

Code: Select all

{% if memberrow.USERNAME == "Bill" or memberrow.USERNAME == "Ted" or memberrow.USERNAME == "Rufus" %}{% if memberrow.POSTS < 250 %}{% if not memberrow.RANK_IMG %}<br />Newbie{% else %}<br /><img src="images/ranks/new_member.png">{% endif %}{% endif %}{% if memberrow.POSTS < 500 and memberrow.POSTS >= 250 %}{% if not memberrow.RANK_IMG %}<br />250 Posts!{% else %}<br /><img src="images/ranks/250_posts.png">{% endif %}{% endif %}{% if memberrow.POSTS < 1000 and memberrow.POSTS >= 500 %}{% if not memberrow.RANK_IMG %}<br />500 Posts!{% else %}<br /><img src="images/ranks/500_posts.png">{% endif %}{% endif %}{% if memberrow.POSTS < 5000 and memberrow.POSTS >= 1000 %}{% if not memberrow.RANK_IMG %}<br />1000 Posts!{% else %}<br /><img src="images/ranks/1000_posts.png">{% endif %}{% endif %}{% if memberrow.POSTS >= 5000 %}{% if not memberrow.RANK_IMG %}<br />5000 Posts!{% else %}<br /><img src="images/ranks/5000_posts.png">{% endif %}{% endif %}{% endif %}
Members with Special Ranks:
  • Bill
  • Ted
  • Rufus
Normal Ranks:
  • Newbie (Less than 250 posts)
  • 250 Posts! (Less than 500 posts, but greater than or equal to 250)
  • 500 Posts! (Less than 1000 posts, but greater than or equal to 500)
  • 1000 Posts! (Less than 5000 posts, but greater than or equal to 1000)
  • 5000 Posts! (Greater than or equal to 5000 posts)
Open root/styles/prosilver/template/memberlist_team.html

Find:

Code: Select all

<td><!-- IF group.user.RANK_IMG --><span class="rank-img">{group.user.RANK_IMG}</span><!-- ELSE --><span class="rank-img">{group.user.RANK_TITLE}</span><!-- ENDIF --><!-- EVENT memberlist_team_username_prepend -->{group.user.USERNAME_FULL}<!-- IF group.user.S_INACTIVE --> ({L_INACTIVE})<!-- ENDIF --><!-- EVENT memberlist_team_username_append --></td>
In-Line Find:

Code: Select all

<span class="rank-img">{group.user.RANK_IMG}
In-Line Add After:

Code: Select all

{% if group.user.U_POSTS < 250 %}<br /><img src="images/ranks/new_member.png">{% endif %}
In-Line Find:

Code: Select all

<span class="rank-img">{group.user.RANK_TITLE}
In-Line Add After:

Code: Select all

{% if group.user.U_POSTS < 250 %}<br />Newbie{% endif %}
In that code:
  • Change 250 to the post count requirement of your first achievable normal rank.
  • Change Newbie to the title of your first normal rank.
  • Change images/ranks/new_member.png to the path and filename of that rank.
  • There's no need to define usernames. I'm assuming all members on the team page will have a Special rank.
    • Should you need to add these, you'll need to use {% if group.user.USERNAME_FULL == "Special1" %}
To add more special ranked members:
In-Line Find:

Code: Select all

{% if group.user.U_POSTS < 250 %}<br /><img src="images/ranks/new_member.png">{% endif %}
In-Line Add After:

Code: Select all

{% if group.user.U_POSTS < 500 and group.user.U_POSTS >= 250 %}<br /><img src="images/ranks/250_posts.png">{% endif %}
In-Line Find:

Code: Select all

{group.user.RANK_TITLE}{% if group.user.U_POSTS < 250 %}<br />Newbie{% endif %}
In-Line Add After:

Code: Select all

{% if group.user.U_POSTS < 500 and group.user.U_POSTS >= 250 %}<br />250 Posts!{% endif %}
  • Follow the same principles as in memberlist_body.html to add more ranks.
Example Usage:

Code: Select all

		<td><!-- IF group.user.RANK_IMG --><span class="rank-img">{group.user.RANK_IMG}{% if group.user.U_POSTS < 250 %}<br /><img src="images/ranks/new_member.png">{% endif %}{% if group.user.U_POSTS < 500 and group.user.U_POSTS >= 250 %}<br /><img src="images/ranks/250_posts.png">{% endif %}{% if group.user.U_POSTS < 1000 and group.user.U_POSTS >= 500 %}<br /><img src="images/ranks/500_posts.png">{% endif %}{% if group.user.U_POSTS < 5000 and group.user.U_POSTS >= 1000 %}<br /><img src="images/ranks/1000_posts.png">{% endif %}{% if group.user.U_POSTS >= 5000 %}<br /><img src="images/ranks/5000_posts.png">{% endif %}</span><!-- ELSE --><span class="rank-img">{group.user.RANK_TITLE}{% if group.user.U_POSTS < 250 %}<br />Newbie{% endif %}{% if group.user.U_POSTS < 500 and group.user.U_POSTS >= 250 %}<br />250 Posts!{% endif %}{% if group.user.U_POSTS < 1000 and group.user.U_POSTS >= 500 %}<br />500 Posts!{% endif %}{% if group.user.U_POSTS < 5000 and group.user.U_POSTS >= 1000 %}<br />1000 Posts!{% endif %}{% if group.user.U_POSTS >= 5000 %}<br />5000 Posts!{% endif %}</span><!-- ENDIF --><!-- EVENT memberlist_team_username_prepend -->{group.user.USERNAME_FULL}<!-- IF group.user.S_INACTIVE --> ({L_INACTIVE})<!-- ENDIF --><!-- EVENT memberlist_team_username_append --></td>
Normal Ranks:
  • Newbie (Less than 250 posts)
  • 250 Posts! (Less than 500 posts, but greater than or equal to 250)
  • 500 Posts! (Less than 1000 posts, but greater than or equal to 500)
  • 1000 Posts! (Less than 5000 posts, but greater than or equal to 1000)
  • 5000 Posts! (Greater than or equal to 5000 posts)
Note: Rank Titles will only show on memberlist_body.html and memberlist_team.html if there is no Rank Image, which is the default phpBB behavior.

Part 2: NASR Optimization: [Go to top]

Open: root/ext/posey/nasr/styles/prosilver/template/event/ucp_pm_viewmessage_rank_after.html

Delete all lines.

Open: root/ext/posey/nasr/styles/prosilver/template/event/viewtopic_body_postrow_rank_after.html

Delete all lines.

Open: root/styles/prosilver/template/ucp_pm_viewmessage.html

Find:

Code: Select all

<!-- IF RANK_TITLE or RANK_IMG --><dd class="profile-rank">{RANK_TITLE}<!-- IF RANK_TITLE and RANK_IMG --><br /><!-- ENDIF -->{RANK_IMG}</dd><!-- ENDIF -->
In-Line Find:

Code: Select all

{RANK_IMG}
In-Line Add After:

Code: Select all

<!-- IF EXTRA_RANK_TITLE or EXTRA_RANK_IMG --><br />{EXTRA_RANK_TITLE}<!-- IF EXTRA_RANK_TITLE and EXTRA_RANK_IMG --><br /><!-- ENDIF -->{EXTRA_RANK_IMG}<!-- ENDIF -->
Open: root/styles/prosilver/template/viewtopic_body.html

Find:

Code: Select all

<!-- IF postrow.RANK_TITLE or postrow.RANK_IMG --><dd class="profile-rank">{postrow.RANK_TITLE}<!-- IF postrow.RANK_TITLE and postrow.RANK_IMG --><br /><!-- ENDIF -->{postrow.RANK_IMG}</dd><!-- ENDIF -->
In-Line Find:

Code: Select all

{postrow.RANK_IMG}
In-Line Add After:

Code: Select all

<!-- IF postrow.EXTRA_RANK_TITLE or postrow.EXTRA_RANK_IMG --><br />{postrow.EXTRA_RANK_TITLE}<!-- IF postrow.EXTRA_RANK_TITLE and postrow.EXTRA_RANK_IMG --><br /><!-- ENDIF -->{postrow.EXTRA_RANK_IMG}<!-- ENDIF -->

Part 3a: Remove Rank Titles (if you followed Part 2): [Go to top]

Open: root/styles/prosilver/template/memberlist_view.html

Find and Delete:

Code: Select all

<!-- IF RANK_TITLE --><dd style="text-align: center;">{RANK_TITLE}</dd><!-- ENDIF -->
Find and Delete:

Code: Select all

<!-- IF RANK_TITLE --><dt>{L_RANK}{L_COLON}</dt> <dd>{RANK_TITLE}</dd><!-- ENDIF -->
Open: root/ext/posey/nasr/styles/prosilver/template/event/memberlist_view_rank_avatar_after.html

Find and Delete:

Code: Select all

<!-- IF EXTRA_RANK_TITLE --><dd style="text-align: center;">{EXTRA_RANK_TITLE}</dd><!-- ENDIF -->
Open: root/ext/posey/nasr/styles/prosilver/template/event/memberlist_view_rank_no_avatar_after.html

Find and Delete:

Code: Select all

<!-- IF EXTRA_RANK_TITLE --><dt>&nbsp;</dt> <dd>{EXTRA_RANK_TITLE}</dd><!-- ENDIF -->
Open: root/styles/prosilver/template/ucp_pm_viewmessage.html

Find:

Code: Select all

<!-- IF RANK_TITLE or RANK_IMG --><dd class="profile-rank">{RANK_TITLE}<!-- IF RANK_TITLE and RANK_IMG --><br /><!-- ENDIF -->{RANK_IMG}<!-- IF EXTRA_RANK_TITLE or EXTRA_RANK_IMG --><br />{EXTRA_RANK_TITLE}<!-- IF EXTRA_RANK_TITLE and EXTRA_RANK_IMG --><br /><!-- ENDIF -->{EXTRA_RANK_IMG}<!-- ENDIF --></dd><!-- ENDIF -->
In-Line Find and Delete:

Code: Select all

{RANK_TITLE}
In-Line Find and Delete:

Code: Select all

<br />{EXTRA_RANK_TITLE}
Open: root/styles/prosilver/template/viewtopic_body.html

Find:

Code: Select all

<!-- IF postrow.RANK_TITLE or postrow.RANK_IMG --><dd class="profile-rank">{postrow.RANK_TITLE}<!-- IF postrow.RANK_TITLE and postrow.RANK_IMG --><br /><!-- ENDIF -->{postrow.RANK_IMG}<!-- IF postrow.EXTRA_RANK_TITLE or postrow.EXTRA_RANK_IMG --><br />{postrow.EXTRA_RANK_TITLE}<!-- IF postrow.EXTRA_RANK_TITLE and postrow.EXTRA_RANK_IMG --><br /><!-- ENDIF -->{postrow.EXTRA_RANK_IMG}<!-- ENDIF --></dd><!-- ENDIF -->
In-Line Find and Delete:

Code: Select all

{postrow.RANK_TITLE}
In-Line Find and Delete:

Code: Select all

<br />{postrow.EXTRA_RANK_TITLE}
Note: This only removes Rank Titles if the Rank Title and Rank Image are displayed at same time (if there is no rank image the title is always displayed on memberlist_body.html and memberlist_team.html.


Part 3b: Remove Rank Titles (if you did not follow Part 2): [Go to top]

Open: root/styles/prosilver/template/memberlist_view.html

Find and Delete:

Code: Select all

			<!-- IF RANK_TITLE --><dd style="text-align: center;">{RANK_TITLE}</dd><!-- ENDIF -->
Find and Delete:

Code: Select all

			<!-- IF RANK_TITLE --><dt>{L_RANK}{L_COLON}</dt> <dd>{RANK_TITLE}</dd><!-- ENDIF -->
Open: root/styles/prosilver/template/ucp_pm_viewmessage.html

Find:

Code: Select all

		<!-- IF RANK_TITLE or RANK_IMG --><dd class="profile-rank">{RANK_TITLE}<!-- IF RANK_TITLE and RANK_IMG --><br /><!-- ENDIF -->{RANK_IMG}</dd><!-- ENDIF -->
In-Line Find and Delete:

Code: Select all

{RANK_TITLE}
Open: root/styles/prosilver/template/viewtopic_body.html

Find:

Code: Select all

			<!-- IF postrow.RANK_TITLE or postrow.RANK_IMG --><dd class="profile-rank">{postrow.RANK_TITLE}<!-- IF postrow.RANK_TITLE and postrow.RANK_IMG --><br /><!-- ENDIF -->{postrow.RANK_IMG}</dd><!-- ENDIF -->
In-Line Find and Delete:

Code: Select all

{postrow.RANK_TITLE}
Note: This only removes Rank Titles if the Rank Title and Rank Image are displayed at same time (if there is no rank image the title is always displayed on memberlist_body.html and memberlist_team.html.

Version 1:
► Show Spoiler
Changelog:
► Show Spoiler
Last edited by Restless Rancor on October 18th, 2018, 2:41 pm, edited 1 time in total.


These aren't the droids you're looking for.

User avatar
Topic Starter
Restless Rancor
Great Britain

Site Admin
New Member
Posts: 48
Joined: October 15th, 2018, 3:14 pm
Age: 25
Location: Hampshire, England
Contact:

#2

Post by Restless Rancor » October 18th, 2018, 2:41 pm

18/10/2018 15:41 UTC+1, version 2.0.0:
  • Complete re-write
These aren't the droids you're looking for.

Post Reply

Topic Subscribers

1 user subscribed to this topic: Restless Rancor