SHARE
TWEET

Untitled

a guest Jul 18th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function add_cp_tweaks_css()
  2. {
  3.     $css .= file_get_contents(PATH_THIRD."my_cp_extension/css/cp.css");
  4.     return ee()->extensions->last_call . "n" . $css;
  5. }
  6.  
  7. function add_cp_tweaks_js()
  8. {
  9.     $js .= file_get_contents(PATH_THIRD."my_cp_extension/js/cp.js");;
  10.     return ee()->extensions->last_call . "n" . $js;
  11. }
  12.      
  13. // cp.css
  14. .my-message {
  15.     font-weight: bold;
  16. }
  17.  
  18. // cp.js
  19. $(".t-0").prepend('<div class="my-message">You are not allowed to add pictures. Contact an admin.</div>');
  20.      
  21. $user_group_to_show_message = 10;
  22.  
  23. $referer = (array_key_exists('HTTP_REFERER',$_SERVER) ? $_SERVER['HTTP_REFERER'] : '');
  24.  
  25. // If we're on the Edit page, get Entry ID from referrer and then use that to get the current page URL
  26. preg_match('/.*publish/edit/entry/(d+).*/', $referer, $entry);
  27.  
  28. // If we're on the Create page, get Channel ID from referrer and then use that to determine if this is a listing entry
  29. preg_match('/.*publish/create/(d+).*/', $referer, $channel);
  30.  
  31. if (array_key_exists(1,$entry)
  32.     && is_numeric($entry[1])
  33.     && ee()->session->userdata('group_id') === $user_group_to_show_message) {
  34.     // We are on a Edit page, with the right user group to warn, go ahead and add CSS/JS
  35. }
  36.  
  37. if (array_key_exists(1,$channel)
  38.     && is_numeric($channel[1])
  39.     && ee()->session->userdata('group_id') === $user_group_to_show_message) {
  40.     // We are on a Create page, with the right user group to warn, go ahead and add CSS/JS
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top