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 ) { |
1496 | 1496 | $requesting_user->is_confirmed = 0; |
1497 | 1497 | $requesting_user->comments = isset( $_POST['group-request-membership-comments'] ) ? $_POST['group-request-membership-comments'] : ''; |
1498 | 1498 | |
| 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 | |
1499 | 1511 | if ( $requesting_user->save() ) { |
1500 | 1512 | $admins = groups_get_group_admins( $group_id ); |
1501 | 1513 | |
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() { |
718 | 718 | bp_core_add_message( __( 'There was an error sending your group membership request. Please try again.', 'buddypress' ), 'error' ); |
719 | 719 | } else { |
720 | 720 | 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 ) ); |
721 | 723 | } |
722 | | bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) ); |
723 | 724 | } |
724 | 725 | |
725 | 726 | /** |
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' ); ?> |
12 | 12 | |
13 | 13 | <form action="<?php bp_group_form_action('request-membership' ); ?>" method="post" name="request-membership-form" id="request-membership-form" class="standard-form"> |
14 | 14 | <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> |
16 | 20 | |
17 | 21 | <?php |
18 | 22 | |