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)
-   -   User Away Messages (https://vborg.vbsupport.ru/showthread.php?t=67250)

Dan 10-01-2004 10:09 PM

nice hack :) very useful! thanks for sharing it with us all ;)

Lionel 10-01-2004 11:06 PM

About letting the PM go and then display the message?

Lionel 10-02-2004 01:56 AM

I tried the below with
$sendto["$username"] = true;
$tostring["$user[userid]"] = $user['username'];
before and after the actual error message
or without it at all, like your code

I get no error messages and all PM went thru.

else if ($user['awaystatus'] == 1)
{
$awaysincedate = vbdate($vboptions['dateformat'], $user['awaysince']);
if ($user['awaymessage'] == "")
{
$awaymsg = "not given";
}
else
{
$awaymsg = $user['awaymessage'];
}
$sendto["$username"] = true;
$tostring["$user[userid]"] = $user['username'];
eval('$pmuseraway[] = "' . fetch_phrase('userawaynopm', PHRASETYPEID_ERROR) . '";');

}

sv1cec 10-02-2004 10:28 AM

OK, try this if you can. Use the original private.php file and find:

PHP Code:

        foreach ($checkedusers AS $username => $user)
        {
            if (!(
$user['options'] & $_USEROPTIONS['receivepm']))
            {
                
// recipient has private messaging disabled
                
eval('$errors[] = "' fetch_phrase('pmrecipturnedoff'PHRASETYPEID_ERROR) . '";');
            } 

Right below it, add:

PHP Code:

            else if ($user['awaystatus'] == 1)
            {
                
$awaysincedate vbdate($vboptions['dateformat'], $user['awaysince']);
                if (
$user['awayuntildate'] == "")
                {
                    
$awayuntilmsg "not given";
                }
                else
                {
                    
$awayuntilmsg $user['awayuntildate'];
                }
                eval(
'$pmuseraway[] = "' fetch_phrase('userawaynopm'PHRASETYPEID_ERROR) . '";');
            } 

Then find:

PHP Code:

            $url "private.php?$session[sessionurl]";
            eval(
print_standard_redirect('pm_messagesent')); 

and replace it with :

PHP Code:

        if (!empty($pmuseraway))
        {
            
define('PMPREVIEW'1);
            
$preview construct_errors($pmuseraway); // this will take the preview's place
            
$_REQUEST['do'] = 'newpm';
        }
        else
        {
            
$url "private.php?$session[sessionurl]";
            eval(
print_standard_redirect('pm_messagesent'));
        } 

Let me know if it works.
----------
John

sv1cec 10-02-2004 10:38 AM

Quote:

Originally Posted by Lionel
Thanks. But rather than prevent the PM from being sent, I'd rather the autoresponder option, so no PM get lost or prevented.

I would like that too, but I just do not have the time to code this functionality. It's more involved, since it requires you to scan the recipients for those who are away, and then create a PM back to the sender. This requires the same checks as the ones performed when the original PM is send, and you have to change the recipient with the sender.

Sorry, not enough time here for that. I admit though, if someone can come up with it, I'll use it too.

Rgds
----------
John

sv1cec 10-02-2004 02:23 PM

Quote:

Originally Posted by Lionel
Thanks. But rather than prevent the PM from being sent, I'd rather the autoresponder option, so no PM get lost or prevented.

Would you mind if instead of a PM, you get an e-mail when the user you PMed is away?

If not, here is the code you can use. In your private.php, find:

PHP Code:

        }

        
// process errors if there are any
        
if (!empty($errors))
        { 

Replace that with:

PHP Code:

            if ($user['awaystatus'] ==1)
            {
                
mail ($bbuserinfo[email],"One of your PMs was send to a user who is away","The PM you send to $username was not delivered, because this user is currently away.","From: \"$vboptions[bbtitle] Mailer\" <$vboptions[webmasteremail]>");
            }
        }

        
// process errors if there are any
        
if (!empty($errors))
                { 

You may customize the above, to use a template for the e-mail send. If you want help on this, please let me know.

I hope this helps.

Rgds
--------------
John

Lionel 10-03-2004 07:15 AM

Quote:

Originally Posted by sv1cec
OK, try this if you can. Use the original private.php file and find:

PHP Code:

        foreach ($checkedusers AS $username => $user)
        {
            if (!(
$user['options'] & $_USEROPTIONS['receivepm']))
            {
                
// recipient has private messaging disabled
                
eval('$errors[] = "' fetch_phrase('pmrecipturnedoff'PHRASETYPEID_ERROR) . '";');
            } 

Right below it, add:

PHP Code:

            else if ($user['awaystatus'] == 1)
            {
                
$awaysincedate vbdate($vboptions['dateformat'], $user['awaysince']);
                if (
$user['awayuntildate'] == "")
                {
                    
$awayuntilmsg "not given";
                }
                else
                {
                    
$awayuntilmsg $user['awayuntildate'];
                }
                eval(
'$pmuseraway[] = "' fetch_phrase('userawaynopm'PHRASETYPEID_ERROR) . '";');
            } 

Then find:

PHP Code:

            $url "private.php?$session[sessionurl]";
            eval(
print_standard_redirect('pm_messagesent')); 

and replace it with :

PHP Code:

        if (!empty($pmuseraway))
        {
            
define('PMPREVIEW'1);
            
$preview construct_errors($pmuseraway); // this will take the preview's place
            
$_REQUEST['do'] = 'newpm';
        }
        else
        {
            
$url "private.php?$session[sessionurl]";
            eval(
print_standard_redirect('pm_messagesent'));
        } 

Let me know if it works.
----------
John

That displayed the error message about being away in the preview when trying to send message.

sv1cec 10-03-2004 01:35 PM

Quote:

Originally Posted by Lionel
That displayed the error message about being away in the preview when trying to send message.

You mean the error message comes up when you hit "Preview"?? It doesn't work like that in my case. Preview works as it is supposed to, then when you click "Submit" the error appears, which is what it should do.

Lionel 10-03-2004 01:56 PM

Quote:

Originally Posted by sv1cec
You mean the error message comes up when you hit "Preview"?? It doesn't work like that in my case. Preview works as it is supposed to, then when you click "Submit" the error appears, which is what it should do.

I meant it works as intended. It displays the useraway message pm not sent in the preview screen that appears when trying to submit.

sv1cec 10-03-2004 03:08 PM

Quote:

Originally Posted by Lionel
I meant it works as intended. It displays the useraway message pm not sent in the preview screen that appears when trying to submit.

Well, the preview screen does not come up with any error message in my system. But after you do the preview, if you hit "Submit", then it shows the error. Same thing it does if you do not preview, and hit "Submit" from the editor screen.

Just to let you know though, I stopped using this mod. I replaced it in my forums with the e-mail warning one. I think it is better that way, your PM goes to the recipient, even if he is away, and you get back an e-mail saying that the recipient is away and he will get your message when he returns.

A PM would be a more elegant solution, but I do not want to get involved with all the checks necessary to send a PM. The e-mail is sent by the admin account, so users will get it one way or another.

Rgds


All times are GMT. The time now is 03:30 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.01383 seconds
  • Memory Usage 1,792KB
  • 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
  • (10)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (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