Jump to content

adding more than one id (one line)


alwaysme

Recommended Posts

hello, thanks for  your quick response. but u are not done with me... :D

 

what do i place inside the

 

{ ... }

?

 

lets say i only want it for group 3 and 5 and thats it (no 4)?

 

what would it be? and im not sure what the $blah function is...sorry this is extremely amatuer q's..

 

/*
* Send a notification to the user who applied
*/
if($op=='message' && $group_id==3) {

 

IN { } you execute your commands.

$blah is variable for array, in array there you can place integers which in this case are that acces levels,

if you want group 3 and 5 then you need make

< ?php $blah = array(3, 5) ?>

 

thats all i know. if you dont understand arrays you can find at google, arrays are simple.

 

sorry for my bad English :)

hello, thanks for  your quick response. but u are not done with me... :D

 

what do i place inside the

 

{ ... }

?

 

You put your code in there.  Your condition checks if user meets level requirements, if they do, then...put the code in there.

 

lets say i only want it for group 3 and 5 and thats it (no 4)?

 

what would it be? and im not sure what the $blah function is...sorry this is extremely amatuer q's..

 

Then you would use option #3, the one where I said "..with specific numbers"

$blah = array(3, 4, 7);
if ($op=='message' && in_array($group_id, $blah)) { ... }

 

If you just wnat 3 and 5 then change the numbers in the array(..) to just 3 and 5.

 

 

thanks guys, but this is getting too complicated. when i make changes im getting a blank page...

 

can we work with larger junks of code or its not allowed here??

 

for example...the script im using sends an email to the admin once someone fills out a complete form

 

/* confirmation email to staff */
list($body,$from,$subject,$html,$reply_to,$return_path)=sqlget("
    select body,from_addr,subject,html,reply_to,return_path from system_emails
    where email_id=5 and active=1");
        $body=str_replace("%jobno%",$ref,$body);
$html=str_replace("%jobno%",$ref,$html);
$subject=str_replace("%jobno%",$ref,$subject);
$body=str_replace("%link%","$server_name2/admin/resumes.php?op=edit&id=$resume_id",$body);
$html=str_replace("%link%","<a href=$server_name2/admin/resumes.php?op=edit&id=$resume_id>$server_name2/admin/resumes.php?op=edit&id=$resume_id</a>",$html);
if(!$from)
    $from="noreply@$email_domain";

$q=sqlquery("select distinct email from user,user_group
	     where user.user_id=user_group.user_id and
	        group_id=3 and notify=1 and email<>''");          <-------------- this line??
while(list($admin_email)=sqlfetchrow($q)) {
    $msg = new message($from,$admin_email,$subject);
    $msg->body($body);
    if($reply_to)
	$msg->headers.="\nReply-To: $reply_to";
    if($return_path)
	$msg->headers.="\nReturn-Path: $return_path";
    if($html)
	$msg->body($html,'text/html');
    if($body)
	$msg->send();
}
    }

    ob_end_clean();
    if($job2)
        header("Location: jobsearch.php?job2=$job2".($f_login?"":"&resume_id=$resume_id").
    "&msg=".urlencode($msg_resume_register[LOGGED]));
    else
header("Location: jobsearch.php?msg=".urlencode($msg_resume_register[sUCCESS]));
    exit();
} 

 

 

 

the code above dispatchs an email to group "3" which is adminstrators...id like that email to also go to group "5" which are sub-admins...can you please guide me with this?

 

i appreciate this. If anyone needs help with logo design i am happy to assist..

thank u

I've already told you twice how to do it. Use an array and do a condition to check if the user level number is in the array.  I've provided the code for you, twice.  I see conditions all over your script, so you seem to know what those are about.  What exactly are you having trouble with, as far as making a simple array and checking if your number is in_array(..)? No offense, but I really don't see how I can make it any simpler than giving you a working example..which I already did.  I mean, I see you using list() which is like, 1 step away from arrays. Or maybe a cousin once removed, or something.  Do you want me to write your code for you? I'm available, for a modest fee.

Hello, i totally understand the stance u are taking with this. I'd have a more upset approach if i were in your place also..but please understand i did not write any of that code. Its a ready made script i want to use for my website. When someone fills in a form they get an email

 

i tried hard just searching for that line of code that is responsible for dispatching the email. I tried applying your code but i do get errors...

 

 

i know you offered solutions but i am having trouble applying them to this code. kindly help me fix this

 

$q=sqlquery("select distinct email from user,user_group
	     where user.user_id=user_group.user_id and
	        group_id=3 && and notify=1 and email<>''");  

       

 

 

anybody find a resolution for me?

 

/* confirmation email to staff */
list($body,$from,$subject,$html,$reply_to,$return_path)=sqlget("
    select body,from_addr,subject,html,reply_to,return_path from system_emails
    where email_id=5 and active=1");
        $body=str_replace("%jobno%",$ref,$body);
$html=str_replace("%jobno%",$ref,$html);
$subject=str_replace("%jobno%",$ref,$subject);
$body=str_replace("%link%","$server_name2/admin/resumes.php?op=edit&id=$resume_id",$body);
$html=str_replace("%link%","<a href=$server_name2/admin/resumes.php?op=edit&id=$resume_id>$server_name2/admin/resumes.php?op=edit&id=$resume_id</a>",$html);
if(!$from)
    $from="noreply@$email_domain";

$q=sqlquery("select distinct email from user,user_group
	     where user.user_id=user_group.user_id and
	        group_id=3 and notify=1 and email<>''");          <-------------- this line??
while(list($admin_email)=sqlfetchrow($q)) {

i added

 

$myblah = array(3, 5);

 

under this line

 

 $from="noreply@$email_domain";

 

and then i get stuck adding your changes to this

 

 group_id=3 and notify=1 and email<>''"); ??

 

 

againi want it to send email to also group id 5 instead of 3 only.... :-\

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.