This topic is locked
[SOLVED]

 Pop up message to notify user form in not completed.

12/10/2013 2:38:20 PM
PHPRunner General questions
P
psenick author

Looking for any direction on how to have a pop up message alerting the user that their profile is not complete.
Example:

I am using PHPRunner 6.2, and the basic registration page asks for the username, full name, email and password to get them in the application.
I would like a popup that would alert them each time they log on that says "Your profile has not been completed, click here to finish your profile.".
I would base that off of the address fields or contact phone that if they are null, then the pop up would show.
Any help appreciated,
Paul

Sergey Kornilov admin 12/11/2013

There are several approaches to handle this. You definitely need to start with AfterSuccessfulLogin event. In this event you have access to all fields from the login table. Here is the sample code.

if ($data["address"]=="" || $data["phone"]=="") {

$_SESSION["show_message"]=true;

$_SESSION["user_id"]=$data["id"];

}


Now on the first page of your application (usually the menu page) you can insert the code snippet:

if ($_SESSION["show_message"]) {

echo "Your profile is incomplete. <a href=users_edit.php?editid1=".$_SESSION["user_id"].">Complete it now</a>";

$_SESSION["show_message"]=false;

}


This code assumes that login table name is users and key column name in this table is id. Adjust it accordingly.

P
psenick author 12/13/2013

Thanks Sergey worked perfectly!
Paul