MyBB Community Forums

Full Version: Location under user info when posting
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
How can i make it so that it shows the location of a user under there nick.

Picture with example

[Image: attachment.php?aid=812]
Hmm, this will require a bit of code in showthread if you plan on adding the work Location: cause what if they havn't entered where they live Toungue Anyway, I believe, to get the england part, adding $post[fid2] to the postbit template should work.
And what if i wanted to Location to be for example with red color ? how to add the color ?
Cheers dude i've got somthing to work

its 1 btw for the location info

Cheers again your a great help mate 10/10 again Cool
i think you could do something like

if($post['fid1'])
	{
		$post['fid1'] = htmlspecialchars($post['fid1']);
		$location = "Location: " . $post['fid1'];
	}
	else
	{
		$location = "";
	}

in showthread.php then in the postbit template if you add $location, it will only show it if its set
no need

just got to postbit template and add this

FIND
$lang->postbit_status $onlinestatus$replink<br />

UNDER ADD
<font color= "red">Location: $post[fid1]<font>

EXAMPLE - Location: England

if you want only the location info to be red and not the location title

do

Location:<font color= "red">$post[fid1]<font>

EXAMPLE - Location: England

Cheers to K776 for his good info that solved this for me

Cheers bud
HTML will not be filtered out then and users will be able to enter HTML in to the field and it will be displayed.

As Dempsey said, you will need to add some code. Add it to the makepostbit function in inc/functions_post.php

Chris
and also by adding the code to the makepostbit function you can only show the 'Location:' text if the location is set
ahhhh i see. will have a play
Thought I would post exactly what worked for me on http://www.agroots.com/forum

An example thread can be found at http://www.agroots.com/forum/tid4pid9#pid9 where the first post does not have a Location (as of this post) and the 2nd post has a location.

If the user has a location entered, it will show it - otherwise it won't show anything.

Find this code in inc/functions_post.php (Line 392)
if($usergroup['image'] != "")
{
$usergroupimage = "<img src=\"".$usergroup['image']."\" border=\"0\" alt=\"".$usergroup['title']."\">";
}

And add this code right after it:
//Adds Location to the profile in thread view
if($post['fid1']!="")
{
$post['fid1'] = htmlspecialchars($post['fid1']);
$location= "Location: " . $post['fid1'] . "<br />";
}		
else
{
$location = "";
}

Then in the postbit template, add:
$location

right after:
$lang->postbit_status $onlinestatus$replink<br />
Pages: 1 2