PDA

View Full Version : Smilies in user titles


Zzed
08-27-2002, 10:00 PM
This is a very simple, yet fun hack that I made on my site. It allows the user titles to have smilies in them.

Here is the thread view and the profile view of the hack:
http://www.ls1.com/forums/showthread.php?threadid=110647
http://www.ls1.com/forums/member.php?action=getinfo&userid=4112

It is accomplished by adding one line of code to the following files:

forumdisplay.php
member.php
private.php
admin/functions.php

In forumdisplay.php:
Look for the following code:

if ($announcement[customtitle]==2) {
$announcement[usertitle] = htmlspecialchars($announcement[usertitle]);
}

And replace it with the following:

if ($announcement[customtitle]==2) {
$announcement[usertitle] = htmlspecialchars($announcement[usertitle]);
}
$announcement[usertitle]=bbcodeparse($announcement[usertitle]);


In member.php
Look for the following code:

eval("dooutput(\"".gettemplate("getinfo")."\");");

And replace it with the following:

$userinfo[usertitle]=bbcodeparse($userinfo[usertitle]);
eval("dooutput(\"".gettemplate("getinfo")."\");");


In private.php
Look for the following code:

if ($post[customtitle]==2) {
$post[usertitle] = htmlspecialchars($post[usertitle]);
}

And replace it with the following:

if ($post[customtitle]==2) {
$post[usertitle] = htmlspecialchars($post[usertitle]);
}
$post[usertitle]=bbcodeparse($post[usertitle]);


In admin/functions.php
Look for the following code:

if ($post[customtitle]==2) {
$post[usertitle] = htmlspecialchars($post[usertitle]);
}

And replace it with the following:

if ($post[customtitle]==2) {
$post[usertitle] = htmlspecialchars($post[usertitle]);
}
$post[usertitle]=bbcodeparse($post[usertitle]);


Enjoy... :)

Link14716
08-27-2002, 11:31 PM
Nice. I dunno if I'll use it right away (server problems), but nice indeed. ;)

N9ne
08-27-2002, 11:40 PM
Is it possible to make it so we can use vBcode in usertitles too? And be able to, through the adminCP disable certain vBcodes from being used?

Zzed
08-27-2002, 11:42 PM
Link14716, thank you. You are very kind. :)

Tha Rock, this hack will allow you to use VBcode in the title. ;) To disable certain VBcodes would require additional coding. :(

Lanigironu
08-27-2002, 11:50 PM
That's pretty cool. Too bad most admins on my board seem to have an angry attitiude towards smilies. I even had to completely remove them from posts :(.

Erwin
08-28-2002, 12:45 AM
Originally posted by Lanigironu
That's pretty cool. Too bad most admins on my board seem to have an angry attitiude towards smilies. I even had to completely remove them from posts :(.

You have harsh admins! :eek:

Boofo
08-28-2002, 01:07 AM
I can't get them to show up. All I see is the code for the smile next to the name. Ok, Zzed, what am I doing wrong this time? :)

Zzed
08-28-2002, 01:38 AM
Originally posted by Boofo
I can't get them to show up. All I see is the code for the smile next to the name. Ok, Zzed, what am I doing wrong this time? :)
Hmm, which file is giving you problem?

Can you Email it/them to me at edwink@seebeyond.com? :)

Boofo
08-28-2002, 01:56 AM
I guess I should learn the difference between usertitle and unsername, huh? :) My fault. Duhhh!!! (Sorry about that). But there is the user part that is the same. Does that count? :)

I have 2 additions for you, though. I have the usertitle in the memberlist and on the foumhome. So here is the code I added to those files.

In root/memberlist.php
Look for the following code:

$userinfo[datejoined]=vbdate($dateformat,$userinfo[joindate]);

And add the following AFTER it:

$userinfo[usertitle] = htmlspecialchars($userinfo[usertitle]);
$userinfo[usertitle]=bbcodeparse($userinfo[usertitle]);


In root/index.php
Look for the following code:

// get total posts

And add the following ABOVE it:

$bbuserinfo[usertitle] = htmlspecialchars($bbuserinfo[usertitle]);
$bbuserinfo[usertitle]=bbcodeparse($bbuserinfo[usertitle]);

bonnmac
08-28-2002, 02:02 AM
Without sounding to stupid.... How do you add the smilies?

