Log in

View Full Version : Avatar's opacity according to user's status (online/offline)


VBDev
04-30-2004, 10:00 PM
Avatar's opacity according to user's status (online/offline)

Total hack's description : http://www.vbulletindev.net/forums/hacks_root.php?do=aff_hack&hackid=72

http://www.vbulletindev.net

Please click https://vborg.vbsupport.ru/ (https://vborg.vbsupport.ru/vborg_miscactions.php?do=installhack&threadid=64606) if you like this hack


Requested here, some people said it could be found on vBT, but it requires code modification to work, it was requested on our forum too, that's why I created it and release it here

With this small hack, in postbit, if the user is connected, his avatar will be displayed normally, else it will be less visible

New modifications :
- Avaible in memberlist too
- Browser detection (mozilla)

SC (still can't attach them)

http://www.gd3n.firstream.net/online.gif

http://www.gd3n.firstream.net/offline.gif

http://www.gd3n.firstream.net/memberlist.gif

M1th
05-01-2004, 02:32 PM
You will need to set the -moz-opacity as well, otherwise, it'll only work in IE.

Boofo
05-01-2004, 02:35 PM
You will need to set the -moz-opacity as well, otherwise, it'll only work in IE.

How do you do that?

VBDev -- Great hack. Clicked install! ;) Any way we can do this for the memberlist also?

VBDev
05-01-2004, 02:38 PM
I'll think about that Boofo, I have to go now and I'm really busy in this moment, I'll look for it this night ;)

Boofo
05-01-2004, 02:50 PM
I'll think about that Boofo, I have to go now and I'm really busy in this moment, I'll look for it this night ;)

That's ok, no worry. I'll figure it out. ;)

Red Blaze
05-01-2004, 04:26 PM
Works great, thank you. :)

* Red Blaze clicks install

Diva
05-01-2004, 04:32 PM
That's ok, no worry. I'll figure it out. ;)

So... did you? ;)

MrNase
05-01-2004, 04:32 PM
filter:alpha(opacity=50);

becomes

-moz-opacity:0.5;

in Mozilla :)

Zachery
05-01-2004, 04:43 PM
another template edit turned hack :)

Fluous
05-01-2004, 05:08 PM
So is this all updated to work with mozilla now?

Boofo
05-01-2004, 05:47 PM
filter:alpha(opacity=50);

becomes

-moz-opacity:0.5;

in Mozilla :)

Do we change it or add that? I run IE.

Boofo
05-01-2004, 05:49 PM
So... did you? ;)

Check out my memberlist. While you're at it, check out the Edit Avatar and let me know what you think. ;)

Boofo
05-01-2004, 05:51 PM
another template edit turned hack :)

Ok, Zach, buddy, pm me the code that will work for the postbit and the memberlist, if you would. I'd like to see it. ;)

VBDev
05-01-2004, 06:04 PM
Boofo, I'll dot if for memberlist I said ;)

I'll check for Mozilla too with an automatic detection according to user's browser

Boofo
05-01-2004, 06:53 PM
Boofo, I'll dot if for memberlist I said ;)

I'll check for Mozilla too with an automatic detection according to user's browser

Already got the memberlist done. Took me all of 2 minutes after I left that message. Your code was excellent and easy to adapt for the memberlist. ;)

I will be interested in the mozilla and browser detection part though. ;)

VBDev
05-01-2004, 07:00 PM
Yes, with the code it's not hard ;)
But not easy for everybody, to place it at a good place ...

I go out now, I do it this night

Pseudomizer
05-01-2004, 07:02 PM
Please tell us when you have finished this for all browsers. My members are using IE, Mozilla and Opera. As soon as you can provide this hack for all these browser i will be the first one to install it. Good job so far. Respect.

Cheers,

Boofo
05-01-2004, 07:03 PM
All I did was place it below the same code you did for the postbit. And it worked the first time. ;)

VBDev
05-02-2004, 01:22 AM
Ok, now avaible in memberlist and with browser detection :)

If you have already installed this hack, just replace the code in functions_showthread.php with the new one

For memberlist, add code for the memberlist.php and the modification in memberlist template

Fluous
05-02-2004, 03:12 AM
When I search for avatarurl in my default memberlist template it cant even find it. Any idea?

Boofo
05-02-2004, 03:13 AM
You need to sure for avatar in the memberlistbit template.

Fluous
05-02-2004, 03:15 AM
Whats that mean? And now I just checked to see what it would look like in a post, and theres a clickable < next to the avatar online or off :S

edit: nevermind, I got the < out. Now the memberlist :S

Also, why I am here, is there a way to take off those stupid little online things next to a username? Whenever you add glow from the store, it makes a square around the button and makes it ugly

Boofo
05-02-2004, 03:40 AM
Just look for $onlinestatus.

Fluous
05-02-2004, 04:02 AM
K, i just wiped out the whole postbit_online_status and the thing doesnt show up by the names which is good. Now for the memberlist.

Pseudomizer
05-02-2004, 11:20 AM
Hi @LL,

this is a nice hack but i have 2 problems with it. The first is obvious:

- Opera does not care about these settings. The pics are fully highlighted even if the user if of. Any solution for this ?

- When i click in my NAVBAR on memberlist i have to wait for about 10 seconds until i receive the first page. Every subpage runs like hell but not when i am in my forum home and when i click on memberlist. If i remove your hack my memberlist runs without any problems. Too many queries ?

By the way: I am not using Gold. I am using standard 3.0.0 and due to this i had the edit my memberlist_resultsbit. I could not find your requested replace code in any other template.

Cheers,

msimplay
05-02-2004, 12:16 PM
could u make this for member info aswell please ?

member appears online even when they have set themselves to invisable

VBDev
05-02-2004, 07:18 PM
@Pseudomizer : for the problem of loading of your memberlist.php, I don't think it comes from the hack. It adds no queries, the code to add is really simple and can't block the load for a so long time ... perhaps it comes from your browser (opera) which can't interpret the -moz- style setting the first time

Does someone know if filter:alpha(opacity=X) works with Opera, if yes, I have only a small mod to do in my code ;)

For the memberlist_resultsbit, you're right, I commit a mistake, the mod has to be done in this template

@msimplay : hurm, yes I'll look for it in memberinfo

Pseudomizer
05-02-2004, 07:27 PM
@Pseudomizer : for the problem of loading of your memberlist.php, I don't think it comes from the hack. It adds no queries, the code to add is really simple and can't block the load for a so long time ... perhaps it comes from your browser (opera) which can't interpret the -moz- style setting the first time

Does someone know if filter:alpha(opacity=X) works with Opera, if yes, I have only a small mod to do in my code ;)

For the memberlist_resultsbit, you're right, I commit a mistake, the mod has to be done in this template

@msimplay : hurm, yes I'll look for it in memberinfo

Hi VBDev,

it is not a problem of queries. But it seems to be a problem with your hack. When i remove your hack all works fine with IE and Opera in terms of performance. When i implement your hack the IE seems to hang for 10 seconds. The opera does not care about your hack and due to this it shows up immediately without any delay.

I know it sounds strange but this is how it occurs. If we can not find a solution for this problem i will not go for this hack.

But good job and i like this hack and i would love to have it.

Cheers,

PranK
05-03-2004, 12:17 PM
bloody beautiful!!

thank you!

/me clicks install

Boofo
05-03-2004, 12:41 PM
Hi VBDev,

it is not a problem of queries. But it seems to be a problem with your hack. When i remove your hack all works fine with IE and Opera in terms of performance. When i implement your hack the IE seems to hang for 10 seconds. The opera does not care about your hack and due to this it shows up immediately without any delay.

I know it sounds strange but this is how it occurs. If we can not find a solution for this problem i will not go for this hack.

But good job and i like this hack and i would love to have it.

Cheers,

I use IE and have this installed on my site and there is no difference whatsoever in the speed the page loads now than there was before I installed the hack. You must have another hack installed or something else that doesn't like to work with this hack. ;)

Check out the memberlist on my site and you will see what I mean.

Pseudomizer
05-04-2004, 12:07 AM
I use IE and have this installed on my site and there is no difference whatsoever in the speed the page loads now than there was before I installed the hack. You must have another hack installed or something else that doesn't like to work with this hack. ;)

Check out the memberlist on my site and you will see what I mean.

Hi Boofo,

you are right. I just checked again. There was an incompatibility of javascripts which did not work in combination with this hack. It was the double-click ( you know which one i am talking about ), the smilie insert code from vb3 and this overlay. I should not load every javascript into the header. Only when i need it. ;-)

Regardless of this: Please provide this function for Opera and i will love it.

