Page 1 of 1

Send message using set account. (develping, need help)

Posted: Wed Dec 12, 2007 9:57 pm
by smileymattj
My goal is to be able to send PM's or post messages using an account other than the user's.
This will be set by group permissions.
I have a account named Admin, with user_id 31

so far i am working on the privmsg, just to get it working.

check box i created in posting_body.tpl
<input type="checkbox" name="admin_send" {ADMIN_SEND} />

in privmsg.php i have:

$admin_send = !empty($HTTP_POST_VARS['admin_send']) ? $HTTP_POST_VARS['admin_send'] : "";


if ($userdata['user_level'] == ADMIN && $admin_send = 1)
{
$userdata['user_id'] = 31;
}

this works but it does not return the checkbox value form the template file properly.

Re: Send message using set account. (develping, need help)

Posted: Thu Dec 13, 2007 3:51 am
by A_Jelly_Doughnut
This should be a comparison operator, not an assignment operator:

Code: Select all

$admin_send = 1
That is, it should be

Code: Select all

if ($userdata['user_level'] == ADMIN && $admin_send == 1) 

Re: Send message using set account. (develping, need help)

Posted: Fri Dec 14, 2007 12:01 am
by smileymattj
thanks jelly, that has got it checking the admin_send variable correctly now.

But i don't think my code for checking the status of the check box is correct. Should i be using GET?

Re: Send message using set account. (develping, need help)

Posted: Fri Dec 14, 2007 1:46 am
by A_Jelly_Doughnut
Normally "isset" is used instead of "!empty" ... if the rest of your data is in $HTTP_POST_VARS, then the checkbox is there too :)