vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Away message for users (https://vborg.vbsupport.ru/showthread.php?t=33099)

bira 12-09-2001 10:00 PM

Hi,

This is something that is common in IRC - /me is away

In BBs, a user is either online or offline (or invisible).

But, on my Bulletin Board, the folks created such a community that every time someone goes on a holiday or goes offline for a while, he/she posts a new thread to annouce they're 'away.

So, I wrote a hack allowing a user to change his/her status to "away", including a return date and an away reason which will show up in their profile.

Likewise, the online/offline icon in postbit and buddy list will change to an away icon (a very faded version of the 'offline' one).

Some demo captures:

The Edit Profile screen, when a user is NOT away:

https://vborg.vbsupport.ru/

The Edit Profile screen when a user IS away:

https://vborg.vbsupport.ru/

The Get Info (User Profile) screen when a user IS away:

https://vborg.vbsupport.ru/

The Get Info (User Profile) screen when a user is NOT away:

https://vborg.vbsupport.ru/

The postbit icon when a user is away:

https://vborg.vbsupport.ru/


How to install:

Download the attached zip file. Upload away.gif to your images dir (or create your own away.gif).

Upload install_awayuser.php to your admin dir and follow the instructions.

Cheers,

Bira

newest version by sho here:
https://vborg.vbsupport.ru/showthrea...606#post287606

squawell 12-10-2001 01:53 PM

bira~~

u do a great hack again~~~

thankz~~~

Lesane 12-10-2001 02:09 PM

Very tight Bira, i luv it. Thanks for such a great hack.

pipi 12-10-2001 02:16 PM

pretty kewl hack.....thanks for your shared..........

Tarion 12-10-2001 02:16 PM

great hack bira, thx a lot :cool:

trainer 12-10-2001 02:19 PM

that is a great hack, it is perfect for my board!

never would have thought of this hack!

thanks

Admin 12-10-2001 02:26 PM

Nice, I'll install it later when I get some time. :)

Admin 12-10-2001 03:07 PM

Done installing. :)

*cough* I see you've mastered my install script, eh? ;)

Oh and there's a little bug. You use the same variables to denote the day, month and year name as the birthday system uses. You'll need to change that or the birthday will become your away date when you edit your profile next. :)

bira 12-10-2001 03:14 PM

[QUOTE]Originally posted by FireFly
Done installing. :)

*cough* I see you've mastered my install script, eh? ;)

Radon3k 12-10-2001 03:18 PM

Nice hack man, thanks! :)

Admin 12-10-2001 03:26 PM

[QUOTE]Originally posted by bira
Yeah, I've actually been using it for my last 3 or 4 hacks. It's very good.

(Regarding that - I got a small surprise coming. But let me finish it first ;))

Lesane 12-10-2001 03:32 PM

I receive a parse error in admin/functions.php

Bira, you say in the install:
Step 1 of 1 FIND:


PHP Code:

if ($post['lastactivity'] > $datecut and !$post['invisible'] and $post['lastvisit'] != $post['lastactivity']) {
            eval(
"\$onlinestatus = \"".gettemplate("postbit_online")."\";");
        } else {
            eval(
"\$onlinestatus = \"".gettemplate("postbit_offline")."\";");
        } 

well, i'm using 2.03 and 2.0.3 dont have that part in functions.php so i'm looking for a similar code and i found this in my functions.php:

PHP Code:

