This topic is locked

Event on 'assign users to group'

10/20/2008 8:24:33 AM
PHPRunner General questions
author

Dear all,
is it possible to add an event on the "assign users to group" page after changing a users group?

J
Jane 10/20/2008

Hi,
unfortunately no.

You can add your code on this page editing generated files manually.

501334 10/21/2008

Hi,
hopefully you can help me. I wants the application to send an notification email in case of changing a users group. I have modified the file "admin_members_list.php" manually, but it don't work, the application sends the mail to the wrong users.
Here is my code, the modification is marked with / Modificaton by DST /
Thanks in advance
Daniel

//DECLARATION

$strSubject = "";
if(postvalue("a")=="save")

{

$useridx=0;

foreach(postvalue("username") as $user)

{

$useridx++;

// delete records which are not needed

$sql="delete from `intranet_ugmembers` where UserName='".db_addslashes($user)."'";

if($user==$_SESSION["UserID"])

$sql.=" and GroupID<>-1";

db_exec($sql,$conn);

if(count($_POST["cb_".$useridx]))

{

$glist="";

foreach(@$_POST["cb_".$useridx] as $g)

{

if($g<0)

{

if($user==$_SESSION["UserID"] && $g==-1)

continue;

$sql="insert into `intranet_ugmembers` (UserName,GroupID) values ('".htmlspecialchars($user)."',".$g.")";

db_exec($sql,$conn);



/* MODIFICATION BY DST */

$qryMail = new Query("Select email from user where username = '".$user."'");

$recRecordset = $qryMail->fetch();

$strTo .= ", ".$recRecordset['email'];



mail(substr($strTo,2),"Notification",$strBody,"From:<webmaster@xyz.com>");

/* MODIFICATION END */



}

else

{

if($glist!="")

$glist.=",";

$glist.=$g;

}

}
J
Jane 10/22/2008

Daniel,
I recommend you to send email with your code or link to your application on the Demo Account server to support@xlinesoft.com.