Re: getCurrentUserFromCMS() Admin, Editor or Author

2 posts by 1 authors in: Forums > CMS Builder
Last Post: August 23, 2018   (RSS)

By Zicky - 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], ...