Support

Home Forums Event Espresso Premium Restricted users are making promotion codes for all events. How to change that?

Restricted users are making promotion codes for all events. How to change that?

Posted: August 10, 2017 at 7:58 am


mcgilloweek

August 10, 2017 at 7:58 am

Hi. I have event organizer users who each have access to the Promotions menu. Because of the capabilities I set, they can only read their events, so only their event shows up in the Create Promotions sidebar about which event the promo code should apply to. And I have the capabilities set so they can only read/edit/delete their promotions and not others_promotions. However, I noticed that if they are not compliant with my instructions and do not select only their event in the Applies To… sidebar and select “Yes” for “Apply Promo to ALL Scope Items”, then they are able to make a promo code that applies to everyone’s events (at least that’s what it shows in the overview tab; that it applies to all events and is a global promotion).

Ideally, the event organizers follow my instructions on how to make the promo code only apply to their event. But I know they will be worried that it’s still a possibility that someone else can make a promo code for their event if they miss a step or make a mistake.

Is this just how it is by default that everyone can make a global code, no matter their capabilities, or have I set up their promotion capabilities incorrectly where somehow they are able to make promotions that apply to other people’s events (they currently can’t read or edit others_events or read or edit others_promotions)? How can I make 100% sure that they cannot make promo codes that apply to all events? Global codes will never even be made so even if I could disable global codes from being an option for everyone, that would work.

Here are the promotions-related Role capabilities I have enabled for them:
ee_delete_promotion
ee_delete_promotions
ee_edit_promotion
ee_edit_promotions
ee_read_promotion
ee_read_promotions

THANK YOU!!!


Josh

  • Support Staff

August 10, 2017 at 12:07 pm

Hi there,

One way to make sure they don’t use the option is you can disable it. Here’s some example code you can put into a site specific plugin that will deactivate the option if the current user doesn’t have the capability to edit others events:

add_action( 'event-espresso_page_espresso_promotions', 
'my_ee_disable_promo_disable_global_for_event_admins', 11 );
function my_ee_disable_promo_disable_global_for_event_admins() {
  if(!current_user_can('ee_edit_others_events')){
  ?>
  <script>
  jQuery( document ).ready(function($) {
      $("#PRO_global").prop("disabled", true);
      $("#PRO_global").parent().find(".description")
       .html("This option is deactivated.");
  });
  </script>
  <?php }
}


mcgilloweek

August 10, 2017 at 7:44 pm

That did it! Thank you.

The support post ‘Restricted users are making promotion codes for all events. How to change that?’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  mcgilloweek 2 years ago ago

Topic Tags

Notifications

This topic is: resolved
Do NOT follow this link or you will be banned from the site!