smartfaq
SmartFAQ is developed by The SmartFactory (http://www.smartfactory.ca), a division of InBox Solutions (http://www.inboxsolutions.net)

How can I automatically send a welcome PM (Private Message) to my new members?
Requested and Answered by Bluenova on 2005/11/16 10:13:06 (12062 reads)
Xoops 2.0.X
Open /**Xoopsinstallation**/register.php

Find:
(XOOPS_GROUP_USERS, $newid)) {

echo _US_REGISTERNG;
include 'footer.php';
exit();
}


Xoops 2.2.X
Open /**Xoopsinstallation**/modules/profile/register.php

Find:

$newid = $newuser->getVar('uid');
if (!$member_handler->addUserToGroup(XOOPS_GROUP_USERS, $newid)) {
echo _PROFILE_MA_REGISTERNG;
break;
}


Add After:
//Welcome PM Hack start
//Yeah,already defined above^^
// $newid = $newuser->getVar('uid');
$pm_handler =& xoops_gethandler('privmessage');
$pm =& $pm_handler->create();
$pm->setVar("subject", "Add the subject here");
$pm->setVar("msg_text", "Add your message text here!!!!!!!");
//Newuser's id
$pm->setVar("to_userid", $newid);
// Admin's id,1 in my case
$pm->setVar("from_userid", 1);
if (!$pm_handler->insert($pm)) {
// echo "Failed to send Welcome Private Message!!";
// No need to echo this failure-message here,I think so!!...Just optional^^
}
//Welcome PM Hack end


The comments are owned by the author. We aren't responsible for their content.
  • Home away from home

 Auto PM to new members hack

Thanks Bluenova for a very usefil FAQ

 
  • Quite a regular

 Re: Auto PM to new members hack

This is really useful!
I suggest this should be included in the next XOOPS also, if we can make is databasable it is very more useful as well.Please use this on Xoops.org!

 
  • Home away from home

 Re: Auto PM to new members hack

Quote:

This is really useful!I suggest this should be included in the next XOOPS also,



In that case i suggest someone puts it into the feature request tracker on the sourceforge.net core development site so it doesn´t go unnoticed.

 
  • Quite a regular

 Re: Auto PM to new members hack

Unfortuanately it seems that, the features requested at the feature tracker will not be read, since it is about one month that I have posted a feature there and nobody even botherd to look at it and comment on it! So what I think is that feature tracker is useless.

 

 Re: Auto PM to new members hack

I think it is checked by Mith and phppp but niether of them have been around much recently. As we all know real life has to come first every now and again I have added it, as I'm sure it will be looked at for 2.4

 
  • Just popping in

 Re: Auto PM to new members hack

Hi,

Can this be done in XOOPS 2.2.3?

Thanks.

 

 Re: Auto PM to new members hack

I havn't tested it, but I think it should?

 
  • Just popping in

 Re: Auto PM to new members hack

sorry to be a pain, but I just cannot find the code that need to be changed, I am using the latest version of xoop.


could you please point out the exact path to register.php

Thank you

 

 Re: Auto PM to new members hack

register.php is in the root of your XOOPS installation. i.e.

/home/yourusername/xoops/register.php or
/home/yourusername/register.php

(if you're using linux)

 
  • Just popping in

 Re: Auto PM to new members hack

Thank you bluenova for your reply, but all I have in register.php is the following code

include 'mainfile.php';
$parsed_url = parse_url($_SERVER['REQUEST_URI']);
$url = "modules/profile/register.php";
header('location: '.$url);
//this file is deprecated
?>

 

 Re: Auto PM to new members hack

register.php in 2.2.X can be found in:

/**Xoopsinstallation**/modules/profile/register.php

 
  • Not too shy to talk

 Re: Auto PM to new members hack

I am using 2.2.4 and I dont see the line mentioned that we are supposed to look for

 

 Re: Auto PM to new members hack

I havn't tested it, but I think it can go after:

$newid $newuser->getVar('uid');
        if (!
$member_handler->addUserToGroup(XOOPS_GROUP_USERS$newid)) {
            echo 
_PROFILE_MA_REGISTERNG;
            break;
        }

Can you post back if it works?

cheers
Bluenova

 
  • Not too shy to talk

 Re: Auto PM to new members hack

ok so far I tested it on 2.2.3 final but not 2.2.4 but it worked fine. Now if someone wants to jump on www.shotokansite.com and register to test it out and let us know how it went then we will know if it is viable for 2.2.4 as well.

 
  • Home away from home

 Re: Auto PM to new members hack

A brilliant hack. I've added it to all 3 of my sites in one global sweep!

 
  • Theme Designer

 Re: Auto PM to new members hack

I've just installed it on XOOPS 2.2.4...tested and worked fine :)

 
  • Just popping in

 Re: Auto PM to new members hack

This is such a cool little hack. I'm using 2.0.13.2 and it works fine.
It would be nice though if it were part of the system module or some area of the administration preferences instead of a hack - it would make future upgrades much easier.

 
  • Quite a regular

 Re: Auto PM to new members hack

thanks for this great hack...working perfectly in 20132

 
  • Not too shy to talk

 Auto PM to new members hack only if activated?

Great. But how should I go about if I would like the PM to be sent only if the user clicks on the activation link, or the admin activates manually the userprofile?

 
  • Not too shy to talk

 Re: Auto PM to new members hack only if activated?

I tried that in a separate file (i just called it testpm.php) and it would not send and it error, but for the reason for the error, it printed nothing.

How would i make it work in an another file? Not the register file.

 
  • Just popping in

 auto welcome pm msg

GREAT HACK! love it.

now if I could get the script for deleted old pm's to delete ALL of them I would be all set. :)

 
  • Just can't stay away

 welcome pm hack

i just notice that this hack continue working in my site although i remove this hack long time ago

after some investigation i found out the hack is stored in the database and not in registerform.php/register.php and it is automatically send new pm to newly registered users..
i nver touch my database
..i don't know why the hack is stored in database

I'm using XOOPS 2.0181..i deleted it from phpmyadmin and now everything is ok..

p/s:i noticed that this feature is integrated in the 2.3 core ..great

 
  • Just popping in

 re: nice hack

very nice hack, i has look this for a long time.

thanks