vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Avatar's opacity according to user's status (online/offline) (https://vborg.vbsupport.ru/showthread.php?t=64606)

Boofo 05-04-2004 02:44 AM

Quote:

Originally Posted by Zachery
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

Quote:

Originally Posted by VBDev
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

Quote:

Originally Posted by Karthick
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

Quote:

Originally Posted by Natch
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

Quote:

Originally Posted by Karthick
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

Quote:

Originally Posted by msimplay
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:
PHP Code:

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

BEFORE that, put:
PHP Code:

  // 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:
Code:

  //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:
Code:

          <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

Quote:

Originally Posted by Boofo
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

Quote:

Originally Posted by The Keeper
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

Quote:

Originally Posted by buro9
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

Quote:

Originally Posted by Boofo
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

Quote:

Originally Posted by buro9
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:

HTML Code:

<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:

HTML Code:

<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:

HTML Code:

<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:

HTML Code:

<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.

[high]* Wifey says thanks!
[/high]

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.

PHP Code:


                   
<if condition="$show['avatar']">
                    &
nbsp;<br /><a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$avatarurlalt="<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

PHP Code:

            <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.

PHP 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


All times are GMT. The time now is 01:01 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01453 seconds
  • Memory Usage 1,880KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (4)bbcode_html_printable
  • (5)bbcode_php_printable
  • (11)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete