In a system I have 3 users, Ben, Shane and Payne, the site functions normally for all users and also have same Menu system. However I am tasked to add one Menu item from core and be visible only for Ben.
So, I added Candy in the Menu item as Ben is kid, but now I cannot change the core in PHP saying
if('Ben' === $user->name) {
// Show the Candy Menu
}
But I want Candy menu to show only for Ben and hide it from others.
How do I do it with jQuery?
I am not looking to mess up the PHP code like:
<?php if('Ben' === $user->name):?>
<script ></script>
<?php endif; ?>
I want some logic of PHP to be implemented with jQuery, so, I don't mess with PHP code, instead implement the logic in jQuery. Something like:
//I am mixing PHP and jQuery here, I know it doesn't work but this is what I am looking for.
if('user' === 'Ben') {
$('#CandyMenu').show();
}
How do I do it?