Re: getCurrentUserFromCMS() Admin, Editor or Author
2 posts by 1 authors in: Forums > CMS Builder
Last Post: August 23, 2018 (RSS)
By Mikey - August 22, 2018
When I try to use this to check if a front-end site visitor is Admin, Editor or Author, these types of users keep getting logged out of the CMS repeatedly.
<?php $CMSB = getCurrentUserFromCMS(); ?>
<?php if($CMSB): //if there is a user, do this. No user, then no error message ?>
<?php foreach ($CMSB['accessList'] as $record): ?>
<?php $accessLevel = $record['accessLevel']; ?>
<?php endforeach; ?>
<?php if($CMSB['isAdmin']) : ?>
Display Admin Message / Content <br />
<?php endif; ?>
<?php if($accessLevel == 9 ) : ?>
Display Editor Message / Content <br />
<?php endif; ?>
<?php if($accessLevel == 6 ) : ?>
Display Author Message / Content <br />
<?php endif; ?>
<?php endif; ?>
My Website Membership plugin values are set to:
$GLOBALS['WSM_ACCOUNTS_TABLE'] = 'members';
$GLOBALS['WSM_SEPARATE_LOGIN'] = true;
Anyone have any suggestions how to fix this?
Thanks Zicky,
In response to: [url "https://www.interactivetools.com/forum/forum-posts.php?postNum=2241155#post2241155"]getCurrentUserFromCMS() Admin, Editor or Author[/url], ...
Re: getCurrentUserFromCMS() Admin, Editor or Author R
By Mikey - August 23, 2018
Okay - so I think I got this working. Appears to have been a simple fix by going to the CMS security settings and checking the require HTTPS. Once I did that, I stopped getting logged out when switching between the gerCurrentUserFromCMS page and the CMS.
Require HTTPS Only allow users to login via secure HTTPS connections
Thought I'd share this for anyone else who may need to know.
Zicky