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)

sv1cec 07-22-2004 10:36 AM

One thing I would like to see in this hack, is the "Be back Date". I agree with the developer that we do not need to have it cleared automatically, the idea of clearing this up with the first post is brilliant, however, I would like to see the return date there.

I tried to do it, but I am not good with php and I do not know how to handle a date field in the scripts etc., so I can't help much.

The idea of automatically stopping PM receives when one is away, is also very cool, I wish we could extend it to e-mail notifications as well, but I do not think this can be done.

Rgds

lifesourcerec 08-10-2004 07:18 AM

This code is only in profile once

"homepage = '" . addslashes(htmlspecialchars_uni($homepage)) . "',"

You have it listed twice in the instructions

Pinkie 08-12-2004 06:03 PM

This I will try for sure
Great work

sully02 08-13-2004 09:16 PM

Quote:

Originally Posted by Pinkie
This I will try for sure
Great work

Gamingforce, any progress on adding this to the postbit?

sv1cec 08-14-2004 05:06 AM

Quote:

Originally Posted by sully02
Gamingforce, any progress on adding this to the postbit?

I've managed to add it in my postbits, to see what I've done, please check the following:

http://forum.m1911.org/showthread.php?t=623

If you like what you see, I can provide you with my files, but the changes I've made to the original hack, are significant, and I haven't kept exact records in the form of "find this, replace it with", so you will need to do some work yourself.

However, in order to have the original "User is away" message, here is some code which goes in the postbit template (and postbitlegacy).

PHP Code:

<!-- Code change for user being away -->
<if 
condition="$post['awaystatus'] == 1">
<
td width="100%"><CENTER><div class="smallfont"><FONT COLOR="red">User $post[musernameis away at the moment.</FONT><BR>
<if 
condition="$post['awaymessage'] != ''">
Reason$post[awaymessage]<BR>
<else />
No reason was given.<BR>
</if>

</
div></CENTER></td>
<else />
<
td width="100%">&nbsp;</td>
</if>
<!-- 
end of code for user being away --> 

This piece of code, goes right below the part shown below:

PHP Code:

                <if condition="$post['rank']"><div class="smallfont">$post[rank]</div></if>
                
            </
td

Let me know if I can be of more help.

Rgds

turbidblue 08-14-2004 05:15 PM

thank you! i was mostly just looking for the way to get the reason in the postbit, and your code worked flawlessly ;)

i dont really care about having the return date on my forums :)

xoxo

sv1cec 08-14-2004 05:55 PM

Quote:

Originally Posted by turbidblue
thank you! i was mostly just looking for the way to get the reason in the postbit, and your code worked flawlessly ;)

i dont really care about having the return date on my forums :)

xoxo

Glad if I can be of help.

The return date is a bit more involved, it includes altering tables etc. I finally managed it, but I would be hard pressed to describe every necessary step.

Rgds

Lionel 10-01-2004 01:13 PM

That would be nice to add a query to check user status when someone is sending PM. If away, bounce an away message back to sender.

sv1cec 10-01-2004 07:50 PM

Quote:

Originally Posted by Lionel
That would be nice to add a query to check user status when someone is sending PM. If away, bounce an away message back to sender.

This can be done, but you should keep in mind that:

1. Sending a PM to a user, necessitates only an insertion of a new row in a table in the database.
2. Any part of vB can therefore send a PM to a user, by just doing such an insert.
3. The only way to catch the "user away" condition, for each program which tries to insert a PM in the PMs table, is to have a trigger within the table. This I cannot do, I am not that good in MySQL, I do not even know if it supports triggers.

So, what I did, is the next best thing. I modified the code of the private.php program, which is the one you use, when you send a PM to a user. To do this, follow the steps below:

1. Edit private.php and find :

PHP Code:

            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) . '";');
            } 

Now go into your Admin CP, Phrase Manager and add a new phrase. The type is "Front-End Error Messages" and the phrase name should be "userawaynopm". The text of the phrase should be something like:

PHP Code:

<u><b>Attention : </b></uYour PM cannot be send to its intended recipients.<br>User <b>$user[username]</bis away since the $awaysincedate.<brExpected return date was $awayuntilmsg.<br>Your PM was not delivered to  <b>$user[username]</b>. 


Please keep in mind that I've added some custom fields in this hack, so if you get error messages about awayuntildate etc., you should remove those bits from the code and the phrase. Let me know if you have problems and I'll try to help.

With this, when you try to PM a user who is away, you will receive the above message and your PM is not send. I am not sure if this is the best way to handle this though, maybe, one should issue a warning to the sender, that the recipient is away, and let the PM go through. I would appreciate if you could let me know what you think about this question.

Finally, with this mod, if your PM is send to many recipients, the user(s) who is/are away, will not receive the PM, while the rest of them will.

Let me know if you have problems.

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

Lionel 10-01-2004 09:57 PM

Quote:

Originally Posted by sv1cec
This can be done, but you should keep in mind that:

1. Sending a PM to a user, necessitates only an insertion of a new row in a table in the database.
2. Any part of vB can therefore send a PM to a user, by just doing such an insert.
3. The only way to catch the "user away" condition, for each program which tries to insert a PM in the PMs table, is to have a trigger within the table. This I cannot do, I am not that good in MySQL, I do not even know if it supports triggers.

So, what I did, is the next best thing. I modified the code of the private.php program, which is the one you use, when you send a PM to a user. To do this, follow the steps below:

1. Edit private.php and find :

PHP Code:

            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) . '";');
            } 

Now go into your Admin CP, Phrase Manager and add a new phrase. The type is "Front-End Error Messages" and the phrase name should be "userawaynopm". The text of the phrase should be something like:

PHP Code:

<u><b>Attention : </b></uYour PM cannot be send to its intended recipients.<br>User <b>$user[username]</bis away since the $awaysincedate.<brExpected return date was $awayuntilmsg.<br>Your PM was not delivered to  <b>$user[username]</b>. 


Please keep in mind that I've added some custom fields in this hack, so if you get error messages about awayuntildate etc., you should remove those bits from the code and the phrase. Let me know if you have problems and I'll try to help.

With this, when you try to PM a user who is away, you will receive the above message and your PM is not send. I am not sure if this is the best way to handle this though, maybe, one should issue a warning to the sender, that the recipient is away, and let the PM go through. I would appreciate if you could let me know what you think about this question.

Finally, with this mod, if your PM is send to many recipients, the user(s) who is/are away, will not receive the PM, while the rest of them will.

Let me know if you have problems.

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

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


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.01320 seconds
  • Memory Usage 1,805KB
  • 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
  • (8)bbcode_php_printable
  • (5)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