Cheers,

Boofo
05-04-2004, 12:29 AM
I use the double-click and the avatar opacity just fine together. The douible-click doesn't use a javascript in the header. I guess I'm confused here. :ermm:

Zachery
05-04-2004, 12:41 AM
Ok, Zach, buddy, pm me the code that will work for the postbit and the memberlist, if you would. I'd like to see it. ;)
Its not all that hard, altho it does require a phpinclude statment :)

Boofo
05-04-2004, 12:50 AM
Its not all that hard, altho it does require a phpinclude statment :)

The please pm it to me. I want to see how this would be done. And how to do the conditional for the different browsers. ;)

Zachery
05-04-2004, 01:48 AM
The please pm it to me. I want to see how this would be done. And how to do the conditional for the different browsers. ;)
Ill start a thread on vBT about it :)

Boofo
05-04-2004, 02:29 AM
Ill start a thread on vBT about it :)

That's ok, don't go to any trouble. I don't get over there very often anymore. ;)

Zachery
05-04-2004, 02:31 AM
That's ok, don't go to any trouble. I don't get over there very often anymore. ;)
psh, ive already made one, however im not sure if i can pull off the meberlistbit

Brad
05-04-2004, 02:33 AM
The please pm it to me. I want to see how this would be done. And how to do the conditional for the different browsers. ;)
You might want to take a look at this thread, saves tons of time for me :) :

http://www.vbulletintemplates.com/mods/showthread.php?t=5457

Boofo
05-04-2004, 02:40 AM
You might want to take a look at this thread, saves tons of time for me :) :

http://www.vbulletintemplates.com/mods/showthread.php?t=5457

LOL Thanks, Brad. I have the same code in an area on my site, too. But what I woudl like to know is how to do all of the different opacity for all of the different browsers. Any ideas on how to find those out? ;)

Zachery
05-04-2004, 02:41 AM
LOL Thanks, Brad. I have the same code in an area on my site, too. But what I woudl like to know is how to do all of the different opacity for all of the different browsers. Any ideas on how to find those out? ;)
theres only two main ones, the IE and the Moz, and the moz should work on at LEAST Firefox and Mozilla

Boofo
05-04-2004, 02:44 AM
theres only two main ones, the IE and the Moz, and the moz should work on at LEAST Firefox and Mozilla

What about Opera and Safari? ;)

Brad
05-04-2004, 03:02 AM
Safari can use the CSS 3 standard for transparency,

http://www.w3.org/TR/css3-color/#transparency

VBDev
05-04-2004, 05:01 AM
Does the mod for opacity used for IE works with Opera ?!

If yes, I'll have to modify the code (only 1 thing to replace 3times), and Pseudomizer will be happy :p

gmarik
05-04-2004, 02:55 PM
Good one, I'll use this

msimplay
05-04-2004, 05:26 PM
i have a problem with invisible users opacity being 100%
even for normal users and yes i installed the hack correctly

can someone else confirm this please

i just checked this also happens on bearfacts

VBDev
05-04-2004, 07:21 PM
Ok so I'll look for it too, perhaps my conditions are wrong ;)

Can someone answer my question for Opera ?!

Chris-FH
05-04-2004, 07:39 PM
Hi VBDEV...

Great hack, installed it, and it doesn't work with Opera...

C.

msimplay
05-04-2004, 07:46 PM
Ok so I'll look for it too, perhaps my conditions are wrong ;)

Can someone answer my question for Opera ?!
not too fussed with Opera coz it don't support dhtml but thats for looking into the conditionals thing :o

Detomah
05-24-2004, 11:10 AM
Is this hack supposed to work if users have their status as hidden?

I tried every possible combination to make it show as opaque for hidden users (with me logged in as normal user) but had no joy. Kind of ruins the hack and makes it unusable for me as I want to use it in conjunction with the online status icon.

msimplay
05-25-2004, 09:19 PM
i have reported this before but i had this confirmed but vbdevs not done anything since

i'm still waiting :(

bmckain
05-26-2004, 12:52 AM
I installed this twice and it doesn't work, the only thing I can think of is that I am running vB 3.0.1 and this is for Gold. Any reason other than that what the avatars wouldn't reduce opacity on either IE6 or Firefox?

bmckain
05-26-2004, 01:05 AM
Never mind, I realized you have to set the forums to use the legacy settings. Problem solved.

