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)
-   -   Send default PM to all new users - templated (https://vborg.vbsupport.ru/showthread.php?t=35647)

Overgrow 01-29-2003 05:15 PM

In the Insert query find:

.time().

and change it to

.(time()+60).

Should do it as it will make the message newer than their last activity. Have not tested this.

As far as supporting the hacks.. Yes I am a selfish hacker. I hack for myself and my site. No bones about it.. I release some code here if i I think it will help people but I do not have time to make modifications that people request. Since I never use email activation, my hacks won't take this into account. Sorry!

Bison 01-29-2003 10:17 PM

I respect you opinon and agree with you about email activation ... gives you a little more time to review the person's form request before letting them in....

sreedchi 01-31-2003 04:47 PM

Quote:

Originally posted by Overgrow
In the Insert query find:

.time().

and change it to

.(time()+60).

That did it! Thanks - no need to apologize. We'll take whatever we can get from you. :)

sreedchi 01-31-2003 04:56 PM

Although, now the 'New' flag doesn't seem to want to turn off. :(

I tried changing it to .(time()+1), but same issue. Oh well.

amykhar 02-04-2003 12:20 PM

OK gang, here is what you need to do to a) send the PM after the member activates their account and b) make sure the message is new.

In actuality, doing a seems to ensure b. So this is easy.

INSTEAD OF doing this step in Overgrow's hack:
find
Code:

               
                $DB_site->query("UPDATE session SET userid=$userid WHERE sessionhash='".addslashes($session['dbsessionhash'])."'");

directly after this, add

Code:

                       
       
                // send default PM to new user
                eval("\$newpmtitle.= \"".gettemplate("newpm_title")."\";");
                eval("\$newpmmessage.= \"".gettemplate("newpm_message")."\";");
                $originating_user = 1;                                       
                $DB_site->query("INSERT INTO privatemessage (privatemessageid,userid,touserid,fromuserid,title,message,dateline,messageread,folderid) VALUES (NULL,$userid,$userid,$originating_user,'".addslashes(htmlspecialchars($newpmtitle))."','".addslashes($newpmmessage)."',".time().",0,0)");
                // send default PM to new user

DO THIS:
Find:
Code:

} else {
                        // activate account
                        if ($userinfo['customtitle']==0) {
                                $usergroup=$DB_site->query_first("SELECT usertitle FROM usergroup WHERE usergroupid=2");
                                if ($usergroup[usertitle]=="") {
                                        $gettitle=$DB_site->query_first("SELECT title FROM usertitle WHERE minposts<=$userinfo[posts] ORDER BY minposts DESC

LIMIT 1");
                                        $usertitle=$gettitle[title];
                                } else {
                                        $usertitle=$usergroup[usertitle];
                                }
                                $dotitle=", usertitle='".addslashes($usertitle)."'";
                        } else {
                                $dotitle = '';
                        }
                        $DB_site->query("UPDATE user SET usergroupid=2 $dotitle WHERE userid='$u'");
                        $username=$userinfo[username];

Add AFTER:
Code:

                // send default PM to new user
                eval("\$newpmtitle.= \"".gettemplate("newpm_title")."\";");
                eval("\$newpmmessage.= \"".gettemplate("newpm_message")."\";");
                $originating_user = 22;                                       
                $DB_site->query("INSERT INTO privatemessage (privatemessageid,userid,touserid,fromuserid,title,message,dateline,messageread,folderid) VALUES

(NULL,$u,$u,$originating_user,'".addslashes(htmlspecialchars($newpmtitle))."','".addslashes($newpmmessage)."',".time().",0,0)");
                // send default PM to new user       


                if ($noshutdownfunc) {
                        $DB_site->query("UPDATE user SET pmpopup=2 WHERE userid=$u");
                } else {
                        $shutdownqueries[]="UPDATE LOW_PRIORITY user SET pmpopup=2 WHERE userid=$u";
                }


If you have done it correctly, the next line you see in the code is:
Code:

eval("standarderror(\"".gettemplate("error_activatedthanks")."\");");
Amy

amykhar 02-04-2003 12:21 PM

Note, you don't need to tinker with time or anything else. This PM will be new and it does popup the first time the member logs in after activation.

Grunt 02-06-2003 10:33 AM

works great amykhar..thanks to you and Overgrow for this hack...a small change to your code however amy..

instead of

Code:

$originating_user = 22;
it should be 1 (if you want the pm to be from #1 that is)


Also, if using amy's hack to the hack, you can ignore this in the original instructions:

Code:

OPTIONAL: If you want the PM alert box to pop up, add this part as well:

                if ($noshutdownfunc) {
                        $DB_site->query("UPDATE user SET pmpopup=2 WHERE userid=$userid");
                } else {
                        $shutdownqueries[]="UPDATE LOW_PRIORITY user SET pmpopup=2 WHERE userid=$userid";
                }


sreedchi 02-06-2003 12:20 PM

Thanks Overgrow, Amy, and Gruntie. Good teamwork!

Alien 04-27-2003 05:07 AM

I just installed this one instead on vB 2.3.0 with amykhar's awesome modification and it's so much better!

Thanks you guys!
-Jason

cYbercOsmOnauT 06-19-2003 06:02 PM

works great on my vB 2.3.0
[high]* cYbercOsmOnauT clicked on install :)
[/high]

Thanks mate!


All times are GMT. The time now is 07:44 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.01132 seconds
  • Memory Usage 1,748KB
  • 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
  • (7)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)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