News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

How to display user location under avatars

Started by MOCA CPU, August 20, 2012, 09:27:03 PM

Previous topic - Next topic

floridaflatlander

... also is that theme compatible with 2.02?

Shambles

Quote
and you added the above code in the php file "themes/default/Display.template.php" ?

Try adding it to Themes/core/Display.template.php

ModelBoatMayhem

#22
Added to themes/default/Display.template.php - Nope, still not showing.
Using built in "Core" Theme
That's my firm opinion.... but what do I know?!

floridaflatlander

Whenever I have a problem like this I'll try to remove as many variables as possible and use the simplest variable as possible.
In this case where to put the code. Next will be to see "if (!empty ($message['member']['location']))" works.

Try this, it should echo when you have it in the right file. When you find the right file, replace it with the if() statement, if the if() statement doesn't work it's another issue.

/// Show test echo for location
echo '
<li><b>TEST TEST TEST</b></li>';

ModelBoatMayhem

OK. lets assume that I don't know coding, php etc.... I struggle with notepad!

Take out the previous code edits and put this in it's place?

Where am I looking for the output?

That's my firm opinion.... but what do I know?!

floridaflatlander

Quote from: ModelBoatMayhem on October 29, 2012, 12:05:19 PM
OK. lets assume that I don't know coding, php etc.... I struggle with notepad!

Take out the previous code edits and put this in it's place?

Where am I looking for the output?



Yes, take out the previous edit and replace with the new code, or put it just under the previous code.

When you put the new code above it will look like this ...

TEST TEST TEST

Under your avatar.

ModelBoatMayhem

Thanks FFL.

That sort of works, see below - but not when I edit the default template - only when I edit the 'Core _ Display.template.php'


That's my firm opinion.... but what do I know?!

ModelBoatMayhem

When I edit 'Core _ Display.template.php' with ....

// Show location
if (!empty ($message['member']['location']))
echo '
<li>', $txt['location'], ':  <b>', $message['member']['location'], '</b></li>';


I get this.....
That's my firm opinion.... but what do I know?!

floridaflatlander

Quote from: ModelBoatMayhem on October 29, 2012, 12:15:00 PM
Thanks FFL.
That sort of works, see below - but not when I edit the default template - only when I edit the 'Core _ Display.template.php'


Okay that's where you should put the first code.

If it doesn't work then there is a problem with the if (!empty ($message['member']['location'])) statement .

Someone else started this post, I hope they didn't mark this solved. I've been wondering why no gurus have jump in on the conversation.

I don't understand your two new post.

ModelBoatMayhem

That's my firm opinion.... but what do I know?!

floridaflatlander


Shambles

Quote from: ShamPire on October 29, 2012, 10:09:48 AM
Try adding it to Themes/core/Display.template.php

So did that work then?

I only mentioned to try it, as a lot of your site's code is being pulled from the Core folders...

ModelBoatMayhem

Not really, it messed up the whole layout...




That's my firm opinion.... but what do I know?!

floridaflatlander

Quote from: ModelBoatMayhem on October 29, 2012, 05:22:39 PM
Not really, it messed up the whole layout...

Are you sure you didn't cut off a closing list ( <li></li>) tag?

You have a list in that div(poster) for info, it should work.

ModelBoatMayhem

I think you're right FFL!
I went back to the original file and reinserted the edit and it now works!

Thanks Chaps!  :)


// Show location
if (!empty ($message['member']['location']))
echo '
<li>', $txt['location'], ':  <b>', $message['member']['location'], '</b></li>';
That's my firm opinion.... but what do I know?!

floridaflatlander

Good, I went to your site and it looks great.
I made my locations bold print, if you ever want to remove the bold print just remove the <b> & </b> and NOTHING ELSE, make sure you leave every single quote and every charactor of </li>.

ModelBoatMayhem

That's my firm opinion.... but what do I know?!

Advertisement: