View Single Post
  #22  
Old 12-10-2001, 08:04 PM
bira's Avatar
bira bira is offline
 
Join Date: Nov 2001
Posts: 387
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01273 seconds
  • Memory Usage 1,810KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete