The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Construct_Phrase issues
I have something like this below. I wanna use a phrase for the body of the PM being sent, so I can change it around in the phrase. However when this job runs in the cron job I get this error:
Fatal error: Unable to proceed with save while $errors array is not empty in class vb_datamanager_pm in /includes/class_dm.php on line 758 Code:
$place = construct_phrase($vbphrase['ptp_alertpm'], $pquery['username']); // Send a PM to user(s) $pmdm =& datamanager_init('PM', $vbulletin, ERRTYPE_ARRAY); $pmdm->set('fromuserid', $vbulletin->options['ptp_fromuserid']); $pmdm->set('fromusername', $vbulletin->options['ptp_fromusername']); $pmdm->set('title', 'Crap'); $pmdm->set('message', $place); $pmtousernames = implode(';', $pmto_users); $pmdm->set_recipients($pmtousernames, $botpermissions); $pmdm->set('dateline', TIMENOW); $pmdm->save(); |
#2
|
|||
|
|||
if it's a phrase it would be need to be the phrase variable and not just
Code:
$place Code:
$place = $vbphrase[place] |
#3
|
||||
|
||||
Peter, its still not working. Here is all my code to give you a better idea of what Im doing. Basically running a query and selecting all users who meet the WHERE condition and PM'ing them
Code:
$userpointsqry = $vbulletin->db->query_read(" SELECT vbbux, userid, username FROM " . TABLE_PREFIX . "user WHERE post_groan_times > 0 "); $pmto_users = array(); while($pquery = $vbulletin->db->fetch_array($userpointsqry)) { $pmto_users[] = $pquery['username']; // initiliaze array for PM sending } // End While Statement $ptp_alertpm = construct_phrase($vbphrase['ptp_alertpm'], $pquery['username']); // Send a PM to user(s) $pmdm =& datamanager_init('PM', $vbulletin, ERRTYPE_ARRAY); $pmdm->set('fromuserid', $vbulletin->options['ptp_fromuserid']); $pmdm->set('fromusername', $vbulletin->options['ptp_fromusername']); $pmdm->set('title', 'Crap'); $pmdm->set('message', $ptp_alertpm); $pmtousernames = implode(';', $pmto_users); $pmdm->set_recipients($pmtousernames, $botpermissions); $pmdm->set('dateline', TIMENOW); $pmdm->save(); |
#4
|
|||
|
|||
not sure. The logic in your code looks fine to me.
Just had a really odd idea though, so I'm not sure if/how it would work, but it might be worth considering.... If you are going to be wanting to edit the phrase frequently anyway, and you are already adding some settings, why not use a vboption setting for the body text? How well it would work with something like usernames I'm not sure, but thats something that will be easier to figure out (maybe a replacement variable or something if you cant just use $username or similar). Completely random idea, and no idea why I thought about it, but might be worth considering. |
#5
|
||||
|
||||
I did that actually prior, I had:
$pmdm->set('message', $ptp_alertpm); set to: $pmdm->set('message', $vbulletin->options['ptp_text'); and it worked great! But like you said..when I went to enter in the body of the PM text in the admincp, I couldnt use {1} or like $bbuserinfo[username]. NO variables work so it kinda sucks |
#6
|
|||
|
|||
did you try $pquery[username] in it?
I'm thinking outside the box a bit here so I might ask some really obvious questions before we get there. |
#7
|
||||
|
||||
Yeah tried that, also tried $pquery['username'], $username, etc
Here is a screenshot of what I'm dealing with Dam this sucks...lol |
#8
|
|||
|
|||
I'm about out of ideas then
unless..... maybe the [you] mod would work, but I'm not sure if it works in PM's or just posts, or if it even works on 3.6.x |
#9
|
||||
|
||||
I'm just surprised the dam construct_phrase function isnt working. It makes no sense. The code looks 100% accurate unless I'm missing something. Maybe others can shed some light.
Peter, I thankyou for your quick and friendly response. Happy Holidays to you buddy -------------------------------------------------------------- b.t.w, think I'm getting closer here: If I do Code:
$ptp_alertpm = construct_phrase($vbphrase['ptp_alertpm']); if (empty($vbphrase['ptp_alertpm'])) { echo "phrase is empty"; } |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|