Changeset 3537 for trunk/bp-groups.php
- Timestamp:
- 12/18/2010 04:03:10 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups.php
r3536 r3537 52 52 /* This is a single group page. */ 53 53 $bp->is_single_item = true; 54 $bp->groups->current_group = new BP_Groups_Group( $group_id ); 54 $bp->groups->current_group = groups_get_groups( array( 'type' => 'active', 'include' => $group_id ) ); 55 $bp->groups->current_group = $bp->groups->current_group['groups'][0]; 55 56 56 57 /* Using "item" not "group" for generic support in other components. */ … … 292 293 $forum_id = groups_get_groupmeta( $bp->groups->current_group->id, 'forum_id' ); 293 294 295 $user_is_banned = false; 296 if ( !is_super_admin() && groups_is_user_banned( $bp->loggedin_user->id, $bp->groups->current_group->id ) ) 297 $user_is_banned = true; 298 294 299 if ( $topic_slug && $topic_id ) { 295 300 296 301 /* Posting a reply */ 297 if ( ! isset( $bp->action_variables[2] ) && isset( $_POST['submit_reply'] ) ) {302 if ( !$user_is_banned && !isset( $bp->action_variables[2] ) && isset( $_POST['submit_reply'] ) ) { 298 303 /* Check the nonce */ 299 304 check_admin_referer( 'bp_forums_new_reply' ); … … 373 378 374 379 /* Delete a topic */ 375 else if ( isset( $bp->action_variables[2] ) && 'delete' == $bp->action_variables[2] && empty( $bp->action_variables[3] ) ) {380 else if ( !$user_is_banned && isset( $bp->action_variables[2] ) && 'delete' == $bp->action_variables[2] && empty( $bp->action_variables[3] ) ) { 376 381 /* Fetch the topic */ 377 382 $topic = bp_forums_get_topic_details( $topic_id ); … … 387 392 bp_core_add_message( __( 'There was an error deleting the topic', 'buddypress'), 'error' ); 388 393 else 389 bp_core_add_message( __( 'The topic was deleted successfully', 'buddypress') );390 394 391 395 do_action( 'groups_delete_forum_topic', $topic_id ); … … 394 398 395 399 /* Editing a topic */ 396 else if ( isset( $bp->action_variables[2] ) && 'edit' == $bp->action_variables[2] && empty( $bp->action_variables[3] ) ) {400 else if ( !$user_is_banned && isset( $bp->action_variables[2] ) && 'edit' == $bp->action_variables[2] && empty( $bp->action_variables[3] ) ) { 397 401 /* Fetch the topic */ 398 402 $topic = bp_forums_get_topic_details( $topic_id ); … … 419 423 420 424 /* Delete a post */ 421 else if ( isset( $bp->action_variables[2] ) && 'delete' == $bp->action_variables[2] && isset( $bp->action_variables[4] ) && $post_id = $bp->action_variables[4] ) {425 else if ( !$user_is_banned && isset( $bp->action_variables[2] ) && 'delete' == $bp->action_variables[2] && isset( $bp->action_variables[4] ) && $post_id = $bp->action_variables[4] ) { 422 426 /* Fetch the post */ 423 427 $post = bp_forums_get_post( $post_id ); … … 440 444 441 445 /* Editing a post */ 442 else if ( isset( $bp->action_variables[2] ) && 'edit' == $bp->action_variables[2] && isset( $bp->action_variables[4] ) && $post_id = $bp->action_variables[4] ) {446 else if ( !$user_is_banned && isset( $bp->action_variables[2] ) && 'edit' == $bp->action_variables[2] && isset( $bp->action_variables[4] ) && $post_id = $bp->action_variables[4] ) { 443 447 /* Fetch the post */ 444 448 $post = bp_forums_get_post( $bp->action_variables[4] ); … … 469 473 /* Standard topic display */ 470 474 else { 475 if ( $user_is_banned ) 476 bp_core_add_message( __( "You have been banned from this group.", 'buddypress' ) ); 477 471 478 bp_core_load_template( apply_filters( 'groups_template_group_forum_topic', 'groups/single/home' ) ); 472 479 } 473 480 474 481 } else { 475 476 482 /* Posting a topic */ 477 483 if ( isset( $_POST['submit_topic'] ) && function_exists( 'bp_forums_new_topic') ) { … … 479 485 check_admin_referer( 'bp_forums_new_topic' ); 480 486 481 /* Auto join this user if they are not yet a member of this group */ 482 if ( $bp->groups->auto_join && !is_super_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) ) 487 if ( $user_is_banned ) { 488 $error_message = __( "You have been banned from this group.", 'buddypress' ); 489 490 } elseif ( $bp->groups->auto_join && !is_super_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) ) { 491 // Auto join this user if they are not yet a member of this group 483 492 groups_join_group( $bp->groups->current_group->id, $bp->loggedin_user->id ); 493 } 484 494 485 495 if ( empty( $_POST['topic_title'] ) ) … … 500 510 } 501 511 } 502 512 503 513 bp_core_redirect( $redirect ); 504 505 514 } 506 515
Note: See TracChangeset
for help on using the changeset viewer.