• Resolved Anonymous User 18191698

    (@anonymized-18191698)


    add_filter( 'mwai_stats_credits', function ( $credits, $userId ) {
      $user = get_userdata( $userId );
      if ( !empty( $user->roles) && is_array( $user->roles ) ) {
        foreach ( $user->roles as $role) {
          if ( $role === 'premium' ) {
            return 50;
          }
          if ( $role === 'standard' ) {
            return 10;
          }
        }
      }
      // This will be basically the default value set in the plugin settings
      // for logged-in users.
      return $credits;
    }, 10, 2);

    Regarding this code, if the roles I have are “subscriber” and “customer”, would I just replace the two in the example above with the roles on my site i.e. subscriber and customer? Can I enable “is absolute” with this code, too or do I just do that in the backend?

    • This topic was modified 3 years, 3 months ago by Anonymous User 18191698.
Viewing 1 replies (of 1 total)
  • Plugin Author Jordy Meow

    (@tigroumeow)

    Hi,

    Yes, that should work 🙂

    Can I enable “is absolute” with this code, too or do I just do that in the backend?

    We can’t override Absolute through this hook, so yes you need to set that in the backend.

Viewing 1 replies (of 1 total)

The topic ‘Limits Question’ is closed to new replies.