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)

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

Quote:

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

Quote:

Originally Posted by Boofo
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....2&postcount=60

obmob 04-21-2006 01:09 AM

Well, changed a couple of phrases for vb 3.5.4, working fine, thanks Boofo.
Quote:

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.

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

PHP Code:

          <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

Quote:

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

Quote:

Originally Posted by Boofo (Post 955713)
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.

Code:

<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

Quote:

Originally Posted by obmob (Post 1049218)
Is there a version for 3.6.0? ... it stopped working after i upgraded, now i'm offline all the time XD

Quote:

Originally Posted by VPREATR (Post 1092597)
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


All times are GMT. The time now is 01:02 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.01328 seconds
  • Memory Usage 1,772KB
  • 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
  • (1)bbcode_code_printable
  • (3)bbcode_php_printable
  • (7)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
  • (14)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