This course will be retired on June 1, 2025.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Giving the user a way they can update their password is important. In this video, we will create a User Profile page with a password reset form.
Note on the Code
We could also have done
function requireAdmin() {
requireAuth();
...
}
If we want to use the $session object we need to tell the function to pull that object from the global scope. (See the later video where we update this function: starting at 1:45)
global $session;
New Function to Display Success
function display_success() {
global $session;
if(!$session->getFlashBag()->has('success')) {
return;
}
$messages = $session->getFlashBag()->get('success');
$response = '<div class="alert alert-success alert-dismissable">';
foreach ($messages as $message) {
$response .= "{$message}<br>";
}
$response .= '</div>';
return $response;
}
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up