Changeset 548 for trunk/bp-groups.php
- Timestamp:
- 11/17/2008 10:54:11 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups.php
r545 r548 3 3 4 4 define ( 'BP_GROUPS_IS_INSTALLED', 1 ); 5 define ( 'BP_GROUPS_VERSION', '0.2. 5' );5 define ( 'BP_GROUPS_VERSION', '0.2.6' ); 6 6 7 7 include_once( 'bp-groups/bp-groups-classes.php' ); … … 58 58 is_confirmed tinyint(1) NOT NULL DEFAULT '0', 59 59 is_banned tinyint(1) NOT NULL DEFAULT '0', 60 invite_sent tinyint(1) NOT NULL DEFAULT '0', 60 61 KEY group_id (group_id), 61 62 KEY is_admin (is_admin), … … 309 310 } 310 311 312 // Remove notifications 313 bp_core_delete_notifications_for_user_by_type( $bp['loggedin_userid'], 'groups', 'group_invite' ); 314 311 315 bp_catch_uri( 'groups/list-invites' ); 312 316 } … … 458 462 459 463 if ( $is_single_group ) { 460 if ( isset($bp['action_variables']) && $bp['action_variables'][ 1] == 'send' ) {464 if ( isset($bp['action_variables']) && $bp['action_variables'][0] == 'send' ) { 461 465 // Send the invites. 462 466 groups_send_invites($group_obj); … … 865 869 } else { 866 870 $user_fullname = bp_core_global_user_fullname( $requesting_user_id ); 867 $user_url = bp_core_get_userurl( $requesting_user_id );868 871 return '<a href="' . bp_group_permalink( $group, false ) . '/admin/membership-requests/" title="' . $user_fullname .' requests group membership">' . sprintf( __('%s requests membership for the group "%s"'), $user_fullname, $group->name ) . '</a>'; 869 872 } … … 876 879 877 880 if ( (int)$total_items > 1 ) { 878 return '<a href="' . site_url() . '/' . MEMBERS_SLUG . '/'. $bp['groups']['slug'] . '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('%d accepted group membership requests'), (int)$total_items, $group->name ) . '</a>';881 return '<a href="' . $bp['loggedin_domain'] . $bp['groups']['slug'] . '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('%d accepted group membership requests'), (int)$total_items, $group->name ) . '</a>'; 879 882 } else { 880 883 return '<a href="' . bp_group_permalink( $group, false ) . '/?new">' . sprintf( __('Membership for group "%s" accepted'), $group->name ) . '</a>'; … … 886 889 887 890 $group = new BP_Groups_Group( $group_id, false, false ); 888 891 889 892 if ( (int)$total_items > 1 ) { 890 893 return '<a href="' . site_url() . '/' . MEMBERS_SLUG . '/' . $bp['groups']['slug'] . '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('%d rejected group membership requests'), (int)$total_items, $group->name ) . '</a>'; … … 901 904 902 905 if ( (int)$total_items > 1 ) { 903 return '<a href="' . site_url() . '/' . MEMBERS_SLUG . '/'. $bp['groups']['slug'] . '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('You were promoted to an admin in %d groups'), (int)$total_items ) . '</a>';906 return '<a href="' . $bp['loggedin_domain'] . $bp['groups']['slug'] . '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('You were promoted to an admin in %d groups'), (int)$total_items ) . '</a>'; 904 907 } else { 905 908 return '<a href="' . bp_group_permalink( $group, false ) . '/?new">' . sprintf( __('You were promoted to an admin in the group %s'), $group->name ) . '</a>'; … … 913 916 914 917 if ( (int)$total_items > 1 ) { 915 return '<a href="' . site_url() . '/' . MEMBERS_SLUG . '/'. $bp['groups']['slug'] . '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('You were promoted to a mod in %d groups'), (int)$total_items ) . '</a>';918 return '<a href="' . $bp['loggedin_domain'] . $bp['groups']['slug'] . '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('You were promoted to a mod in %d groups'), (int)$total_items ) . '</a>'; 916 919 } else { 917 920 return '<a href="' . bp_group_permalink( $group, false ) . '/?new">' . sprintf( __('You were promoted to a mod in the group %s'), $group->name ) . '</a>'; 921 } 922 break; 923 924 case 'group_invite': 925 $group_id = $item_id; 926 927 $group = new BP_Groups_Group( $group_id, false, false ); 928 $user_url = bp_core_get_userurl( $user_id ); 929 930 if ( (int)$total_items > 1 ) { 931 return '<a href="' . $bp['loggedin_domain'] . $bp['groups']['slug'] . '/invites" title="' . __( 'Group Invites', 'buddypress' ) . '">' . sprintf( __('You have %d new group invitations'), (int)$total_items ) . '</a>'; 932 } else { 933 return '<a href="' . $bp['loggedin_domain'] . $bp['groups']['slug'] . '/invites" title="' . __( 'Group Invites', 'buddypress' ) . '">' . sprintf( __('You have an invitation to the group: %s'), $group->name ) . '</a>'; 918 934 } 919 935 break; … … 1242 1258 1243 1259 1244 function groups_get_invites_for_group( $group_id ) { 1245 return BP_Groups_Group::get_invites( $group_id ); 1246 } 1247 1248 1249 function groups_get_invites_for_user( $user_id = false ) { 1260 function groups_get_invites_for_group( $user_id, $group_id ) { 1261 return BP_Groups_Group::get_invites( $user_id, $group_id ); 1262 } 1263 1264 function groups_check_user_has_invite( $user_id, $group_id ) { 1265 BP_Groups_Member::check_has_invite( $user_id, $group_id ); 1266 } 1267 1268 function groups_get_invites_for_user( $user_id = false, $group_id = false ) { 1250 1269 global $bp; 1251 1270 … … 1253 1272 $user_id = $bp['loggedin_userid']; 1254 1273 1255 return BP_Groups_Member::get_invites( $user_id);1274 return BP_Groups_Member::get_invites( $user_id, $group_id ); 1256 1275 } 1257 1276 … … 1261 1280 1262 1281 // Send friend invites. 1263 $invited_users = groups_get_invites_for_group( $group_obj->id ); 1264 1265 for ( $i = 0; $i < count( $invited_users); $i++ ) { 1266 $user_id = $invited_users[$i]; 1267 1268 // Send the email 1269 1270 $invited_user = new BP_Core_User( $user_id ); 1271 $inviter_name = bp_core_get_userlink( $bp['loggedin_userid'], true, false, true ); 1272 1273 $message = "You have been invited to join the group '" . $group_obj->name . "' by " . $inviter_name . '.'; 1274 $message .= "\n\n"; 1275 $message .= "View the group: " . $invited_user->user_url . $bp['groups']['slug'] . "/" . $group_obj->slug . "\n"; 1276 $message .= "Accept the invite: " . $invited_user->user_url . $bp['groups']['slug'] . "/invites/accept/" . $group_obj->id . "\n"; 1277 $message .= "Reject the invite: " . $invited_user->user_url . $bp['groups']['slug'] . "/invites/reject/" . $group_obj->id . "\n"; 1278 1279 wp_mail( $invited_user->email, __("New Group Invitation:", 'buddypress') . $group_obj->name, $message, "From: noreply@" . $_SERVER[ 'HTTP_HOST' ] ); 1280 } 1281 1282 $invited_users = groups_get_invites_for_group( $bp['loggedin_userid'], $group_obj->id ); 1283 1284 for ( $i = 0; $i < count( $invited_users ); $i++ ) { 1285 $member = new BP_Groups_Member( $invited_users[$i], $group_obj->id ); 1286 $member->invite_sent = 1; 1287 $member->save(); 1288 } 1289 1290 groups_notification_group_invites( $group_obj->id, $invited_users, $bp['loggedin_userid'] ); 1291 1282 1292 do_action( 'groups_send_invites', $group_obj->id, $invited_users ); 1283 1293 }
Note: See TracChangeset
for help on using the changeset viewer.