Karthick
06-15-2004, 02:00 PM
If user chooses to be hidden, it still shows opacity 100%.

Basically pointless until this is fixed.

Natch
06-15-2004, 02:22 PM
If user chooses to be hidden, it still shows opacity 100%.

Basically pointless until this is fixed.
For those that can see invisible users, yes ... otherwise no ...

EDIT: // Works ok on mine ? maybe I have some other mods included ?

Karthick
06-16-2004, 03:48 AM
For those that can see invisible users, yes ... otherwise no ...

EDIT: // Works ok on mine ? maybe I have some other mods included ?
I login as guest, can still see the avatar 100% opacity but the green light is not lit.

This is only mod installed for showthread, and I'm taking it down.

msimplay
06-16-2004, 06:18 AM
I login as guest, can still see the avatar 100% opacity but the green light is not lit.

This is only mod installed for showthread, and I'm taking it down.
i've highlighted this problem quite a bit but no one listens to me :disappointed:

Karthick
06-16-2004, 06:23 AM
i've highlighted this problem quite a bit but no one listens to me :disappointed:
Most people on my forum think the shading of the avatar doesn't look good anyway.

turbidblue
07-02-2004, 01:29 AM
awesome! looks great on my forum!

;)

thanks!


*hits install!

chapsrulez
07-08-2004, 06:46 PM
installed on vb 3.0.0 and vb 3.0.3 and working great on both.

buro9
07-10-2004, 12:04 PM
I hope no-one minds, but I wanted to highlight another way of doing this which requires less processing (fractionally) and is a little more elegant.

I should note that I'm not using avatars in the memberlist, so this isn't for that. But this does the showthread and private messaging ones :)

In includes/functions_bigthree.php there is already a function that finds out someones online status.

Within that file find:

if ($setstatusimage)
{
eval('$user[\'onlinestatus\'] = "' . fetch_template('postbit_onlinestatus') . '";');
}


BEFORE that, put:

// HACK : START : STATUS ACCESS
switch ($onlinestatus) {
case 0:
$user['IsOnline'] = false;
break;
case 1:
$user['IsOnline'] = true;
break;
case 2:
$user['IsOnline'] = true;
break;
default:
$user['IsOnline'] = false;
break;
}
// HACK : END : STATUS ACCESS


Now the $user object has an additional property in its array:

$user['IsOnline'] indicates that the user is online or not... or rather, should appear online to the current user... it takes into account invisibility and permissions, as the code above this already does all of this.

So we have less processing as none of this needs to be run:

//avatar opacity grog6 - vbulletindev.net
$datecut = TIMENOW - $vboptions['cookietimeout'];
if (!ereg("MSIE", $_SERVER["HTTP_USER_AGENT"]))
$style_avatar="style=\"-moz-opacity:0.3\"";
else $style_avatar= "style=\"filter:alpha(opacity=30)\"";
if ($post['lastactivity'] > $datecut AND $post['lastvisit'] != $post['lastactivity'])
if (($permissions['genericpermissions'] & CANSEEHIDDEN) OR $post['userid'] == $bbuserinfo['userid'])
{
// user is online and invisible BUT bbuser can see them
if (!ereg("MSIE", $_SERVER["HTTP_USER_AGENT"]))
$style_avatar="style=\"-moz-opacity:1.0\"";
else $style_avatar= "style=\"filter:alpha(opacity=100)\"";
}
else
{
// user is online and visible
if (!ereg("MSIE", $_SERVER["HTTP_USER_AGENT"]))
$style_avatar="style=\"-moz-opacity:1.0\"";
else $style_avatar= "style=\"filter:alpha(opacity=100)\"";


And it's more elegant as it's a simple switch that uses all of vBulletins own logic, when their logic evolves, the switch will remain the same :)

Now, all we have to do is find the avatar line in the postbit template and add a conditional to it:

<if condition="$post[IsOnline] == true">
&nbsp;<br /><a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$avatarurl" alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
<else />
&nbsp;<br /><a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$avatarurl" alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" style="filter:alpha(opacity=30);-moz-opacity:0.3;opacity: 0.3;" /></a>
</if>


Notice that if it's online, it doesn't even have the style added... which is a good thing as why apply opacity when it's not required?

Secondly I apply both the IE and Mozilla and Opera opacity switches at the same time. Yes, I said Opera... Opera is currently using the CSS3 recommendation of 'opacity'... which is the best thing to do as that is also what Mozilla will be using in the future.

Styles set like this are ignored if not applicable... so it breaks nothing.

Anyhow... more elegant because of the simplicity of the code modification and the fact that we keep all of the presentation logic in templates rather than in code.

It shouldn't be hard for those who want to use this for the memberlist or memberprofile to add a call to the fetch_online_status() function in functions_bigthree.php and to add a conditional to their template.

But yeah... a different way of doing the same thing. Better? Hard to say... but I think a little more elegant.

Cheers

David K

Boofo
07-10-2004, 12:29 PM
Interesting addition. ;)

So we completely un-install the original hack and do this, right? Will this show invisible users as online of offline? I would like to see invisble users as online for those that are supposed to be able to see them and not online for those that aren't.

buro9
07-10-2004, 02:07 PM
Interesting addition. ;)

So we completely un-install the original hack and do this, right? Will this show invisible users as online of offline? I would like to see invisble users as online for those that are supposed to be able to see them and not online for those that aren't.

That's precisely what it does.

vBulletin already works that stuff out, showing invisible people to those who should see the, and hiding them from those who shouldn't.

All I've done is add a switch to retain that information in the user object/array so that we can access it. We're not bothered about whether they are invisible or not... just whether we have permission to see that they are online or not... hence the true|false indicator for IsOnline.

Then we can simply access IsOnline and know how to handle it in the conditional in the template.

If you wanted to use my way of doing it, then yes you'd need to uninstall the original.

However I should reiterate that my way doesn't cater for the memberlist fading... mainly because I'm not using it. But it shouldn't take anyone too long to figure out the few changes needed to get that working.

Cheers

David K

PS: Why quote the whole thing? You've made thread twice as long ;)

Boofo
07-10-2004, 02:14 PM
Is that better? ;)

We could use his version for the memberlist, I suppose and use yours for the other areas. Unless you know a way to do it maybe? ;)

msimplay
07-10-2004, 03:47 PM
thanks for the update on the opacity the invisible is now fixed and i don't show avatars on memberlist anyway so i like the new way :D

The Keeper
07-18-2004, 01:30 PM
I can't seem to get this to work. Invisible users still show up as online.

buro9
07-18-2004, 02:05 PM
I can't seem to get this to work. Invisible users still show up as online.
Which version are you using?

If you're using mine, then if you have permission to see invisible users you will see them online, else you won't. That can't be wrong, as it's vBulletins own logic.

If you're using the original version, then you may indeed be seeing it incorrectly... I didn't look too closely at the logic of that and a few people did complain about it.

Boofo
07-18-2004, 03:31 PM
Which version are you using?

If you're using mine, then if you have permission to see invisible users you will see them online, else you won't. That can't be wrong, as it's vBulletins own logic.

If you're using the original version, then you may indeed be seeing it incorrectly... I didn't look too closely at the logic of that and a few people did complain about it.
David, I got your version working in the memberlist now too. Next is the profile. ;)

buro9
07-18-2004, 08:09 PM
David, I got your version working in the memberlist now too. Next is the profile. ;)
Boofo, could you post back your changes so that others can benefit?

I'm not running either version, but it'd be nice to roll up the best bits into a single post that we can point people at :)

Boofo
07-18-2004, 08:54 PM
Boofo, could you post back your changes so that others can benefit?

I'm not running either version, but it'd be nice to roll up the best bits into a single post that we can point people at :)Sure, since you did all of the hard work. ;)

For the memberlist:

In the memberlist_resultsbit template

Find:

<if condition="$show['avatar']">
<img src="$avatarurl" border="0" alt="<phrase 1="$userinfo[username]">$vbphrase[xs_avatar]</phrase>" hspace="4" vspace="4" /><else />&nbsp;</if>

REPLACE it with:

<if condition="$userinfo[IsOnline] == true">
<if condition="$show['avatar']"><img src="$avatarurl" border="0" alt="<phrase 1="$userinfo[username]">$vbphrase[xs_avatar]</phrase>" " border="0" hspace="4" vspace="4" /><else />&nbsp;</if>
<else />
<if condition="$show['avatar']"><img src="$avatarurl" border="0" alt="<phrase 1="$userinfo[username]">$vbphrase[xs_avatar]</phrase>" " border="0" hspace="4" vspace="4" style="filter:alpha(opacity=30);-moz-opacity:0.3;opacity: 0.3;" /><else />&nbsp;</if>
</if>

