Hide text that users enter
4 posts by 2 authors in: Forums > CMS Builder
Last Post: June 6, 2019 (RSS)
By andreasml - June 3, 2019
Hi
I wonder whether it is possible to hide the text of a record that users enter, using asterisks (*****) instead of the word (or maybe the first letter of the word followed by the asterisks), in everyone else but the author.
Kind regards
Andreas Lazaris
By gkornbluth - June 5, 2019 - edited: June 5, 2019
Hi,
If you're using the Website Membership plugin, this post might have a simple idea that you can use:
https://www.interactivetools.com/forum/forum-posts.php?postNum=2241262
Here's the code from that post:
<?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; ?>
If you create an if condition so that if the current logged in user has $accessLevel == 6 (author) or if $CMSB['isAdmin'] then echo the text from the field you want to control, if not show **** (or don't show that field at all)
Hope that gives you an idea or two.
Jerry Kornbluth
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
By andreasml - June 5, 2019
Hi
Thank you for your suggestion. It seems that it might work. But where should I add this code?
Regards
Andreas
By gkornbluth - June 6, 2019
The code would go on the web page that you want to control.
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php