Skip to:
Content

BuddyPress.org

Ticket #6524: 6524.01.patch

File 6524.01.patch, 2.8 KB (added by dcavins, 9 years ago)
  • src/bp-groups/bp-groups-functions.php

    diff --git src/bp-groups/bp-groups-functions.php src/bp-groups/bp-groups-functions.php
    index a65f82d..ffae266 100644
    function groups_send_membership_request( $requesting_user_id, $group_id ) { 
    14961496        $requesting_user->is_confirmed  = 0;
    14971497        $requesting_user->comments      = isset( $_POST['group-request-membership-comments'] ) ? $_POST['group-request-membership-comments'] : '';
    14981498
     1499        /**
     1500         * Fires immediately before the creation of a new membership request.
     1501         *
     1502         * @since BuddyPress (2.4.0)
     1503         *
     1504         * @param bool  $continue            May the request proceed?
     1505         * @param obj   $requesting_user     Requesting_user membership object.
     1506         */
     1507        if ( ! apply_filters( 'groups_membership_request_is_allowed', true, $requesting_user ) ) {
     1508                return false;
     1509        }
     1510
    14991511        if ( $requesting_user->save() ) {
    15001512                $admins = groups_get_group_admins( $group_id );
    15011513
  • src/bp-groups/bp-groups-screens.php

    diff --git src/bp-groups/bp-groups-screens.php src/bp-groups/bp-groups-screens.php
    index 61a9ed6..83331cc 100644
    function groups_screen_group_request_membership() { 
    718718                        bp_core_add_message( __( 'There was an error sending your group membership request. Please try again.', 'buddypress' ), 'error' );
    719719                } else {
    720720                        bp_core_add_message( __( 'Your membership request was sent to the group administrator successfully. You will be notified when the group administrator responds to your request.', 'buddypress' ) );
     721                        // Redirect to group home screen on success.
     722                        bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );
    721723                }
    722                 bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );
    723724        }
    724725
    725726        /**
  • src/bp-templates/bp-legacy/buddypress/groups/single/request-membership.php

    diff --git src/bp-templates/bp-legacy/buddypress/groups/single/request-membership.php src/bp-templates/bp-legacy/buddypress/groups/single/request-membership.php
    index de1b1c5..f1a8bad 100644
    do_action( 'bp_before_group_request_membership_content' ); ?> 
    1212
    1313        <form action="<?php bp_group_form_action('request-membership' ); ?>" method="post" name="request-membership-form" id="request-membership-form" class="standard-form">
    1414                <label for="group-request-membership-comments"><?php _e( 'Comments (optional)', 'buddypress' ); ?></label>
    15                 <textarea name="group-request-membership-comments" id="group-request-membership-comments"></textarea>
     15                <textarea name="group-request-membership-comments" id="group-request-membership-comments"><?php
     16                        if ( isset( $_POST[ 'group-request-membership-comments' ] ) ) {
     17                                echo esc_textarea( $_POST[ 'group-request-membership-comments' ] );
     18                        }
     19                ?></textarea>
    1620
    1721                <?php
    1822