Skip to:
Content
Pages
Categories
Search
Top
Bottom

Joining groups on interaction

  • Profile photo of richard-b
    Richard-B
    Participant

    @richard-b

    Hi
    I know this used to be something which BuddyPress did but since seems to have been depreciated.

    What I would like to be able to do is to auto-join a member to a group if they comment in a public groups forum.

    This used to be turned off with the following:
    define(‘BP_DISABLE_AUTO_GROUP_JOIN’,true);
    However declaring false does nothing.

    Does anyone know if this is still possible?

    Thanks!

Viewing 1 replies (of 1 total)
  • Profile photo of richard-b
    Richard-B
    Participant

    @richard-b

    After further investigation I have found that this functionality used to be built in to the bp-groups-screens.php files groups_screen_group_forum() function.

    ...
    /* Posting a reply */
                            if ( !$bp->action_variables[2] && isset( $_POST['submit_reply'] ) ) {
                                    /* Check the nonce */
                                    check_admin_referer( 'bp_forums_new_reply' );
     
                                    /* Auto join this user if they are not yet a member of this group */
                                    if ( $bp->groups->auto_join && !is_super_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )
                                            groups_join_group( $bp->groups->current_group->id, $bp->loggedin_user->id );
     
                                    if ( !$post_id = groups_new_group_forum_post( $_POST['reply_text'], $topic_id, $_GET['topic_page'] ) )
                                            bp_core_add_message( __( 'There was an error when replying to that topic', 'buddypress'), 'error' );
                                    else
                                            bp_core_add_message( __( 'Your reply was posted successfully', 'buddypress') );
     
                                    if ( $_SERVER['QUERY_STRING'] )
                                            $query_vars = '?' . $_SERVER['QUERY_STRING'];
     
                                    bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic_slug . '/' . $query_vars . '#post-' . $post_id );
                            }
    ...

    Anyone have any idea how to turn this back into a usable function?

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar