Title: Limits Question
Last modified: February 19, 2023

---

# Limits Question

 *  Resolved Anonymous User 18191698
 * (@anonymized-18191698)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/limits-question/)
 *     ```wp-block-code
       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](https://wordpress.org/support/users/tigroumeow/)
 * (@tigroumeow)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/limits-question/#post-16489533)
 * 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.

 * ![](https://ps.w.org/ai-engine/assets/icon-256x256.png?rev=3431928)
 * [AI Engine - The Chatbot, AI Framework & MCP for WordPress](https://wordpress.org/plugins/ai-engine/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ai-engine/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ai-engine/)
 * [Active Topics](https://wordpress.org/support/plugin/ai-engine/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ai-engine/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ai-engine/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Jordy Meow](https://wordpress.org/support/users/tigroumeow/)
 * Last activity: [3 years, 3 months ago](https://wordpress.org/support/topic/limits-question/#post-16489533)
 * Status: resolved