if ($post[userid]!=0) {
        if (
$showonline) {
            unset(
$onlinestatus);
            if (
$post[sessionuserid]>0) {
                eval(
"\$onlinestatus = \"".gettemplate("postbit_online")."\";");
            } else {
                eval(
"\$onlinestatus = \"".gettemplate("postbit_offline")."\";");
            }
        }
        if (
$post[avatarid]!=0) {
            
$avatarurl=$post[avatarpath];
        } else {
            if (
$post[hascustomavatar] and $avatarenabled) {
                
$avatarurl="avatar.php?userid=$post[userid]&dateline=$post[avatardateline]";
            } else {
                
$avatarurl="";
            }
        }
        if (
$avatarurl=="" or ($bbuserinfo[userid]>and !($bbuserinfo[showavatars]))) {
            
$post[avatar]="";
        } else {
            eval(
"\$post[avatar] = \"".gettemplate("postbit_avatar")."\";");
        }
        if (
$post[customtitle]==2) {
            
$post[usertitle] = htmlspecialchars($post[usertitle]);
        } 

I changed the above code to:

PHP Code:

if ($post[away]=="1") {
            eval(
"\$onlinestatus = \"".gettemplate("postbit_away")."\";");
        } else {
    if (
$post[userid]!=0) {
        if (
$showonline) {
            unset(
$onlinestatus);
            if (
$post[sessionuserid]>0) {
                eval(
"\$onlinestatus = \"".gettemplate("postbit_online")."\";");
            } else {
                eval(
"\$onlinestatus = \"".gettemplate("postbit_offline")."\";");
            }
        }
        }
        if (
$post[avatarid]!=0) {
            
$avatarurl=$post[avatarpath];
        } else {
            if (
$post[hascustomavatar] and $avatarenabled) {
                
$avatarurl="avatar.php?userid=$post[userid]&dateline=$post[avatardateline]";
            } else {
                
$avatarurl="";
            }
        }
        if (
$avatarurl=="" or ($bbuserinfo[userid]>and !($bbuserinfo[showavatars]))) {
            
$post[avatar]="";
        } else {
            eval(
"\$post[avatar] = \"".gettemplate("postbit_avatar")."\";");
        }
        if (
$post[customtitle]==2) {
            
$post[usertitle] = htmlspecialchars($post[usertitle]);
        } 

but then i receive a parse error :(.


Hope u can help me out with this.

bira 12-10-2001 03:43 PM

Lesane,

Revert back the code to what it was originally.

After that, find:

PHP Code:

if ($post[sessionuserid]>0) {
    eval(
"\$onlinestatus = \"".gettemplate("postbit_online")."\";");
} else {
     eval(
"\$onlinestatus = \"".gettemplate("postbit_offline")."\";");


And replace it with:

PHP Code:

            // Leave Away Message in Profile (v1.0)
            
if ($post[away]=="1") {
                eval(
"\$onlinestatus = \"".gettemplate("postbit_away")."\";");
            } else {
                if (
$post[sessionuserid]>0) {
                    eval(
"\$onlinestatus = \"".gettemplate("postbit_online")."\";");
                } else {
                    eval(
"\$onlinestatus = \"".gettemplate("postbit_offline")."\";");
                }
            }
            
// Leave Away Message in Profile (v1.0) 


Meta 12-10-2001 06:21 PM

Thank you for this very lovely hack, Bira!

Installed ... and works smooth without any problems ... a nice to have.

Lesane 12-10-2001 06:30 PM

Thanks Bira, it works perfect now.

Meta 12-10-2001 06:35 PM

But ...

if you User don't gives a Return Date it says he will come back on 1. Januar 1970.

Is there a way to change that to something like "not quite sure" or something like that?

(And ... do somebody know where my hackcount has gone? I had five or six of them installed ... at least this one. And now it says none. Quite strange.)

bira 12-10-2001 06:45 PM

[QUOTE]Originally posted by Meta
But ...


if you User don't gives a Return Date it says he will come back on 1. Januar 1970.

Is there a way to change that to something like "not quite sure" or something like that?

Meta 12-10-2001 07:02 PM

Quote:

Yeah, you have a point.
It was a pleasure for me.

Quote:

The "hack:" under your username in posts is the number of hacks you released, not installed
Oh ... what a shame.

(Look ... thats because i'm a junior member and a newbie with only 10 Posts at all and ... oh, what a shame.)


Anyway ... thanks for your fast reply. I think, this will work. If not ... i'll be back.

Meta 12-10-2001 07:15 PM

Works like it should. Great! But ...

Now it would be nice, if the Admin could do this also for an user. The admin can enter a birthday for users ... why not the longer absence ...?

Would be nice.

Crinos 12-10-2001 07:24 PM

Hey bira, nice hack once again ...

but before I install it, I was wondering if this one had a pop-up or some sort of notification to remind a user who has been "away" if he or she wants to update their away info after they return ... I know that some users, once they set an away message and then come back a little early, will sometimes forget to to update their away status ... hence they will already be posting yet still be considered "away" until the date is reached.

Maybe, even automatically disable the away setting once the user posts a message before the date he stated he was gonne be back...

I dunno, just a suggestion ... I'll install the hack anyway ;)

bira 12-10-2001 08:04 PM

ok, here are a couple of add-ons:

1) Cancel 'Away' status when user posts:

Open newthread.php

Find:

Code:

          $DB_site->query("UPDATE user SET
          ".iif ($foruminfo[countposts],"posts=posts+1,","")."
          $dotitle"."lastpost='".time()."' WHERE userid='$bbuserinfo[userid]'");

Change to (changes hilighted):

Code:

          $DB_site->query("UPDATE user SET
          ".iif ($foruminfo[countposts],"posts=posts+1,","")."
          $dotitle"."lastpost='".time()."'[high],away=0,awaydate='',awayreason='',returndate=''[/high] WHERE userid='$bbuserinfo[userid]'");

Open newreply.php and find:

Code:

                          $DB_site->query("UPDATE user SET
                          ".iif ($foruminfo[countposts],"posts=posts+1,","")."
                          $dotitle"."lastpost='".time()."' WHERE userid='$bbuserinfo[userid]'");

Change to (changes hilighted):

Code:

                          $DB_site->query("UPDATE user SET
                          ".iif ($foruminfo[countposts],"posts=posts+1,","")."
                          $dotitle"."lastpost='".time()."'[high],away=0,awaydate='',awayreason='',returndate=''[/high] WHERE userid='$bbuserinfo[userid]'");

Save both files and upload.

This change will automatically cancel a user's 'away' status once he/she posts a new thread or a new reply.


2) Send auto-reply to PMs while a user is a way.

This add-on will act like the "vacation" auto-reply most e-mail programs have.

When you send a PM to a user who is away, you will immediately receive a PM with "Auto Reply:" in the subject line.
The PM message body will say 'I'm away and will read your PM when I return', with the reason (if present) and the return date (if present).

If you want to add this, open private.php and find:

Code:

eval("standardredirect(\"".gettemplate("redirect_pmthanks")."\",\"private.php?s=$session[sessionhash]\");");
ABOVE it ADD:

PHP Code:

  // away auto-reply add-on
  
if ($touserinfo[away]=="1") {
      
      
$sincedate vbdate($dateformat$touserinfo[awaydate]);
    if (
$touserinfo[returndate]=="0000-00-00") {
        
$returndate "[i](date unknown)[/i]";
    } else {
          
$returnaway explode("-"$touserinfo[returndate]);
          
$returndate "on ".vbdate($dateformatmktime(0,0,0,$returnaway[1],$returnaway[2],$returnaway[0]));
      }
      if (!
$touserinfo[awayreason]) {
          
$awayreason "[i](No reason specified)[/i]";
      } else {
          
$awayreason "[i]($touserinfo[awayreason])[/i]";
      }
       
      
$autoreply "Hi $bbuserinfo[username],\n\n I have been away since $sincedate $awayreason and will read your message when I return $returndate.";

    
$autotitle "Auto Reply: ".addslashes(htmlspecialchars($title));

      
$DB_site->query("INSERT INTO privatemessage (privatemessageid,userid,touserid,fromuserid,title,message,dateline,showsignature,iconid,messageread,folderid,receipt) VALUES (NULL,$bbuserinfo[userid],$bbuserinfo[userid],$touserinfo[userid],'".addslashes(htmlspecialchars($autotitle))."','".addslashes(htmlspecialchars($autoreply))."','".time()."',0,0,0,0,0)");
    if (
$bbuserinfo[emailonpm]) {
      eval(
"\$emailmsg = \"".gettemplate("email_pmautoreply",1,0)."\";");
      eval(
"\$emailsubject = \"".gettemplate("emailsubject_pmreceived",1,0)."\";");
      
mail($bbuserinfo[email],$emailsubject,$emailmsg,"From: \"$bbtitle Mailer\" <$webmasteremail>");
    }

  }
  
// away auto-reply add-on 

Save and upload.

create NEW template called email_pmautoreply and place in it:

Quote:

$bbuserinfo[username],

You have received a new private message at $bbtitle from $touserinfo[username]. Please click here to log in and read it:
$bburl/private.php

Thanks,
$bbtitle team
That's it :)

p.s.

Meta, I will add what you're asking for (Admin CP) tomorrow. I'm off to sleep now :)

Bedhead 12-10-2001 08:19 PM

Awesome!!!

JJR512 12-10-2001 08:49 PM

I don't have time to do this hack now, but I've saved it and have it queued... One question: Does the ZIP in the original post include the changes or additions from just above?

Chi 12-11-2001 12:33 AM

very very sweet.

Hooper 12-11-2001 01:22 AM

Question:

Will you be incorporating all of the addon code you posted into the script? If so, I will just wait for the final. Looks very impressive.

Thank You.

SirSteve 12-11-2001 03:57 AM

How about being able to set your own auto PM message.

:)

Admin 12-11-2001 04:58 AM

Very nice addons, installed all except one (auto-setting away back to 0 when posting, because people often login to check posts out and sometimes post while they're still away). :)

Crinos 12-11-2001 06:31 AM

Installed and working ... excellent work! :)

Just did some slight modifications to the getinfo template, but it works great.

This is the 3rd or 4th straight hack from bira I am using, and all of them are just grrrrrreat ;)

KuraFire 12-11-2001 07:28 AM

[QUOTE]Originally posted by Crinos
Just did some slight modifications to the getinfo template, but it works great.

Nemesis77 12-11-2001 07:43 AM

Great Hack thanks. I installed this with no probs at all except The Icon in the postbit area (away.gif) does not show when a user is away. I didn't see anything in the install instructions about adding anything to the postbit template.

Crinos 12-11-2001 07:47 AM

Hmm, attached is a zip file of the modified templates in my User Info Display ... I used custom colors on some parts, so just change them to the colors that go good with your site...

If you don't have the user points hack, just remove the "support points" fields ;)

KuraFire 12-11-2001 07:52 AM

[QUOTE]Originally posted by Nemesis77
Great Hack thanks. I installed this with no probs at all except The Icon in the postbit area (away.gif) does not show when a user is away. I didn't see anything in the install instructions about adding anything to the postbit template.

Meta 12-11-2001 08:30 AM

Quote:

Meta, I will add what you're asking for (Admin CP) tomorrow. I'm off to sleep now.
Great. I'm not in a hurry. Thank you very much!

(It's because we have some members who surely will be back ... someday ... someyear ... they always come back sometime. But actually they are absent.)

KuraFire 12-11-2001 08:33 AM

Thanks Crinos! :up:

bira 12-11-2001 08:44 AM

[QUOTE]Originally posted by Meta
Great. I'm not in a hurry. Thank you very much!

(It's because we have some members who surely will be back ... someday ... someyear ... they always come back sometime. But actually they are absent.)

KuraFire 12-11-2001 08:49 AM

I don't know if the Admin's should be able to mess with a user's away status. The "cancel away status" add-on would do for that, the only thing else that you could do then is abusing it, so... :/

Admin 12-11-2001 08:59 AM

Members could abuse and put offending messages as the away reason, so it's important to have the ability to change it.
Also bira while you're at it, censor the reason before it's saved. :)

Meta 12-11-2001 09:05 AM

Quote:

Meta, then add the "Cancel 'Away' when user posts" add-on, about 6 posts up
It won't help. Because they are (!!!) away. Now. In this very moment. So there is nobody who can say that they are away. Except me ... the admin. But i can't.

Quote:

I don't know if the Admin's should be able to mess with a user's away status.
May be. But ... the admin can mess with all. With all of userinformation like birthdays and AOL-Names and so on ... but also with the posts or whatever he wants. Even he can erase all of the board or forget to pay the bill.

If you don't trust the admin ... whom do you will?

I think messing around with the away-status is something i will not do. I only want to enter for users, who are in this moment absent ... that they are absent. In fact ... thats one of the reasons why i installed the hack.

KuraFire 12-11-2001 09:11 AM

Ah, true, true..


I'm too kindhearted I think to realize abusal from the common abusing side of things, I only think about abusal from the side that has power...

Must. change. stance...

;)

Okay, so Admin accessibility *is* a good idea. :)

Meta 12-11-2001 09:23 AM

(I'm so happy to hear that. Thank you.)


All times are GMT. The time now is 04:50 PM.

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.02406 seconds
  • Memory Usage 1,897KB
  • 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
  • (5)bbcode_code_printable
  • (6)bbcode_php_printable
  • (6)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