Lanigironu
08-28-2002, 02:53 AM
Originally posted by Erwin


You have harsh admins! :eek:

Nah, it's just that we've had our share of idiots that just outright abused the smilies.

bonnmac: I'm assuming this uses the same smilies you have installed for posts.

Boofo
08-28-2002, 02:58 AM
Go to where you added your smiles in the Admin CP and look at whatever code you used for them and then just add that code wherever you want it to be in your usertitle (i.e. Admin). Most of them are probably generic.

Originally posted by bonnmac
Without sounding to stupid.... How do you add the smilies?

Zzed
08-28-2002, 03:44 AM
Boofo, I'm glad you got it working. :)

zootsuit
08-28-2002, 03:54 AM
This is a killer lil hack!

Thanks! :)

Zzed
08-28-2002, 03:58 AM
Originally posted by zootsuit
This is a killer lil hack!

Thanks! :)

Thank you. You are very kind. :)

bonnmac
08-28-2002, 04:04 AM
Thanks but I must be dummer then I thought.....
I go to my user cp and under edit profile/custom user text/new title.... Then I put in Administrator :bkiss: and I don't get the smilie I just get the code.... What am I doing wrong?

Zzed
08-28-2002, 04:09 AM
Please forgive my ignorance. Did you install the hack?

Does your title still show up as the code in thread view, or your profile?

bonnmac
08-28-2002, 04:25 AM
You know what.... I'm having a bad day... I'm sorry I had missed one step in the hack.. It is working now... Thanks! It's a great hack!

Zzed
08-28-2002, 06:24 AM
Very cool. I'm glad you got it working. :)

And thank you for the kind words. :)

Neo
08-28-2002, 01:28 PM
LOL you did this the hard way :p
I can do it with one line of code added.

Boofo
08-28-2002, 01:32 PM
And? Let's have it. Please? ;)

Originally posted by Neo
LOL you did this the hard way :p
I can do it with one line of code added.

Neo
08-28-2002, 01:45 PM
wait a min

Boofo
08-28-2002, 01:52 PM
Ok, that will work if you only want it in the posts. What about the member.php? And I have the usertitle on my forumhome and use $bbuserinfo[usertitle]. :) And the announcements one was included in the hack, too. ;) Is there a way to include them all in one line of code? Globally? Buddy, friend, pal o' mine? :):)

Originally posted by Neo
sure..

in admin/functions.php find


if ($post['receivepm'] and $enablepms==1) {
eval("\$post[pmlink] = \"".gettemplate("postbit_sendpm")."\";");
} else {
$post[pmlink] = "";
}


and place this below it and it should work perfectly.


$post[usertitle] = bbcodeparse($post[usertitle],0,$allowsmilies);

Neo
08-28-2002, 01:55 PM
yes yes.. I had it somewhere but since I my server went down I lost alot of code... he should really use the function this way...


$var[usertitle] = bbcodeparse($var[usertitle],0,$allowsmilies);

Boofo
08-28-2002, 01:58 PM
Will that handle all of the different user titles and where should we put this, sir? :)

Originally posted by Neo
yes yes.. I had it somewhere but since I my server went down I lost alot of code... he should really use the function this way...


$var[usertitle] = bbcodeparse($var[usertitle],0,$allowsmilies);

Neo
08-28-2002, 02:10 PM
well I am saying hs used this

bbcodeparse($announcement[usertitle]);

I should be changed to the code I used.. it makes it more forum dynamic... but if I get it to work again I will post it

Boofo
08-28-2002, 02:13 PM
So, then there really is no way to get all of the different user title variables in one piece of code and do it globally then? It was worth a shot. :)

welsper
10-05-2002, 08:37 PM
It works in 2.2.8, if anyone is curious. (Installed!)

Merjawy
10-06-2002, 02:09 AM
this is funny, I just saw this thread tonight.. and only today one of my forum users put a smile in her title and it just did not show as a smile :) now thats odd that I find this..


thanks mate for the hack I am gonna do it:)

Zzed
10-06-2002, 02:20 AM
Originally posted by Merjawy
this is funny, I just saw this thread tonight.. and only today one of my forum users put a smile in her title and it just did not show as a smile :) now thats odd that I find this..


thanks mate for the hack I am gonna do it:)

Thank you for the kind words. :)