Want more features on Pastebin? Sign Up, it's FREE!
Guest

php snippet user role conditional logic

By: a guest on Mar 27th, 2012  |  syntax: PHP  |  size: 0.91 KB  |  views: 136  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. $user_roles = $current_user->roles;
  3. $user_role = array_shift($user_roles);
  4. ?>
  5.  
  6. <?php if ($user_role == 'administrator') {
  7.      echo do_shortcode('[enter download-monitor shortcode here]'); }  
  8.                          
  9. elseif ($user_role == 'editor') {
  10.      echo do_shortcode('[enter download-monitor shortcode here]'); }  
  11.                          
  12. elseif ($user_role == 'media_access') {
  13.      echo do_shortcode('[enter download-monitor shortcode here]'); }  
  14.                        
  15. elseif ($user_role == 'retailer_access') {
  16.      echo do_shortcode('[enter download-monitor shortcode here]'); }  
  17.                        
  18. elseif ($user_role == 'internal_access') {
  19.      echo do_shortcode('[enter download-monitor shortcode here]'); }  
  20.  
  21. elseif ($user_role == 'all_vars_access') {
  22.      echo do_shortcode('[enter download-monitor shortcode here]'); }  
  23.                        
  24. elseif ($user_role == 'checkpoint_access') {
  25.      echo do_shortcode('[enter download-monitor shortcode here]'); }  
  26.                          
  27. ?>
clone this paste RAW Paste Data