Forum Replies Created
-
Hi, Gionna. Like I said, the reports are group-specific, so we need to know which group the user is in when they take our surveys.
BTW: I tried to send you a detailed request via your website, but there’s a bug in your “Contact Me” function. When I try to submit the message, I get an error saying “Could not verify the reCaptcha response.” But there is no reCaptcha function!
Here’s the request I tried to send:
“Hello! We are using the Formidable Forms plugin to generate surveys and reports. The reports are group-specific, so we need to attach the user’s group ID to the survey data.Formidable Forms has no integration with BuddyPress, but they can access the WordPress user profile metadata.
Can I hire you to write a routine that would copy the current user’s group ID from the BuddyPress tables into their WP user profile metadata?
I don’t have much money, so I’m hoping this wouldn’t be too complicated. Thanks!”
Sorry if that last post was confusing, @venutius: a previous message I wrote didn’t get posted for some reason.
What we need is to copy the user’s Group ID from the BP tables to the WP user profile meta. We are using Formidable Forms, and they can only access the WP user meta: they have no integration with BP.
I don’t have much money, but I could pay you to write this function if you think you could do it.
We’ll probably need your expertise from time to time, @venutius.
If you do freelance work, please email me at storm@reconomics.orgEven better would be if that data is in the WordPress user meta data. We’re trying to access it via a hidden field in a Formidable Forms survey.
Hi, @venutius. I hate to impose on your generosity, but I’m getting desperate, and you seem like someone who might be able to solve a major problem for us.
We need to capture the BuddyPress group a user belongs to when they are not on the group page. Do you know where in the BuddyPress user profile that data is stored?
Also, using your snippet: if we wanted to restrict users to being in just one group, we would set $membership_total >= 2, right?
Thanks again for your help!
Much appreciated!
Many thanks for the quick response. I’m not a developer so please excuse two clueless questions:
1) Do these snippets work on their own, or does your User Roles plugin need to be activated?
2) Do I insert both of the above snippets in the child theme, like this?
add_filter( ‘bp_get_group_join_button’, ‘venutius_restrict_group_join’, 10, 2 );function venutius_restrict_group_join( $button, $group ) {
global $bp;
if ( current_user_can( ‘manage_options’ ) || $group->is_member ) {
return $button;
}$membership_total = count( BP_Groups_Member::get_membership_ids_for_user( $bp->loggedin_user->id ) );
if ( $membership_total >= 1 ) {
return false;
}return $button;
}
add_action( ‘groups_join_group’, ‘venutius_group_join_filter’, 10, 2 );function venutius_group_join_filter( $group_id, $user_id ) {
global $bp;if ( current_user_can( ‘manage_options’ ) ) {
return;
}$membership_total = count( BP_Groups_Member::get_membership_ids_for_user( $user_id ) );
if ( $membership_total >= 4 ) {
groups_leave_group( $group_id, $user_id )
}}
Hello, @venutius: I’m wondering if we can use your plugin to restrict our members to joining a maximum of three groups.
OK, thanks for that clarification!
Thanks, but are you answering the question in the subject line, or the question in the body?
Do my existing WordPress users automatically become BuddyPress users?