Welcome Guest [Log In] [Register]
Search Members Calendar | Rules ZB Code Index IF Code Index
ZBCode
  • Navigation
  • ZBCode
  • Coding Resources
  • Zetaboards Modifications
  • Online/Offline Image by Name in Posts
Hey, welcome to ZBCode, the premier coding forum for ZB. Here you fill find some of the best Invisionfree and Zetaboards Codes on the network! Unfortunately, you're sorta hovering around in guest mode at the moment; why not join in on the fun? Register an account and you can start accessing the wealth of resources we have available here. Enjoy your stay at ZBCode, and remember to tell all your friends about us; the more members, the more codes available. ;)

Interested in joining? Click here.


If you are already a member of ZBCode, feel free to login right here:

Username:   Password:
Locked Topic
  • Pages:
  • 1
  • 2
  • 3
Online/Offline Image by Name in Posts
Tweet Topic Started: Sep 6 2009, 10:12 PM (2,664 Views)
Dorith Sep 6 2009, 10:12 PM Post #1
Member Avatar
Has just entered the Matrix

Posts:
2,069
Group:
Former Staff
Member
#1,854
Joined:
Dec 23, 2008
Online/Offline Image by Name in Posts
Ever wanted to have Online/Offline Images right by the users' name like in IPB Boards? Well here's your chance. Just add this code to your board and you should have that :P

Preview:
Posted Image
Posted Image

Code:
 
<script type="text/javascript">
//Online/Offline Image by Name in Posts by Dorith of ZBCode
function OnOffImg(imgalt,img_url){
$("img[alt='"+imgalt+"']").each(function(){
$(this).parents(".c_postfoot").prev().prev().prev().find("td.c_username").find("span:first").before("<img src='"+img_url+"'/> ")
});
}

OnOffImg("PM Online Member","http://z3.ifrm.com/104/14/0/p210225/user_on.png")
OnOffImg("PM Offline Member","http://z3.ifrm.com/104/14/0/p210224/user_off.png")
OnOffImg("Online","http://z3.ifrm.com/104/14/0/p210225/user_on.png")
OnOffImg("Offline","http://z3.ifrm.com/104/14/0/p210224/user_off.png")
</script>

Add to Below the Board.
Your images should have the "alt" already, so it shouldn't be a problem.

Online and Offline are for the groups/people that don't allow for PMs, so you might want to have those for them too ;)

If you have any problems or anything with this code feel free to post here or send me a PM.
Edited by Dorith, Sep 9 2009, 07:18 PM.
Posted Image
Posted Image
(Made emoticon using Codes Rock's Smiley Generator)
Offline Profile Goto Top
 
Desire Law Sep 6 2009, 10:49 PM Post #2


Posts:
114
Group:
Dedicated
Member
#3,362
Joined:
Jul 26, 2009
Coding language
None
Cool code! Thanks.
Offline Profile Goto Top
 
Nuke of Nukia Sep 7 2009, 05:40 AM Post #3
Member Avatar


Posts:
43
Group:
Member
Member
#2,919
Joined:
May 3, 2009
Coding language
HTML/CSS
Nice job, Dorith.
My board: UniverseWars
Offline Profile Goto Top
 
Gorgor Sep 7 2009, 06:05 AM Post #4
Hello

Posts:
1,187
Group:
Former Staff
Member
#2,728
Joined:
Apr 2, 2009
Coding language
PHP
Very nice code Dorith! :D

I'd use it on my forums but then all I'd see would be the offline images. (They're almost dead :O )
Offline Profile Goto Top
 
Kuzco Sep 7 2009, 06:36 AM Post #5
TMX

Posts:
117
Group:
Member
Member
#2,324
Joined:
Feb 14, 2009
Coding language
HTML/CSS
How would I go about adding a space between the image and the username? Tried working it out myself but failed miserably xD
Posted Image
Offline Profile Goto Top
 
Lout Sep 7 2009, 07:25 AM Post #6
Member Avatar


Posts:
402
Group:
Dedicated
Member
#2,400
Joined:
Feb 19, 2009
Kuzco
Sep 7 2009, 06:36 AM
How would I go about adding a space between the image and the username? Tried working it out myself but failed miserably xD
You could just make the image size a bit wider and set to the left so there is a transparent space to the right.
Posted Image
Offline Profile Goto Top
 
Kitsueki Sep 7 2009, 08:02 AM Post #7
Member Avatar
♠ Aizu

Posts:
742
Group:
Dedicated
Member
#3,453
Joined:
Aug 31, 2009
Nice one Dorith, im using it ^_~
Kingdom of Etruria
Spoiler: click to toggle
Kingdom of Etruria


Starring in the Medieval times, this Kingdom is an isolated territory not bothered by any other Kingdoms.
The military has recently caught on to something big, and its their job to stop it.
Will you walk your own path, or aid the Etrurian Military in exterminating the evil that is about to come forth?
It's Ready!

Kingdom of Etruria is a Roleplaying forum I created, also with the help of a few friends.
You can pick from many classes, fight any way you want, and gain rank in the military, or even start your own Faction.
It all starts with a Character Registration, if you're interested in taking part of this RP, PM me and I'll be sure to give you the link when I open it.
There are many things to do at Kingdom of Etruria, so be sure to find out for yourself
Thanks for reading!

Offline Profile Goto Top
 
Gorgor Sep 7 2009, 08:12 AM Post #8
Hello

Posts:
1,187
Group:
Former Staff
Member
#2,728
Joined:
Apr 2, 2009
Coding language
PHP
Kuzco
Sep 7 2009, 06:36 AM
How would I go about adding a space between the image and the username? Tried working it out myself but failed miserably xD
Add a space after <img src='"+img_url+"'/> in the following line:
Code:
 
$(this).parents(".c_postfoot").prev().prev().prev().children().children().find("span").prepend(" <img src='"+img_url+"'/>")
Offline Profile Goto Top
 
Dorith Sep 7 2009, 12:40 PM Post #9
Member Avatar
Has just entered the Matrix

Posts:
2,069
Group:
Former Staff
Member
#1,854
Joined:
Dec 23, 2008
Yeah, if you want some space, just do what Gorgor did: add some space in between the .prepend() and the <img src>.

And I'm glad everyone likes it. :)
Posted Image
Posted Image
(Made emoticon using Codes Rock's Smiley Generator)
Offline Profile Goto Top
 
Kuzco Sep 8 2009, 05:37 AM Post #10
TMX

Posts:
117
Group:
Member
Member
#2,324
Joined:
Feb 14, 2009
Coding language
HTML/CSS
Thanks for that, though I seem to be having a slight problem with the code now. It appears fine for all staff (both global and regular moderators), as well as administrators, though it isn't displaying correctly for regular members.

I've attached an example below:-

Spoiler: click to toggle
Posted Image

Here's what it looks like on both a regular member and a member with the following Suffix:
Code:
 
[sup]([b][color=#ec1ddb]r[/color][/b])[/sup]

It also appears next to all user IP's (not sure if this is supposed to happen, but regardless I like it).

Example: Posted Image

Thanks for the assistance :)
Posted Image
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
Go to Next Page
« Previous Topic · Zetaboards Modifications · Next Topic »
Locked Topic
  • Pages:
  • 1
  • 2
  • 3

Track Topic · E-mail Topic Time: 7:38 PM Jul 10
Hosted for free by ZetaBoards · Privacy Policy