This is what I have in my Quote Notification newpost_complete plugin. Works fine in 3.7 and worked in 3.6 to. You just need to change the field id number "profile_fields.field21" to whatever your custom profile field number is on your forums.
PHP Code:
$kr_load = array();
$kr_text = array();
if (preg_match_all("/\[quote=([^\\\"\]]*?)\](.*?)\[\/quote\]/is",$post['message'],$matches)>0) {
for ($kr=0;$kr<count($matches[1]);$kr++){
//echo $matches[1][$kr]."<br>";
$matches[1][$kr] = (strpos($matches[1][$kr],";")) ? substr($matches[1][$kr],0,strpos($matches[1][$kr],";")) : $matches[1][$kr];
if (strtolower($matches[1][$kr]) != strtolower($vbulletin->userinfo['username'])) {
if (!in_array($matches[1][$kr], $kr_load)) {
$kr_load[] = $matches[1][$kr];
$kr_text[] = "[quote=".$matches[1][$kr]."]".$matches[2][$kr]."[/quote]";
}
else {
for ($kri=0;$kri<count($kr_load);$kri++) {
if ($kr_load[$kri] == $matches[1][$kr]) {
$kr_text[$kri] .= "[quote=".$matches[1][$kr]."]".$matches[2][$kr]."[/quote]";
break;
}
}
}
}
}
}
if (count($kr_load) > 0) {
for ($kr=0;$kr<count($kr_load);$kr++) {
//echo "<br>" . $kr_load[$kr];
$quoteuserquery = $vbulletin->db->query_first("SELECT user_table.userid AS userid, profile_fields.field21 AS wantquotenotify FROM " . TABLE_PREFIX . "user AS user_table LEFT JOIN " . TABLE_PREFIX . "userfield AS profile_fields ON (user_table.userid=profile_fields.userid) WHERE user_table.username='" . $vbulletin->db->escape_string($kr_load[$kr]) . "' GROUP BY user_table.userid");
$theurl = $vbulletin->options['bburl'] . "/showthread.php?p=" . $post['postid'] . "#post" . $post['postid'];
if ($quoteuserquery['wantquotenotify'] == "Yes") {
// Override a potentially full inbox.
$senderpermissions['adminpermissions'] = 2;
$pmdm =& datamanager_init('PM', $vbulletin, ERRTYPE_ARRAY);
$pmdm->overridequota = true;
$pmdm->set('fromuserid', $vbulletin->userinfo['userid']);
$pmdm->set('fromusername', $vbulletin->userinfo['username']);
$pmdm->set('title', $vbphrase['quotenotify_subject']);
$pmdm->set('message', construct_phrase($vbphrase['quotenotify_message'], $kr_load[$kr], $vbulletin->userinfo['username'], $kr_text[$kr], $theurl));
$pmdm->set_recipients($kr_load[$kr], $senderpermissions);
$pmdm->set('dateline', TIMENOW);
$pmdm->save();
//echo "curr url is " . $vbulletin->url;
//echo "send a pm to " . $kr_load[$kr] . "with contents " . $kr_text[$kr];
}
}
}