For the profile:

In the MEMBERINFO template

Find:

<img src="$userinfo[avatarurl]" alt="<phrase 1="$userinfo[username]">$vbphrase[xs_avatar]</phrase>" border="0" style="border:1px solid $stylevar[tborder_bgcolor]; border-top:none" />

REPLACE it with:

<if condition="$userinfo[IsOnline] == true">
<img src="$userinfo[avatarurl]" alt="<phrase 1="$userinfo[username]">$vbphrase[xs_avatar]</phrase>" border="0" style="border:1px solid $stylevar[tborder_bgcolor]; border-top:none;" />
<else />
<img src="$userinfo[avatarurl]" alt="<phrase 1="$userinfo[username]">$vbphrase[xs_avatar]</phrase>" border="0" style="border:1px solid $stylevar[tborder_bgcolor]; border-top:none; filter:alpha(opacity=30);-moz-opacity:0.3;opacity: 0.3;" />
</if>

Since the pm's are already covered by the postbit, this catches them all, I think. ;)

And it works excellent, I might add. Thanks, David. ;)

Wifey
07-26-2004, 06:06 PM
Thank you for the newer version since the older version refuses to work even though I've tried installing it twice :) Will re-install later this evening.

* Wifey says thanks!

edit: It's working perfectly with the more elegant version - thanks!

Torben
07-27-2004, 03:21 PM
Cool hack.
To clarify, the code posted above doesn't do anything for the actual posts being made right? So am I to disregard the original hack on the first page and use what's posted above instead or do I use both?

SmartGnome
07-27-2004, 03:32 PM
Thanks guys, install was a piece of cake...... great feature

Install is clicked

The Coldwood
07-28-2004, 12:42 AM
It is quite hard to install that hack - I will tell you that.

alastair
09-04-2004, 08:13 PM
i installed the version the second two guys thought of

/me thumbs up

Cold Steel
09-26-2004, 05:55 PM
I couldn't get the memberlist to show non-opaque avatars, so I didn't even try the memberinfo.

But the second version of postbit works great. Installed -- thanks!

Code Monkey
10-31-2004, 05:01 PM
A little less code.



<if condition="$show['avatar']">
&nbsp;<br /><a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$avatarurl" alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0"<if condition="$post[IsOnline] == false"> style="filter:alpha(opacity=30);-moz-opacity:0.3;opacity: 0.3;"</if> /></a>
</if>

Code Monkey
10-31-2004, 05:57 PM
Actually, there is no need for the code in functions_bigthree.php in MEMBERINFO. There is probably some already existing value in the others to check too.

MEMBERINFO

use the existing info in $userinfo['action'] like this


<if condition="$show['avatar']">
<td><img src="$userinfo[avatarurl]" alt="<phrase 1="$userinfo[username]">$vbphrase[xs_avatar]</phrase>" border="0" style="border:1px solid $stylevar[tborder_bgcolor]; border-top:none<if condition="$userinfo['action'] == false">;filter:alpha(opacity=40);-moz-opacity:0.4;opacity: 0.4;</if>" /></td>
<else />
<td>&nbsp;</td>
</if>

Code Monkey
10-31-2004, 08:38 PM
You can get rid of the switch in bigthree by just difining in the existing code.


$onlinestatus = 0;
$user['IsOnline'] = false;
// now decide if we can see the user or not
if ($user['lastactivity'] > $datecut AND $user['lastvisit'] != $user['lastactivity'])
{
if ($user['invisible'])
{
if (($permissions['genericpermissions'] & CANSEEHIDDEN) OR $user['userid'] == $bbuserinfo['userid'])
{
// user is online and invisible BUT bbuser can see them
$user['invisiblemark'] = '*';
$onlinestatus = 2;
$user['IsOnline'] = true;
}
}
else
{
// user is online and visible
$onlinestatus = 1;
$user['IsOnline'] = true;
}
}


Saves a switch statement. But memberlist_resultsbit doesn't seem to access this info.

yoyoyoyo
02-17-2005, 12:51 PM
very cool hack! I just discovered this and it installed fine in 3.0.6, in less than 3 minutes... thanks much!

TTG
03-10-2005, 01:56 PM
Neat little hack .. thanks
Clicked install

