Code for logged in

Add this to the top of post for logged in users:

 

if ($userRole === 'Admin') { // Allow access to administrative features 
} elseif ($userRole === 'User') { // Allow access to regular user features 
} else { // Deny access or display an error for unknown roles }