Not really sure where to put this, but since the "Give/Trade" mod was in the download for this mod, I thought I'd add it here.
I found that the message that displayed in the shop telling people that someone gave them something wasn't really sufficient. I wanted it to PM the person when someone Gave them something from the shop. So, I coded it in to do so and thought I would just post it here in case someone else wanted to do the same.
Now, what I did was create an account on my forum named : "Auto Board Messenger" I did this because I plan on using it for a few other things as well. It's user_id = 1
Then added this code in the shop_give.php
Code: Select all
#
#-----[ FIND ]------------------------------------------
#
//send receiver message
$usermessage = $row['user_specmsg'];
$usermessage .= '<br><span class="genmed">'.$userdata['username'].' has given you a '.$itemname.'!</span>';
#
#-----[ AFTER, ADD ]------------------------------------------
#
$user_id = $give_to_user['user_id'];
$sql = "UPDATE phpbb_users
SET user_new_privmsg = '1', user_last_privmsg = '9999999999'
WHERE user_id = '$user_id'";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql);
}
$gift_pm_subject = $lang['gift_pm_subject'];
$gift_pm = $lang['gift_pm'];
$privmsgs_date = date("U");
$sql = "INSERT INTO phpbb_privmsgs (privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_enable_html, privmsgs_enable_bbcode, privmsgs_enable_smilies, privmsgs_attach_sig) VALUES ('0', '$gift_pm_subject', '1', '$user_id', '$privmsgs_date', '0', '1', '1', '0')";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not insert private message sent info', '', __LINE__, __FILE__, $sql);
}
$privmsg_sent_id = $db->sql_nextid();
$privmsgs_text = $lang['gift_pm_subject'];
//
$sql = "INSERT INTO phpbb_privmsgs_text (privmsgs_text_id, privmsgs_text) VALUES ($privmsg_sent_id, '" . str_replace("\'", "''", addslashes(sprintf($gift_pm,$userdata['username'],$itemname))) . "')";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not insert private message sent text', '', __LINE__, __FILE__, $sql);
}
In the script, I have the "private_message_from" user_id hard coded to 1....this is because I wanted it to come from the Board Messenger Account I created and that's it's user_id. If you create an account like that as well, you'd have to change the user_id number accordingly in this line (after $gift_pm_subject)
Code: Select all
('0', '$gift_pm_subject', '1', '$user_id', '$privmsgs_date', '0', '1', '1', '0')";
Then in your lang_main.php, set the variables for the give message subject and text. Just add something like this to your lang_main.php file
Code: Select all
$lang['gift_pm_subject'] = 'You have received a gift!';
$lang['gift_pm'] = '%s has given you a %s. Check your inventory!';
Just thought I'd share.

I'm going to mess with it some more. I'd like to allow the giver to send a message to the recipient as well. And, I'd also like to actually PM the Item given to the recipient along with the message. Or, at least a link to the item. Gotta work on that though.