phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

Adding a link to Rank Image


 
Search this topic... | Search General Support... | Search Box
Register or Login to Post    Index » General Support  Previous TopicPrint TopicNext Topic
Author Message
ZP_Rantam
Board Member



Joined: 03 Feb 2013

Posts: 2



PostPosted: Sun Feb 03, 2013 12:36 pm 
Post subject: Adding a link to Rank Image

Hi - apologies in advance if this has been covered previously. I did a quick search and saw nothing that jumped out and screamed "relevant".

I'm running a forum on phpBB 2.0.17 - not exactly the latest version, but it works for what we need it for.

I'm looking for a way to add a link to the "rank images" - in order to, for instance, make them a link to a PayPal donation, or an off-forum FAQ. Is there a simple way to do this?
Back to top
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 628
Location: Spain


flag
PostPosted: Sun Feb 03, 2013 2:45 pm 
Post subject: Re: Adding a link to Rank Image

Hello,

First of all, you should take having your board up-to-date serious, updates usually involve security issues. This means that if your board is not running on the latest released version, phpBB2.0.23, some day you might find yourselves in trouble. Here on this board you can even find version 2.0.24, the first unofficial update for phpBB2.

To answer your question, the easiest qay to do this would be to open your templates viewtopic_body.tpl, search for
Code:
{postrow.RANK_IMAGE}
and place a link around it, like
Code:
<a href="Link_to_whatever.php">{postrow.RANK_IMAGE}</a>
and that's it.

Greetings.

_________________
phpBB2 will never die, I hope!
Back to top
lumpy burgertushie
Board Member



Joined: 18 Nov 2008

Posts: 266


flag
PostPosted: Wed Feb 06, 2013 1:08 pm 
Post subject: Re: Adding a link to Rank Image

dogs and things wrote:
Hello,

First of all, you should take having your board up-to-date serious, updates usually involve security issues. This means that if your board is not running on the latest released version, phpBB2.0.23, some day you might find yourselves in trouble. Here on this board you can even find version 2.0.24, the first unofficial update for phpBB2.

To answer your question, the easiest qay to do this would be to open your templates viewtopic_body.tpl, search for
Code:
{postrow.RANK_IMAGE}
and place a link around it, like
Code:
<a href="Link_to_whatever.php">{postrow.RANK_IMAGE}</a>
and that's it.

Greetings.


the only problem with that method is that it will make every rank image link to the same place. probably not what he wants.


robert
Back to top
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 628
Location: Spain


flag
PostPosted: Wed Feb 06, 2013 6:26 pm 
Post subject: Re: Adding a link to Rank Image

Possibly.
_________________
phpBB2 will never die, I hope!
Back to top
ZP_Rantam
Board Member



Joined: 03 Feb 2013

Posts: 2



PostPosted: Fri Feb 08, 2013 1:07 am 
Post subject: Re: Adding a link to Rank Image

dogs and things wrote:
Hello,

First of all, you should take having your board up-to-date serious, updates usually involve security issues. This means that if your board is not running on the latest released version, phpBB2.0.23, some day you might find yourselves in trouble. Here on this board you can even find version 2.0.24, the first unofficial update for phpBB2.

Trust me, you're preaching to the converted here. It's a matter of Guy #1 owning the servers, Guy #2 being the main "backend" guy, Guy #3 being the "phpBB specialist" of sorts, Guy #4 maintaining his own custom hack which the forum relies on pretty heavily (and of course Guy #4 has been incognito for about three years now), and me, Guy #5. Basically, upgrading would at least moderately inconvenience #s 2 and 3 and might completely break #4's hacks.

Thankfully, it's a pretty small community, and esoteric enough to not really attract the skiddie crowd.

dogs and things wrote:
To answer your question, the easiest qay to do this would be to open your templates viewtopic_body.tpl, search for
Code:
{postrow.RANK_IMAGE}
and place a link around it, like
Code:
<a href="Link_to_whatever.php">{postrow.RANK_IMAGE}</a>
and that's it.

Greetings.

(A very belated) thanks for this. Lumpy sorta took the words out of my mouth - this solution would be "okay", but an ideal solution would be if it could be segregated by rank, so only certain ranks would have the link. I may not be the main backend guy on this site, but I'm reasonably comfortable with code editing - just not very intuitive on my own, or else I'd likely have figured it out by now!

Thanks again for all your help, and greetings right back at you.
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 449
Location: Québec


flag
PostPosted: Fri Feb 08, 2013 1:36 pm 
Post subject: Re: Adding a link to Rank Image

In that case you'll have to generate it with PHP in viewtopic.php. Look for this (line 1158 in an unedited file):
Code:
$template->assign_block_vars('postrow', array(


You're going to want to add another variable, for example:
Code:
'POSTER_RANK' => $poster_rank,
'RANK_IMAGE' => $rank_image,
'RANK_LINK' => $rank_link,  // Custom donation link


Then before line 1158 you need to add the code that will define $rank_link for each particular post. Since we have $poster_rank right there and you know your way around PHP, that should be easy enough, you just need a few if/else checks. For example:
Code:
// Rank donation links
if ($poster_rank == "Newcomer") { $rank_link = 'http://phpbb2refugees.com/home'; }
elseif ($poster_rank == "Awesome Llama") { $rank_link = 'http://phpbb2refugees.com/llamas'; }
// etc
else { $rank_link = '#'; }

Make sure that your 'else' catches guests and deleted users (whose $poster_rank will be '') and does whatever you want with them.

And finally, tweak the template file a bit. The example above assumes that you will do this but you could do things differently:
CHANGE
Code:
{postrow.POSTER_RANK}

INTO
Code:
<a href="{postrow.RANK_LINK}" alt="Donate">{postrow.POSTER_RANK}</a>


Aaaand unless I overlooked something (I just woke up), that should do it! icon_smile.gif
Back to top
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Mon Feb 11, 2013 3:49 am 
Post subject: Re: Adding a link to Rank Image

ZP_Rantam wrote:
I'm running a forum on phpBB 2.0.17 - not exactly the latest version, but it works for what we need it for.

Sorry, I have to say it: update first of all!

_________________
Love your data! Back it up!
Back to top
drathbun
Board Member



Joined: 24 Jul 2008

Posts: 729
Location: Texas


flag
PostPosted: Thu Feb 14, 2013 5:18 pm 
Post subject: Re: Adding a link to Rank Image

The best solution would be to add a rank_link column in the ranks table and allow the admin to set the link destination via the ACP. Then everywhere the rank appears it would have to be made clickable.
_________________
phpBBDoctor Blog
Back to top
Display posts from previous:   
Register or Login to Post    Index » General Support  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT - 4 Hours
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0509 seconds using 16 queries. (SQL 0.0089 Parse 0.0007 Other 0.0413)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo