Skip to:
Content

BuddyPress.org

Changeset 8037


Ignore:
Timestamp:
03/04/2014 09:55:52 PM (11 years ago)
Author:
imath
Message:

Set bp_notifications_add_notification() arguments correctly in case of a new_membership_request

The group id needs to be the item_id argument of bp_notifications_add_notification() in case a member requested to join the group. The patch also makes sure the link to the user notification settings page is the one of the administrator of the group in the email sent to inform him of a new membership request.

Fixes #5446

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups/bp-groups-notifications.php

    r7653 r8037  
    6262        bp_notifications_add_notification( array(
    6363            'user_id'           => $admin_id,
    64             'item_id'           => $requesting_user_id,
    65             'secondary_item_id' => $group_id,
     64            'item_id'           => $group_id,
     65            'secondary_item_id' => $requesting_user_id,
    6666            'component_name'    => buddypress()->groups->id,
    6767            'component_action'  => 'new_membership_request'
     
    7272        return false;
    7373
     74    // Username of the user requesting a membership: %1$s in mail
    7475    $requesting_user_name = bp_core_get_user_displayname( $requesting_user_id );
    7576    $group                = groups_get_group( array( 'group_id' => $group_id ) );
    7677
     78    // Group Administrator user's data
    7779    $ud             = bp_core_get_core_userdata( $admin_id );
    7880    $group_requests = bp_get_group_permalink( $group ) . 'admin/membership-requests';
     81
     82    // Link to the user's profile who's requesting a membership: %3$s in mail
    7983    $profile_link   = bp_core_get_user_domain( $requesting_user_id );
     84
    8085    $settings_slug  = function_exists( 'bp_get_settings_slug' ) ? bp_get_settings_slug() : 'settings';
    81     $settings_link  = bp_core_get_user_domain( $requesting_user_id ) . $settings_slug . '/notifications/';
     86    // Link to the group administrator email settings: %s in "disable notifications" part of the email
     87    $settings_link  = bp_core_get_user_domain( $admin_id ) . $settings_slug . '/notifications/';
    8288
    8389    // Set up and send the message
     
    317323    switch ( $action ) {
    318324        case 'new_membership_request':
    319             $group_id = $secondary_item_id;
    320             $requesting_user_id = $item_id;
     325            $group_id = $item_id;
     326            $requesting_user_id = $secondary_item_id;
    321327
    322328            $group = groups_get_group( array( 'group_id' => $group_id ) );
Note: See TracChangeset for help on using the changeset viewer.