BuddyDev

Search

BuddyPress Private Message Rate Limiter – ensure limit message stays

  • Participant
    Level: Initiated
    Posts: 4
    Stefan on #51467

    Hi,

    is it possible to ensure that the “feedback” (custom) message when a user has reached his limit stays there until he can send a new message?

    (I am using BuddyBoss platform + theme)

    Simple scenario: a user can send 1 message per 1 minute:

    So, lets say the user just sent a message and tries to send another one right after.
    The so-called “feedback” message (or custom message if one was set in admin settings) appears, telling him to slow down or to wait. This message stays visible as long as the user stays on the same page/same message thread.

    However, if a user:

    1. refreshes the page,
    2. leaves the page and comes back again to the same message page or
    3. if the user switches message threads (left side panel)

    the limit/feedback message disappears.

    Is it possible to make sure that the message does not go away/stays there no matter if page refreshes or message thread is changed?

    Sure, each time the user tries to send a message inside the limit , the message will show up again but it also disappears if one of the 3 above points happen.
    Ideally, the message “warning” would still show when a user switches to another message thread or refreshes the page.

    Any chance to always show the limit message until the user can send a new one?

    Thanks 🙂

  • Keymaster
    (BuddyDev Team)
    Posts: 24237
    Brajesh Singh on #51500

    Hi Stefan,
    Thank you for using the plugin.

    I am sorry, the plugin does not have any ability to do that.

    There are API methods available to check for the ability

    
    
    BP_Rate_Limit_Private_Message_Helper::can_send($user_id)
    BP_Rate_Limit_Private_Message_Helper::can_send_reply($user_id)
    

    to check if the user can create a new message thread or reply. Since the queries are not cached, they are not efficient(also time dependent) and I will suggest avoiding adding permanent notifications for now.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved