Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Thema gestartet von: augrunt in Februar 06, 2006, 04:53:49 VORMITTAG

Titel: If Location is Present this Mod Will Display it!
Beitrag von: augrunt in Februar 06, 2006, 04:53:49 VORMITTAG
Yep, I've just perfected the code. This code will give you the ability to display you're members locations.

I've made it because i've recently set my Location to "Required".

So i had to think of a way to clean the mess off my board... all the Location: were starting to get to me. So i figured out what the code was... how it worked with the others and i came up with this


//augrunt's modifications... If the Location has been Entered in by a Member, If not it'll be blank. This took a while to figure out, enjoy!
if (!isset($message['location']) && $message['member']['location'] != '')
                                echo '
                                                                ', $txt[227], ': ', '<i />', $message['member']['location'], '</i><br /><br />';


Note: I added that //augrunt so it can explain to u how it works, please don't remove it, i love checking site's code to see if there using 1 of my modifications, i only recently moved to PHP.

Instructions:

This code goes in "your-theme/display.template.php"

Below
// Show online and offline buttons?

and Above
// Show the member's gender icon?
Titel: Re: If Location is Present this Mod Will Display it!
Beitrag von: Dannii in Februar 06, 2006, 05:42:39 VORMITTAG
<i />
What is that foward slash doing there?
Titel: Re: If Location is Present this Mod Will Display it!
Beitrag von: augrunt in Februar 06, 2006, 05:44:44 VORMITTAG
Zitat von: eldacar in Februar 06, 2006, 05:42:39 VORMITTAG
<i />
What is that foward slash doing there?

Trust me its best to keep it like that, its how all the other code is written... i think if u do it like <i> it likes this it causes a database error. and my motto is, if it works like that dont touch it.
Titel: Re: If Location is Present this Mod Will Display it!
Beitrag von: DrDom in Februar 06, 2006, 09:36:18 VORMITTAG
This has been covered a few times in the last couple of years, I'm sure you would have found it using the search function.
Never the less, you have now posted it for others to see and use, which has to be a good thing.

Titel: Re: If Location is Present this Mod Will Display it!
Beitrag von: augrunt in Februar 06, 2006, 10:32:23 VORMITTAG
no it hasnt... this code hides the location if it isnt present... the other one displays *Location:* if nothing was there... belive me i looked i only code something if its unique...
Titel: Re: If Location is Present this Mod Will Display it!
Beitrag von: DrDom in Februar 06, 2006, 03:46:12 NACHMITTAGS
Zitat von: DrDom in Februar 06, 2006, 09:36:18 VORMITTAG
This has been covered a few times in the last couple of years, I'm sure you would have found it using the search function.
Never the less, you have now posted it for others to see and use, which has to be a good thing.
Zitat von: augrunt in Februar 06, 2006, 10:32:23 VORMITTAG
no it hasnt... this code hides the location if it isnt present... the other one displays *Location:* if nothing was there... belive me i looked i only code something if its unique...

Link 1 October 17 2004 (http://www.simplemachines.org/community/index.php?topic=18340.0)
Link 2 May 23 2005 (http://www.simplemachines.org/community/index.php?topic=36714.0)
I couldnt be bothered to look for more, but i feel confident there will be.
Titel: Re: If Location is Present this Mod Will Display it!
Beitrag von: mynameisjonas in Mai 23, 2007, 11:18:43 VORMITTAG
thanks for this mod! it's exactly what i need.
just one question though, can you get it to just display the actual location, without "Location:" before?