Skip to:
Content

BuddyPress.org

Changeset 3408 for trunk/bp-groups.php


Ignore:
Timestamp:
11/13/2010 11:18:48 PM (14 years ago)
Author:
djpaul
Message:

Use the correct group ID and user ID in groups_join_group(). Fixes #2733, props r-a-y.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups.php

    r3371 r3408  
    16951695        $user_id = $bp->loggedin_user->id;
    16961696
    1697     /* Check if the user has an outstanding invite, is so delete it. */
     1697    // Check if the user has an outstanding invite, is so delete it.
    16981698    if ( groups_check_user_has_invite( $user_id, $group_id ) )
    16991699        groups_delete_invite( $user_id, $group_id );
    17001700
    1701     /* Check if the user has an outstanding request, is so delete it. */
     1701    // Check if the user has an outstanding request, is so delete it.
    17021702    if ( groups_check_for_membership_request( $user_id, $group_id ) )
    17031703        groups_delete_membership_request( $user_id, $group_id );
    17041704
    1705     /* User is already a member, just return true */
     1705    // User is already a member, just return true
    17061706    if ( groups_is_user_member( $user_id, $group_id ) )
    17071707        return true;
    1708 
    1709     if ( !$bp->groups->current_group )
    1710         $bp->groups->current_group = new BP_Groups_Group( $group_id );
    17111708
    17121709    $new_member = new BP_Groups_Member;
     
    17221719        return false;
    17231720
    1724     /* Record this in activity streams */
     1721    if ( !isset( $bp->groups->current_group ) || !$bp->groups->current_group || $group_id != $bp->groups->current_group->id )
     1722        $group = new BP_Groups_Group( $group_id );
     1723    else
     1724        $group = $bp->groups->current_group;
     1725
     1726    // Record this in activity streams
    17251727    groups_record_activity( array(
    1726         'action' => apply_filters( 'groups_activity_joined_group', sprintf( __( '%1$s joined the group %2$s', 'buddypress'), bp_core_get_userlink( $user_id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . esc_attr( $bp->groups->current_group->name ) . '</a>' ) ),
     1728        'action' => apply_filters( 'groups_activity_joined_group', sprintf( __( '%1$s joined the group %2$s', 'buddypress'), bp_core_get_userlink( $user_id ), '<a href="' . bp_get_group_permalink( $group ) . '">' . esc_attr( bp_get_group_name( $group ) ) . '</a>' ) ),
    17271729        'type' => 'joined_group',
    1728         'item_id' => $group_id
     1730        'item_id' => $group_id,
     1731        'user_id' => $user_id
    17291732    ) );
    17301733
    1731     /* Modify group meta */
     1734    // Modify group meta
    17321735    groups_update_groupmeta( $group_id, 'total_member_count', (int) groups_get_groupmeta( $group_id, 'total_member_count') + 1 );
    17331736    groups_update_groupmeta( $group_id, 'last_activity', gmdate( "Y-m-d H:i:s" ) );
Note: See TracChangeset for help on using the changeset viewer.