Skip to:
Content
Pages
Categories
Search
Top
Bottom

Solved – Need to restrict my users to join multiple groups,

  • @rocky2sdat

    Participant

    Good day,

    I currently working on my office project. which is a website for managing a hackathon event that occurs every year. Our users will be in teams of 3 people and will be able to post about their project live on our website.
    Last year we did with hackerearth.com but this year our company hire me to build a website. Now I’ve used Buddypress for my website.

    Please find below the brief description for the site.

    1. The users cannot be part of two teams.

    2. Group size should be 3 members. If the group filled with 3 members no other users can able to join in the group.

    3. If a user already joined in a group he can’t able to create a group. If he left that group he can create a group.

    4. If a user created a group he will not able to join a different group or create another group.

    PS: For the second point I’ve used ‘BP Limit Members Per group’ it works fine. But still users can join multiple groups and I’ve also used youzer plugin.

    Please help me to resolve this.

Viewing 8 replies - 26 through 33 (of 33 total)
  • @restorm

    Participant

    We’ll probably need your expertise from time to time, @venutius.
    If you do freelance work, please email me at storm@reconomics.org

    @restorm

    Participant

    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.

    @restorm

    Participant

    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!”

    @gionnaalves

    Participant

    why this action is required ?

    @restorm

    Participant

    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.

    @iduy

    Participant

    hai @venutius
    Does this code work to Nouveau template ?

    @venutius

    Moderator

    Yes it should do

    Hi everyone, sorry I’ve not been around, I’ve been finding myself 🙂

    I might start having some time for programming in a couple of months and will look at updating my plugins.

    @iduy

    Participant

    I tried using this code :

    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 >= 2 ) {
    groups_leave_group( $group_id, $user_id )
    }
    }

    But, getting alerts syntax error, unexpected token “}”
    Can you help me ? @venutius

Viewing 8 replies - 26 through 33 (of 33 total)
  • You must be logged in to reply to this topic.
Skip to toolbar