Hi Brajesh, i’m testing Private Message Rate Limiter with the code you supplied, but I can’t make it work.
No matter the user role, subscriber or customer, the setting in BP Rate Limit Private Message is the one that apply.
What should the message value be in BP settings to make the code work? I have tried with 0, but this gives unlimited messages to all roles. Setting the value to 5, restricts all roles, what is wrong?
Regards
Carstenfunction buddydev_custom_get_role_based_message_limit( $role ) { // duration- in minutes // limit - how many in that duration $limits = array( 'administrator' => array( 'duration' => 1440, 'limit' => 0, // 0 means no limit. ), 'editor' => array( 'duration' => 60, 'limit' => 10, ), 'author' => array( 'duration' => 60, 'limit' => 5, ), 'contributor' => array( 'duration' => 1440, 'limit' => 20, ), 'subscriber' => array( 'duration' => 1440, 'limit' => 5, ), 'customer' => array( 'duration' => 1440, 'limit' => 0, // 0 means no limit. ), ); $default = array( 'duration' => bp_get_option( 'bp_rate_limit_pm_throttle_duration', 5 ), 'limit' => get_option( 'bp_rate_limit_pm_count', 5 ), ); return isset( $limits[ $role ] ) ? $limits[ $role ] : $default; }
Hi Carsten,
It seems to me you have not added the actual filter. Can you please post me the complete code.There should be a few more lines.
Thank you
BrajeshHi Carsten,
I am sorry, It took me some time to find out the original code.I had shared it as a gist here
https://gist.github.com/sbrajesh/cc37e8794527f86046e1d880490d974bCan you please check if you are using the complete code?
Regards
BrajeshHi Brajesh, thanks for the code, you were right, my code wasn’t complete.
The code is working now, but there is a bug some were.
If I set the limit to 0, no limit, messaging is unblocked as it should. If I set the limit to 5000 within one minute, messaging is blocked.
Are the BP Rate Limit Private Message dashboard settings overruled by the settings in the code?
Regards
Carsten'subscriber' => array( 'duration' => 1, 'limit' => 0,
'subscriber' => array( 'duration' => 1, 'limit' => 5000,
Hi Carsten,
Can you please check from the Users screen which roles the user in question have?The user has subscriber role, I also changed the role to customer. Even with a limit of 30000, messages is blocked. It seems like all other values than 0, are blocked?
'customer' => array( 'duration' => 1440, 'limit' => 0, ),
'customer' => array( 'duration' => 1440, 'limit' => 30000, ),
Hi Carsten,
Can you please confirm if you are using the latest version of the private message rate limiter plugin?I am not sure why it is not working for you as I do have it working.
Also, is there any chance you are using our message privacy plugin or any other plugin that blocks receiving message from users?
Regards
BRajeshHi Brajesh, I’m using Version 1.0.6, and I’m not using message privacy plugin, or other which can block the messages, to my knowledge.
Now that I know the code is correct, I have to go through my setup, to find out what is conflicting with the code.
Just to clarify, the BP Rate Limit Private Message settings in the dashboard are irrelevant?Regards
Carsten
You must be logged in to reply to this topic.