Polo
03-25-2005, 02:27 PM
Excellent mod, i installed it in less than a minute and it works great... thank you vbdev :)

VPREATR
08-03-2005, 01:49 AM
Is there a notable performance impact when showing threads with this hack?

Thanks!

Pseudomizer
08-03-2005, 03:54 AM
Is there a notable performance impact when showing threads with this hack?

Thanks!

No, there is no impact because you do the "is online" check anyway and the opacity is just an additional statement for the graphics.

Cheers,

Omega Prime
09-23-2005, 12:51 AM
Hopefully, someone can port this to 3.5 (or perhaps figure out a different means of doing this) ;)

Boofo
09-23-2005, 01:51 AM
I already did it for my site for 3.5 RC 3 but it involved a small file edit. ;)

Omega Prime
09-29-2005, 04:50 AM
I already did it for my site for 3.5 RC 3 but it involved a small file edit. ;)

Care to explain how you did it? :)

Boofo
09-29-2005, 06:31 AM
Sure. ;)

https://vborg.vbsupport.ru/showpost.php?p=531222&postcount=60

obmob
04-21-2006, 01:09 AM
Well, changed a couple of phrases for vb 3.5.4, working fine, thanks Boofo.
In includes/functions_bigthree.php there is already a function that finds out someones online status.

Within that file find:

if ($setstatusimage)
{
eval('$user[\'onlinestatus\'] = "' . fetch_template('postbit_onlinestatus') . '";');
}


BEFORE that, put:

// HACK : START : STATUS ACCESS
switch ($onlinestatus) {
case 0:
$user['IsOnline'] = false;
break;
case 1:
$user['IsOnline'] = true;
break;
case 2:
$user['IsOnline'] = true;
break;
default:
$user['IsOnline'] = false;
break;
}
// HACK : END : STATUS ACCESS

Now the $user object has an additional property in its array:

$user['IsOnline'] indicates that the user is online or not... or rather, should appear online to the current user... it takes into account invisibility and permissions, as the code above this already does all of this.

Now, all we have to do is find the avatar line in the postbit template and add a conditional to it:

<if condition="$post[IsOnline] == true">
<a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
<else />
<a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" style="filter:alpha(opacity=30);-moz-opacity:0.3;opacity: 0.3;" /></a>
</if>

Notice that if it's online, it doesn't even have the style added... which is a good thing as why apply opacity when it's not required?

Secondly I apply both the IE and Mozilla and Opera opacity switches at the same time. Yes, I said Opera... Opera is currently using the CSS3 recommendation of 'opacity'... which is the best thing to do as that is also what Mozilla will be using in the future.

Styles set like this are ignored if not applicable... so it breaks nothing.

Anyhow... more elegant because of the simplicity of the code modification and the fact that we keep all of the presentation logic in templates rather than in code.

It shouldn't be hard for those who want to use this for the memberlist or memberprofile to add a call to the fetch_online_status() function in functions_bigthree.php and to add a conditional to their template.

But yeah... a different way of doing the same thing. Better? Hard to say... but I think a little more elegant.

Boofo
04-21-2006, 02:44 AM
Well, changed a couple of phrases for vb 3.5.4, working fine, thanks Boofo.

What phrases did you change and what did you change them to?

Casperddc
05-19-2006, 10:57 PM
Is there a version for this for 3.5.4 via hook / plugin yet?

obmob
08-10-2006, 04:58 PM
Is there a version for 3.6.0? ... it stopped working after i upgraded, now i'm offline all the time XD

VPREATR
10-08-2006, 08:08 PM
I'm interested in a version for 3.6.x.

Thanks!

yoyoyoyo
12-01-2006, 02:41 AM
What phrases did you change and what did you change them to?

The <td class-"alt2"> in the code you posted is missing, and without it the avatar is not aligned properly.

<if condition="$post[IsOnline] == true">
<td class="alt2"><a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
<else />
<td class=alt2"><a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" style="filter:alpha(opacity=30);-moz-opacity:0.3;opacity: 0.3;" /></a>
</if>

WarLion
09-03-2007, 04:17 PM
Is there a version for 3.6.0? ... it stopped working after i upgraded, now i'm offline all the time XD

I'm interested in a version for 3.6.x.

Thanks!

i wrote a version for 3.6.8
https://vborg.vbsupport.ru/showthread.php?t=156903