Changeset 1291
- Timestamp:
- 04/01/2009 12:51:16 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups.php
r1290 r1291 320 320 global $bp; 321 321 322 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'member_promoted_to_mod' );323 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'member_promoted_to_admin' );322 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->groups->slug, 'member_promoted_to_mod' ); 323 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->groups->slug, 'member_promoted_to_admin' ); 324 324 325 325 do_action( 'groups_screen_my_groups' ); … … 341 341 342 342 /* Record this in activity streams */ 343 groups_record_activity( array( 'item_id' => $group_id, 'component_name' => 'groups', 'component_action' => 'joined_group', 'is_private' => 0 ) );343 groups_record_activity( array( 'item_id' => $group_id, 'component_name' => $bp->groups->slug, 'component_action' => 'joined_group', 'is_private' => 0 ) ); 344 344 } 345 345 … … 358 358 359 359 // Remove notifications 360 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'group_invite' );360 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->groups->slug, 'group_invite' ); 361 361 362 362 do_action( 'groups_screen_group_invites', $group_id ); … … 417 417 if ( isset($_GET['new']) ) { 418 418 // Delete group request notifications for the user 419 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'membership_request_accepted' );420 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'membership_request_rejected' );421 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'member_promoted_to_mod' );422 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'member_promoted_to_admin' );419 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->groups->slug, 'membership_request_accepted' ); 420 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->groups->slug, 'membership_request_rejected' ); 421 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->groups->slug, 'member_promoted_to_mod' ); 422 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->groups->slug, 'member_promoted_to_admin' ); 423 423 } 424 424 … … 816 816 817 817 // Remove any screen notifications 818 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'new_membership_request' );818 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->groups->slug, 'new_membership_request' ); 819 819 820 820 $request_action = $bp->action_variables[1]; … … 1502 1502 1503 1503 /* Record in activity streams */ 1504 groups_record_activity( array( 'item_id' => $group_obj->id, 'component_name' => 'groups', 'component_action' => 'created_group', 'is_private' => 0 ) );1504 groups_record_activity( array( 'item_id' => $group_obj->id, 'component_name' => $bp->groups->slug, 'component_action' => 'created_group', 'is_private' => 0 ) ); 1505 1505 1506 1506 do_action( 'groups_create_group_step2_save' ); … … 1621 1621 1622 1622 /* Record in activity streams */ 1623 groups_record_activity( array( 'item_id' => $group_obj->id, 'component_name' => 'groups', 'component_action' => 'new_forum_post', 'is_private' => 0, 'secondary_item_id' => $forum_post['post_id'] ) );1623 groups_record_activity( array( 'item_id' => $group_obj->id, 'component_name' => $bp->groups->slug, 'component_action' => 'new_forum_post', 'is_private' => 0, 'secondary_item_id' => $forum_post['post_id'] ) ); 1624 1624 1625 1625 do_action( 'groups_new_forum_topic_post', $group_obj->id, $forum_post ); … … 1643 1643 1644 1644 /* Record in activity streams */ 1645 groups_record_activity( array( 'item_id' => $group_obj->id, 'component_name' => 'groups', 'component_action' => 'new_forum_topic', 'is_private' => 0, 'secondary_item_id' => $topic['topic_id'] ) );1645 groups_record_activity( array( 'item_id' => $group_obj->id, 'component_name' => $bp->groups->slug, 'component_action' => 'new_forum_topic', 'is_private' => 0, 'secondary_item_id' => $topic['topic_id'] ) ); 1646 1646 1647 1647 do_action( 'groups_new_forum_topic', $group_obj->id, $topic ); … … 1735 1735 } 1736 1736 1737 function groups_delete_invite( $user_id, $group_id ) { 1738 global $bp; 1739 1740 $delete = BP_Groups_Member::delete_invite( $user_id, $group_id ); 1741 1742 if ( $delete ) 1743 bp_core_delete_notifications_for_user_by_item_id( $user_id, $group_id, $bp->groups->slug, 'group_invite' ); 1744 1745 return $delete; 1746 } 1747 1737 1748 function groups_get_invites_for_user( $user_id = false ) { 1738 1749 global $bp; … … 1813 1824 if ( !$user_id ) 1814 1825 $user_id = $bp->loggedin_user->id; 1826 1827 if ( groups_check_user_has_invite( $user_id, $group_id ) ) 1828 groups_delete_invite( $user_id, $group_id ); 1815 1829 1816 1830 $new_member = new BP_Groups_Member; … … 1827 1841 1828 1842 /* Record this in activity streams */ 1829 groups_record_activity( array( 'item_id' => $new_member->group_id, 'component_name' => 'groups', 'component_action' => 'joined_group', 'is_private' => 0 ) );1843 groups_record_activity( array( 'item_id' => $new_member->group_id, 'component_name' => $bp->groups->slug, 'component_action' => 'joined_group', 'is_private' => 0 ) ); 1830 1844 1831 1845 /* Modify group meta */ … … 1862 1876 1863 1877 function groups_new_wire_post( $group_id, $content ) { 1864 global $group_obj ;1878 global $group_obj, $bp; 1865 1879 1866 1880 /* Check the nonce first. */ … … 1872 1886 $private = true; 1873 1887 1874 if ( $wire_post_id = bp_wire_new_post( $group_id, $content, 'groups', $private ) ) {1888 if ( $wire_post_id = bp_wire_new_post( $group_id, $content, $bp->groups->slug, $private ) ) { 1875 1889 do_action( 'groups_new_wire_post', $group_id, $wire_post_id ); 1876 1890 … … 1888 1902 return false; 1889 1903 1890 if ( bp_wire_delete_post( $wire_post_id, 'groups', $table_name ) ) {1904 if ( bp_wire_delete_post( $wire_post_id, $bp->groups->slug, $table_name ) ) { 1891 1905 do_action( 'groups_deleted_wire_post', $wire_post_id ); 1892 1906 return true; … … 2057 2071 2058 2072 function groups_accept_membership_request( $membership_id ) { 2073 global $bp; 2059 2074 2060 2075 /* Check the nonce first. */ … … 2072 2087 2073 2088 /* Record this in activity streams */ 2074 groups_record_activity( array( 'item_id' => $membership->group_id, 'component_name' => 'groups', 'component_action' => 'joined_group', 'is_private' => 0 ) );2089 groups_record_activity( array( 'item_id' => $membership->group_id, 'component_name' => $bp->groups->slug, 'component_action' => 'joined_group', 'is_private' => 0 ) ); 2075 2090 2076 2091 /* Send a notification to the user. */ … … 2132 2147 2133 2148 // Remove the activity stream item 2134 groups_delete_activity( array( 'item_id' => $group_id, 'component_name' => 'groups', 'component_action' => 'created_group', 'user_id' => $bp->loggedin_user->id ) );2149 groups_delete_activity( array( 'item_id' => $group_id, 'component_name' => $bp->groups->slug, 'component_action' => 'created_group', 'user_id' => $bp->loggedin_user->id ) ); 2135 2150 2136 2151 // Remove all outstanding invites for this group -
trunk/bp-groups/bp-groups-classes.php
r1290 r1291 789 789 if ( !$user_id ) 790 790 return false; 791 791 792 792 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND inviter_id != 0 AND invite_sent = 1", $user_id, $group_id ) ); 793 } 794 795 function delete_invite( $user_id, $group_id ) { 796 global $wpdb, $bp; 797 798 if ( !$user_id ) 799 return false; 800 801 return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND inviter_id != 0 AND invite_sent = 1", $user_id, $group_id ) ); 793 802 } 794 803
Note: See TracChangeset
for help on using the changeset viewer.