$CURRENT_USER is not working properly.

4 posts by 2 authors in: Forums > CMS Builder
Last Post: October 13, 2015   (RSS)

Hey Zicky, 

The following code isn't displaying for users who are logged in, as you've got a not operator in it:

<?php if (!$CURRENT_USER): ?><h3 style="margin-top:24px;">USER Logged In</h3>

If you remove that, the code should only display for users who are logged in:

<?php if ($CURRENT_USER): ?><h3 style="margin-top:24px;">USER Logged In</h3>

With this line of code:

<?php if ($CURRENT_USER): ?><h3 style="margin-top:24px;">Guest</h3>

Do you want to only appear for users who are logged out? If so, you need to add the following:

<?php if (!$CURRENT_USER): ?><h3 style="margin-top:24px;">Guest</h3>

For these fields:

<input name="registrant_name" value="<?php echo $CURRENT_USER['fullname'] ?>" size="24"><div>Name</div>
<input name="registrant_email" value="<?php echo $CURRENT_USER['email'] ?>" size="24"><div>Email</div>
<input name="registrant_phone" value="<?php echo $CURRENT_USER['phone'] ?>" size="24"><div>Phone</div>

Could you give me the code for the entire page? I'm not sure why they're not displaying at the moment. 

Thanks,

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By Mikey - October 12, 2015

Hey Greg,
I sent the files to you via email, since there was a few other files that work with the .php file in question. I made notes about this in the email too.

Zick

Thanks Zick,

I think I've worked out what the issue is; the server doesn't allow sharing of cookies between HTTP and HTTPS. 

If you look through your phpinfo and search for session.cookie_secure, you'll see that this option is enabled locally.

I'd contact your host and ask them if they can disable session.cookie_secure, then you'll be able to use the current_user variable on both protocols.

Thanks,

Greg

Greg Thomas







PHP Programmer - interactivetools.com