View Full Version : Help with vbmail function
reotto
04-02-2009, 11:24 PM
I am trying to edit the 'email' field to change it to a second alternate e-mail address made up of field5@field6. Anyone have any ideas? This line of code is what I am interested in modifying: vbmail($subscription['email'], $subject, $message);
$subscriptions = $db->query("
SELECT subscriptions.userid, username, email
FROM " . ADV_DYNA_TABLE_PREFIX . "subscribeentry AS subscriptions
INNER JOIN " . TABLE_PREFIX . "user AS user ON (subscriptions.userid = user.userid)
WHERE entryid = '$entryid' AND user.lastactivity > '$entry[dateline]' AND subscriptions.userid != '$userid'
");
while ($subscription = $db->fetch_array($subscriptions))
{
eval(fetch_email_phrases(ADV_DYNA_PREFIX . '_subscribe_entry2', 0));
vbmail($subscription['email'], $subject, $message);
}
}
?>
Dismounted
04-03-2009, 05:06 AM
Just change it? I don't see what the real problem is here. Unless you are talking about using plugins - but that's not possible as there are no hook locations there.
reotto
04-03-2009, 08:06 AM
Should it be vbmail($subscription[$field5@$field6], $subject, $message);
OR
vbmail($subscription['field5@field6'], $subject, $message);
Do I need the dollar signs? Do I need the 's? Is it going to be a problem that I am calling data in vB from vB Dynamics?
Dismounted
04-03-2009, 09:11 AM
Custom profile fields are not fetched in that query. You can just add a join to do that (see the existing join).
reotto
04-03-2009, 10:24 AM
OK I took another route for some other features, but I am still stuck because I suck at JOIN. Here is the file or plugin I found and added, but now I need to find out how to add the "cellemail" field to the $subscriptions table so I can change the $subscription['email'] to $subscription['cellemail']. Here is spot where I think I need to pull the code for SMS 1.2 I loaded from.
$vbulletin->db->query_write("
CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "cellsettings` (
`userid` INT NOT NULL ,
`cellnum` VARCHAR( 20 ) NOT NULL ,
`cellprovider` VARCHAR( 5 ) NOT NULL ,
`cellprovidername` VARCHAR( 50 ) NOT NULL ,
`country` VARCHAR( 50 ) NOT NULL ,
`cellemail` VARCHAR( 100 ) NOT NULL ,
`confirm` INT( 4 ) NOT NULL ,
`smsonpm` INT( 4 ) NOT NULL ,
`smscontact` INT( 4 ) NOT NULL ,
`maxtexts` INT( 4 ) NOT NULL ,
`dailytexts` INT( 4 ) NOT NULL DEFAULT '0' ,
PRIMARY KEY ( `userid` )
) ENGINE = MYISAM
");
But this part is throwing me for a loop as well.
if ($vbulletin->GPC['cellemail'])
{
$cellinfo = $db->query_first("
SELECT cellnum FROM " . TABLE_PREFIX . "cellsettings
WHERE userid = '" . $vbulletin->userinfo['userid'] . "'
LIMIT 1
");
// build their cell email address
$shiznizzle = $db->query_first("
SELECT email FROM " . TABLE_PREFIX . "cellproviders
WHERE id = '" . $vbulletin->GPC['cellemail'] . "'
LIMIT 1
");
$cellemail = "$cellinfo[cellnum]" . $shiznizzle['email'] . "";
The whole file for SMS 1.2 is attached. I tried a couple of different ways to do the join, but I could never get them into the subscription tables.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.