I have searched and seen this question asked countless times. Sometimes answered, sometimes not.
I figured I would post my solution here in the Tips and Tricks forum, since this is likely the first place to look for this addition.
Please note that I have not tried this on versions previous to 1.0.3
Open Themes/Your_Theme_Folder/Display.template.php and find:
// Show their personal text?
ABOVE that, add:
// Show members location.
if (!empty($message['member']['location']))
echo '
', $txt[227], ': ', $message['member']['location'], '<br />
<br />';
Edit: I updated the code so it does not show, "Location: " if the user has not entered a location in their profile.
Sorry about the 'BUMP' hope you didn't spill anything.
I used to have this and somewhere along the line it has got lost.
I have the code to display the location, but what I want is to specify what is shown if they do not have their location in their profile i.e. Hopelessly lost ;)
Can someone point me in the right direction please?
[edit]It looks like this has replaced the code that specified the default
if (!empty($message['member']['location']))
echo '
', $txt[227], ': ', $message['member']['location'], '<br />
<br />';
Here's how I would go about this:
Open Themes/Your_Theme_Folder/languages/index.english.php and find:
$txt[227] = 'Location';
BELOW that add:
$txt[hopelost] = 'Hoplessly lost';
Now open Themes/Your_Theme_Folder/Display.template.php and find:
// Show their personal text?
ABOVE that, add:
// Show members location.
if (!empty($message['member']['location']))
echo '
', $txt[227], ': ', $message['member']['location'], '<br />
<br />';
elseif (empty($message['member']['location']))
echo '
', $txt[227], ': ', $txt[hopelost], '<br />
<br />';
You've got it :D
I can edit 'Default personal text:' in Edit Features and Options, which currently is "I haven't noticed this yet' but would like to also have default location text.
You are probably getting the impression that I'm a bit of a PNL taker, (http://www.nokonium.plus.com/black-cat/nice/transform.gif)
P.S.
PNL=Post Nutritive Liquid
Ohhh, I see.. You would like to be able to set the "default location text" via the admin control panel?
Hmm, that's not a bad idea, let me look into it a bit.
EDIT: Sorry, I also modified my above post to show you how to do this in a simple way, just incase you missed it.
Did you mean index.english.php?
Quote from: XBleed on June 26, 2005, 02:32:36 PM
Ohhh, I see.. You would like to be able to set the "default location text" via the admin control panel?
Hmm, that's not a bad idea, let me look into it a bit.
That looks like an even better idea
Quote from: nokonium on June 26, 2005, 02:33:27 PM
Did you mean index.english.php?
Yeah, sorry. Just updated.
Quote from: nokonium on June 26, 2005, 02:34:49 PM
That looks like an even better idea
Yeah, I'm not sure how to go about it yet. I'll let you know if I figure it out.
Thanks
Cool tip! Thank you very much :)
I also wanted to know--where would you put the bold tags to make "Location: " in Bold. I'm not too familiar with coding php, and I don't know where I can put it.
-Shayna
Thanks. :)
If you want to make "Location:" bold, put <strong></strong> tags around $txt[227]. For example:
// Show members location.
if (!empty($message['member']['location']))
echo '
<strong>', $txt[227], ':</strong> ', $message['member']['location'], '<br />
<br />';
Oh okay--thank you so much!
BTW, I noticed that for some reason, it generated an entry for guests in the error log.
8: Use of undefined constant hopelost - assumed 'hopelost'
/home2/crystall/public_html/wits/forum/Themes/Starry_Night/index.template.php (eval?)
144
Is there anyway to stop that?
-Shayna
Put quotes around the word "hopelost".
-[Unknown]
In english.template, index.template or both?
Well, you'll probably see it like this:
[hopelost]
Change it to:
['hopelost']
-[Unknown]
How would one go about changing the word in register and on post to say :
the word City as opposed to Location.
We deal as a County Group and need ppl putting a city.
Although ppl put the counties name when it says location.
So if we put city they would most likely do it correctly,
then I would ad the show location( city) in postings.
Thanks
Cozmo
Replace:
', $txt[227], '
With:
City
-[Unknown]
Which file would this be in?
And is this with the quotes ?
Thanks
Paul
With the quotes - in the same file as is mentioned in the first post.
-[Unknown]
QuoteOk, just checking wanted to make sure .
Thanks Unknown.
Cozmo
I hate bumping old threads, but I'm trying to add this to my forum and I've tried to edit the file, but there is not a line that says "Show personal text"...
I tried inserting the code after the lines that would display "Hero Member" etc. but it didn't work.
Suggestions??
Look for:
if (!empty($settings['show_blurb']) && $message['member']['blurb'] != '')
-[Unknown]
How do I show the location info in the index template?
-Scott
thanks for this code.
i specially find the "hopelessly lost" funny :D
Quote from: -Scott on August 26, 2005, 06:12:25 PM
How do I show the location info in the index template?
I suppose you could use $GLOBALS['user_settings']['location'].
-[Unknown]
i found this error in my error log:
Quote8: Use of undefined constant hopelost - assumed 'hopelost'
File: /discussion/Themes/default/index.template.php (eval?)
Line: 619
what could that "use of undefined constant" mean? i tried looking for line 619, but index.template.php doesn't have that line
Quote from: [Unknown] on August 26, 2005, 01:13:39 AM
Look for:
if (!empty($settings['show_blurb']) && $message['member']['blurb'] != '')
-[Unknown]
That's not in my theme either. :( I'm using the ChatBubbles theme.... which doesn't have either of the lines. When I try to add the code it barfs on me for some reason.
RoAcH
Hi,
This is great but how can we limit the number of characters users can put on thier profile for location?
I just tested someone can put a whole essay there, and it will show up in the posts.
this should be an option they fix in the next release....my forum no longer shows location in each post either
// Show their personal text?
I really cant find this, been looking at it line per line but cant see it, anyone can say in what part of the BoardIndex.template.php I can find it?
Edit: Okay my mistake, BoardIndex.template.php was wrong, fixed now.
I`m not what this mod does, but I was after a hack that added a users location underneath their avatar or post count when they post something. Does this do that?
Aye this does that, or maggies code
http://www.simplemachines.org/community/index.php?topic=140080.msg933825#msg933825
Is it posible to code so that location in threads dont show if your a guest?
/Johan
can anyone help me?
there's no Display.template.php in my theme folder? Theme is: SullenMadness_RC2