getCurrentUserFromCMS() Admin, Editor or Author

6 posts by 2 authors in: Forums > CMS Builder
Last Post: October 5, 2017   (RSS)

By Mikey - September 13, 2017

Does this getCurrentUserFromCMS() still work for CMSB 3.0+

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; ?>

Thanks, Zicky

By Mikey - September 18, 2017 - edited: September 18, 2017

Hey Dave,

They are set as follows:

$GLOBALS['WSM_ACCOUNTS_TABLE']            = 'members';
$GLOBALS['WSM_SEPARATE_LOGIN']            = true;

I still have "accounts" for the CMS, but for the website memberships I'm using a section editor called "members".

Thanks, Zicky

By Dave - October 4, 2017

Hey Zicky, 

Did you ever get this sorted out?  If not feel free to email server details to dave@interactivetools.com (and a link to this thread) and we can take a look.  I wasn't able to recreate the issue locally.

Dave Edis - Senior Developer
interactivetools.com

By Mikey - October 5, 2017

Hey Dave,

Actually - I can't remember which website was giving me these issues. But I checked the site I believe was related to this thread and it appears to be working fine. It very well could have been a cookie thing and right about the same time I noticed my browser was acting up and I reinstalled it. Hard to say, but I haven't experienced any issues since the original post.

I'll let you know if I come across the issue again.

Thanks, Zicky

By Dave - October 5, 2017

Ok, thanks.  Just wanted to follow up and make sure it wasn't an ongoing issue.  Cheers!

Dave Edis - Senior Developer
interactivetools.com