Replies
By the way, there is a problem/bug with the live notfication plugin.
1.Chose public message on someone’s profile.
2.Then select friendship from the dropdown on the right side
3.Write something in the text field and click update
4.On next page click “see acitiviy”
Then a button “undefined” occurs which counts up every 10 seconds or so. This happens only if your plugin is installed. Interesting, I tested this behaviour with another live bell plugin and it has the same bug.
If your or his plugin is deactivated everythings works and no “undefined” occurs.Tested with twenty twenty five theme, buddypress, buddypress classic and your plugin on a fresh wordpress installation.
Here a mp4 video about this (link is just viewable 24 hours)
https://jumpshare.com/s/7EDAITT7ST9YKQYh9bZSBy the way. I tried to edit my post because I forgot the code blocks but it says you cannot create new topics??
add_filter(‘bp_get_the_members_invitation_property_’,function ($property,$value) { if ($property == ‘date_modified’){ $value= date(‘d.m.Y’,strtotime($value)); } return $value; },10,2);
I tried to overwrite the message with this filter below but inside the your surrounding filter it is not working. I suppose because the $message variable is unknown by the surrounding filter. But how can I solve this?
add_filter( ‘bp_user_can’, function ( $retval, $user_id, $capability, $site_id, $args ) {
if ( ‘bp_members_send_invitation’ !== $capability ) {
return $retval;
}$count = BP_Invitation::get_total_count( array(
‘inviter_id’ => $user_id
) );$max_allowed = 2;// change it.
if ( $count >= $max_allowed ) {
$retval = false;// overwrite message
add_filter(‘members_invitations_form_access_restricted’,’overwrite_message’);
function overwrite_message ($message) {
$message = ( ‘You have reached the limit of invitations.’);
return $message;
}}
return $retval;
}, 10, 5 );
Hi Brajesh,
it works. Great! Thank you.Just two more questions on this.
1. At the backend on the invitations table you can see that the date is saved under “date modified”. Is it possible to get this date and then add it to your function? To check if the count is more than the max_allowed FOR THE SAME DAY, then set $retval to false?
2. After the limit is reached the message pops up saying “you dont have the rights to send invitations”.
Am I able to manipulate this message saying something like “you have reached the daily limit on invitations! Try again later”?Regards
AlexPS: I really wonder why nobody has this implemented over the last years. Looks like buddypress core development slows down, which is not good.