PDA

View Full Version : [RELEASE] Location, Interests, etc. in post!


14 Jul 2000, 21:59
Well, it's so simple, it's not even a hack in my book :)

I'm only giving example code for Location and Interests, but the rest are similar.

1.1.4 compliant



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Now, just reference $location and $interests in the postbit template.

Enjoy!

[Edited by Ed Sullivan on 12-04-2000 at 02:08 PM]

14 Jul 2000, 22:04
Thank you, thank you, thank you!!!!!!

This works perfectly! It was so important for me to have the interest & location fields on the posts, and now they are there!

15 Jul 2000, 11:10
thanks great work.. i added it to my forum and it works great :D

15 Jul 2000, 11:20
i have a problem in this thread is an example

http://www.animeboards.net/forums/showthread.php?threadid=565

my location display is repeated as the thread goes down ?

15 Jul 2000, 11:27
it seems that if a member does not have a location field in their profile the previous posts' user's location is added ?

15 Jul 2000, 14:13
ahh - oops. Simple fix.



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

15 Jul 2000, 14:34
thanks ed, but it didn't work ?

in this thread
http://www.animeboards.net/forums/showthread.php?threadid=539

user called Hiyoku

keeps on displaying the previous poster's location with an added 'Location:' in it

i.e.


Hiyoku
Member

Registered: Jul 2000
Location: Location: USA
Posts: 77

-------

Hiyoku
Member

Registered: Jul 2000
Location: Location: Brisbane, Australia
Posts: 77



from this thread
http://www.animeboards.net/forums/showthread.php?threadid=539 ?

15 Jul 2000, 14:40
oh yeah the exact same thing occurs with the interest info

where a user does not have an interest in their profile, they take the previous poster's interests

i.e. in the last post in

http://www.animeboards.net/forums/showthread.php?threadid=571


sorry not last post but further up

[Edited by eva2000 on 07-15-2000 at 10:50 AM]

15 Jul 2000, 19:55
Doh! Stupid me. Fixed the glitches in the original code.

Just add this code above the while(... line:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

15 Jul 2000, 20:03
but it's already there ? :confused:

whoops... sorry i didn't realise you edited and corrected the original post



[Edited by eva2000 on 07-15-2000 at 04:08 PM]

15 Jul 2000, 20:09
[post now null and void. But I don't feel like deleting it so nah!]

[Edited by Ed Sullivan on 07-15-2000 at 04:16 PM]

15 Jul 2000, 20:20
well thanks Ed... it works perfectly now http://www.vbulletin.com/forum/images/icons/icon14.gif

15 Jul 2000, 20:35
Yay!

16 Jul 2000, 00:04
Remove this part



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



and you can put the Location: part in the template

16 Jul 2000, 01:43
No John, that's intentional.

Otherwise, user's without a $location or $interests, will show up as:
Location:
Interests:As it is now, nothing will show up, making a cleaner display.

16 Jul 2000, 02:25
Even cleaner:

Old:
if ($location) { $location = "Location: $location"; }

New:
if ($location) { $location = "Location: $location<br>"; }

That way, if there's no location, there's no linefeed.

[Ed's Edit: Sorry, you missed a "$", fixed now]

[Edited by Ed Sullivan on 07-15-2000 at 10:47 PM]

16 Jul 2000, 03:05
Ah, that makes sense. :)

16 Jul 2000, 10:17
Originally posted by Dave Baker
Even cleaner:

Old:
if ($location) { $location = "Location: $location"; }

New:
if ($location) { $location = "Location: $location<br>"; }

That way, if there's no location, there's no linefeed.

[Ed's Edit: Sorry, you missed a "$", fixed now]

[Edited by Ed Sullivan on 07-15-2000 at 10:47 PM] hehe my members love the new addition by Ed :D what does it mean 'no linefeed' ?

16 Jul 2000, 21:18
Ed:

Don't you want to include:

if ($userinfo[receivepm]=="1") {
$pmlink = "<a href=\"private.php?action=newmessage&toid=$userinfo[userid]\"><img src=\"images/pm.gif\" border=0></a>&nbsp;";
} else {
$pmlink = "";
}

in this if you are using Private Messages 1.2?

Parker

17 Jul 2000, 01:59
By "no linefeed" I mean no blank line.

17 Jul 2000, 03:02
Parker - don't replace that part, I didn't tell you to :)

Only replace what I said to replace there with what I told you to replace it with - no more, no less. If you follow the directions, you will still have the other PM related stuff there.

17 Jul 2000, 17:29
just thought i'd add

the location/interest hack works on my upgraded 1.1.3 beta 3 forum too :D

thanks Ed :D

20 Jul 2000, 10:15
Ed, can you add a third field into there for me? Let's say I want to add "occupation" to it, how would add that in addition to the other ones?

20 Jul 2000, 15:32
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



[Edited by Ed Sullivan on 07-20-2000 at 11:34 AM]

31 Jul 2000, 16:22
okay... how does one reapply the location/interest hack in light of installing rangersfan's avatar hack at http://vbulletin.com/forum/showthread.php?threadid=2127 ?

31 Jul 2000, 16:55
Don't replace the $userinfo=$DB_site-> line, just add biography to where I told you to add if before. Then just add the rest of the code the same way.

31 Jul 2000, 17:28
Just add 'iconpath' along side 'biography.

31 Jul 2000, 17:44
do you mean add to showthread.php ? where ? in the below code ?

if ($userid!=0) {
$userinfo=$DB_site->query_first("SELECT userid,email,username,biography,usertitle,signature,showemail,homepage,icq,aim,y ahoo,joindate,posts FROM user WHERE userid=$userid");
$bio = split("\n", trim($userinfo[biography]));
$location = "";
$interests = "";
while(list($key,$val)=each($bio)) {
if (strlen(strpos($val, 'Location:'))) {
$location = eregi_replace("^Location:([^\\[]*)", "\\1", "$val");
} elseif (strlen(strpos($val, 'Interests:'))) {
$interests = eregi_replace("^Interests:([^\\[]*)", "\\1", "$val");
}
}
if ($location) { $location = "Location: $location"; }
if ($interests) { $interests = "Interests: $interests"; }

31 Jul 2000, 17:56
I don't really understand as you appear to have it working on your forum.

If you are trying to get the location back to working. Just add 'iconpath' in the following like this:

$userinfo=$DB_site->query_first("SELECT userid,email,username,biography,usertitle,signature,showemail,homepage,icq,aim,y ahoo,joindate,posts,iconpath

31 Jul 2000, 18:47
yeah i want to bring back location display...the thing is i have this already in showthreads

This is what i have:
[quote]if ($userid!=0) {
$userinfo=$DB_site->query_first("SELECT userid,email,username,usertitle,signature,showemail,homepage,icq,aim,yahoo,joind ate,posts,iconpath FROM user WHERE userid=$userid");
$bio = split("\n", trim($userinfo[biography]));
$location = "";
$interests = "";
while(list($key,$val)=each($bio)) {
if (strlen(strpos($val, 'Location:'))) {
$location = eregi_replace("^Location:([^\\[]*)", "\\1", "$val");
} elseif (strlen(strpos($val, 'Interests:'))) {
$interests = eregi_replace("^Interests:([^\\[]*)", "\\1", "$val");
}
}
if ($location) { $location = "Location: $location"; }
if ($interests) { $interests = "Interests: $interests"; }[quote]

31 Jul 2000, 19:08
You need to stick "biography" back in the field list. Add ",biography" after "iconpath"

31 Jul 2000, 19:49
yep, that worked adding ,biography after iconpath, line :D

yipee :D

thanks guys :)

06 Nov 2000, 11:28
This is a really nice hack, but it looks like the code changed in 1.14. I can't find anything that resembles this in showthread.php:

$userinfo=$DB_site->query_first("SELECT userid,email,username,usertitle,signature,showemail,homepage,icq,aim,yahoo,joind ate,posts FROM user WHERE userid=$userid");


Any plans on updating this, or is it better to wait until version 2.0?

Thanks,
TigerLily:)

06 Nov 2000, 11:54
Yep. Line has changed to:
$posts=$DB_site->query("SELECT post.dateline as dateline,post.postid as etc...

06 Nov 2000, 12:29
Tack this:
,user.biography as biography
to the end of the SELECT section.

07 Nov 2000, 19:53
Thanks, Ed, but I still can't get it to show up. I'm sure I'm doing something wrong! Since the code is different, where do you put this part?

$bio = split("\n", trim($userinfo[biography]));
$location = "";
$interests = "";
while(list($key,$val)=each($bio)) {
if (strlen(strpos($val, 'Location:'))) {
$location = eregi_replace("^Location:([^\\[]*)", "\\1", "$val");
} elseif (strlen(strpos($val, 'Interests:'))) {
$interests = eregi_replace("^Interests:([^\\[]*)", "\\1", "$val");
}
}
if ($location) { $location = "Location: $location"; }
if ($interests) { $interests = "Interests: $interests"; }


I've tried putting the code right beneath the changed line and farther down. I've called the $location in the templates, but nothing shows up. Not sure what I'm doing wrong!
TigerLily:)

07 Nov 2000, 21:04
Put that under
$userinfo = $post;

15 Nov 2000, 04:14
Thanks so much, Ed! Works like a charm now!
TigerLily:)

04 Dec 2000, 18:11
<bump>

Instructions for 1.1.4 in original post now.

11 Jan 2001, 04:45
Just thaught I would bring this back to the top and say it works fine with 1.1.5
just installed it on my test board
http://www.clubbers.ws/forums/showthread.php?threadid=1

05 Feb 2001, 06:39
Hi, I'm really whit all that.

Where i put the code. I really dont know what to do whit that code in the first post of that tread.:(

I dont find the line whit the SELECT thing in any templates. If i search at the right place. Anyone can help me a bit Pls.

05 Feb 2001, 08:29
you put it in the showthread.php file

05 Feb 2001, 16:05
Thx a lot Goldfinger, i will try it this morning.

05 Feb 2001, 19:28
not a problem thats what the forums are for.

06 Feb 2001, 12:43
Thx you very much guy :D