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


All times are GMT. The time now is 09:25 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.01662 seconds
  • Memory Usage 1,767KB
  • 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
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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