getCurrentUserFromCMS() Admin, Editor or Author

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

By Zicky - 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 Dave - September 18, 2017

Hi Zicky, 

What are these values set to in your Website Membership plugin? 


Let me know, thanks!

Dave Edis - Senior Developer

By Zicky - 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 (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

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