Replies
Aiit thanks boss
Thank you boss, it worked ..
Should i close this thread as resolved? ..when i have another trouble/question ild open another thread??
/** * Restrict sending request. * * @param bool $is_valid is valid request. * @param int $user_id sender user. * * @return bool */ function buddydev_custom_restrict_sending_friendship_request( $is_valid, $user_id ) { // If a user has these many friends, they won't be able to send new request. $limit_on_friends_count = 1; // If a user has specified number of friends, can not send new request. if ( friends_get_friend_count_for_user( $user_id ) >= $limit_on_friends_count ) { return false; } // for sent request count. global $wpdb; $bp = buddypress(); $sent_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT('*') FROM {$bp->friends->table_name} WHERE initiator_user_id = %d", $user_id ) ); // this is the maximum number of request a user can send // it includes accepted friendship(sent by the user too). $allowed_request_count = 1;// change it if you need. if ( $sent_count >= $allowed_request_count ) { return false; } return $is_valid; } add_filter( 'bpf_restrictions_user_is_valid_sender', 'buddydev_custom_restrict_sending_friendship_request', 10, 2 );
–
Yes i copied from the email you sent me
// If a user has specified number of friends, can not send new request. if ( friends_get_friend_count_for_user( $user_id ) >= $limit_on_friends_count ) { return false; }
– it gives
#Syntax error, unexpected ‘;’#And gives 505 error when i try to load site
Ok, boss i would wait.
1- i knw i 30000000 is over 50 years
2 i know it works when i set it to 30mins.
3 i want to now if it could be on forever.. Each user should only be able to send just the set amount for friend request forever.. For example.. A user should only send just 1 friend request for ever ( no time duration) jst for ever.. Till i turn it off
4 if number 3. Can not be done, then what is the highest time period i can set??
….5- ok, it does not automatically accept friend request .. So i set it to count by request, But their is no request count.. I cant find any where to view the request count?? .. I can only see the request on notifications..
But cant find any count increasing or decreasing when i test to send request from dummy accts
Or could it be my theme problem i use kelly theme.. Or maybe its cos i use buddypress noveau? ..could it be why im not seeing the notices aswell?
Ild wait till evening for your response
…
-happy new year btwBoss i knw you too busy, but
are you able to reply now??The ones i stated above are still not working (no notice messages are showing)
–
“duration of time user can send friend request” is also not working when i set it to 30,000000
Does it hav a limit?..because i want it to be on forever? To make users only be able to send just 1 friend request forever
..If you are able to reply..pls do
this No. of Friends & Friendship Request Sent & Received ..in this pic https://i.postimg.cc/kggWrLsK/msg-3-not-work.png
i dunno but doesnt it mean ..if a user sends.. then the friendship count would automaticcally increase by 1 friend? whether or not the reciever of the request chooses to accept the request or not? ..well it does not work: https://i.postimg.cc/fWHw2FV6/friendsss-screnshot-counf.png .. i sent a request to that dummy account .. but no friends count increased.
—
i basically want to speed adding of the new recruits up .. i.e one the recruiter(the one who invited) sends friend request ..the friends count would automatically increase … wether or not the reciever of the request chooses to accept the request or not .. – since the friendship is already limited..then no need to wait for acceptance of requests.or is there a code to automatically accept friend requests? .. a code i could add to bp-custom.php?
………
…..
========another thing is most of this messages: https://i.postimg.cc/yYPry4WZ/msgg-1-nt-work.png are not showing … dunno why .. but its not really important to me.. i just thought you should know..
- This reply has been marked as private.
- This reply has been marked as private.
- evillizard on December 14, 2018 at 10:37 am in reply to: [Resolved] BuddyPress Poke on seperate Tab #19486
@brajesh, boss about this poke plugin … i wanted to ask you something about it… ild ask on my topic : https://buddydev.com/support/forums/topic/limit-friendship/