Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function add_cp_tweaks_css()
- {
- $css .= file_get_contents(PATH_THIRD."my_cp_extension/css/cp.css");
- return ee()->extensions->last_call . "n" . $css;
- }
- function add_cp_tweaks_js()
- {
- $js .= file_get_contents(PATH_THIRD."my_cp_extension/js/cp.js");;
- return ee()->extensions->last_call . "n" . $js;
- }
- // cp.css
- .my-message {
- font-weight: bold;
- }
- // cp.js
- $(".t-0").prepend('<div class="my-message">You are not allowed to add pictures. Contact an admin.</div>');
- $user_group_to_show_message = 10;
- $referer = (array_key_exists('HTTP_REFERER',$_SERVER) ? $_SERVER['HTTP_REFERER'] : '');
- // If we're on the Edit page, get Entry ID from referrer and then use that to get the current page URL
- preg_match('/.*publish/edit/entry/(d+).*/', $referer, $entry);
- // If we're on the Create page, get Channel ID from referrer and then use that to determine if this is a listing entry
- preg_match('/.*publish/create/(d+).*/', $referer, $channel);
- if (array_key_exists(1,$entry)
- && is_numeric($entry[1])
- && ee()->session->userdata('group_id') === $user_group_to_show_message) {
- // We are on a Edit page, with the right user group to warn, go ahead and add CSS/JS
- }
- if (array_key_exists(1,$channel)
- && is_numeric($channel[1])
- && ee()->session->userdata('group_id') === $user_group_to_show_message) {
- // We are on a Create page, with the right user group to warn, go ahead and add CSS/JS
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement