Changeset 6285 for trunk/bp-groups/bp-groups-screens.php
- Timestamp:
- 09/03/2012 12:33:13 AM (14 years ago)
- File:
-
- 1 edited
-
trunk/bp-groups/bp-groups-screens.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups/bp-groups-screens.php
r6093 r6285 149 149 150 150 $topic_page = isset( $_GET['topic_page'] ) ? $_GET['topic_page'] : false; 151 151 152 152 // Don't allow reply flooding 153 153 if ( bp_forums_reply_exists( $_POST['reply_text'], $topic_id, bp_loggedin_user_id() ) ) { 154 154 bp_core_add_message( __( 'It looks like you\'ve already said that!', 'buddypress' ), 'error' ); 155 } else { 155 } else { 156 156 if ( !$post_id = groups_new_group_forum_post( $_POST['reply_text'], $topic_id, $topic_page ) ) 157 157 bp_core_add_message( __( 'There was an error when replying to that topic', 'buddypress'), 'error' ); … … 161 161 162 162 $query_vars = isset( $_SERVER['QUERY_STRING'] ) ? '?' . $_SERVER['QUERY_STRING'] : ''; 163 163 164 164 $redirect = bp_get_group_permalink( groups_get_current_group() ) . 'forum/topic/' . $topic_slug . '/' . $query_vars; 165 165 … … 883 883 add_action( 'bp_notification_settings', 'groups_screen_notification_settings' ); 884 884 885 ?> 885 /** Theme Compatability *******************************************************/ 886 887 /** 888 * The main theme compat class for BuddyPress Groups 889 * 890 * This class sets up the necessary theme compatability actions to safely output 891 * group template parts to the_title and the_content areas of a theme. 892 * 893 * @since BuddyPress (1.7) 894 */ 895 class BP_Groups_Theme_Compat { 896 897 /** 898 * Setup the groups component theme compatibility 899 * 900 * @since BuddyPress (1.7) 901 */ 902 public function __construct() { 903 add_action( 'bp_setup_theme_compat', array( $this, 'is_group' ) ); 904 } 905 906 /** 907 * Are we looking at something that needs group theme compatability? 908 * 909 * @since BuddyPress (1.7) 910 */ 911 public function is_group() { 912 913 // Bail if not looking at a group 914 if ( ! bp_is_groups_component() ) 915 return; 916 917 // Group Directory 918 if ( ! bp_current_action() && ! bp_current_item() ) { 919 bp_update_is_directory( true, 'groups' ); 920 921 do_action( 'groups_directory_groups_setup' ); 922 923 add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'directory_dummy_post' ) ); 924 add_filter( 'bp_replace_the_content', array( $this, 'directory_content' ) ); 925 926 // Creating a group 927 } elseif ( bp_is_groups_component() && bp_is_current_action( 'create' ) ) { 928 add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'create_dummy_post' ) ); 929 add_filter( 'bp_replace_the_content', array( $this, 'create_content' ) ); 930 931 // Group admin 932 } elseif ( bp_is_single_item() ) { 933 add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'single_dummy_post' ) ); 934 add_filter( 'bp_replace_the_content', array( $this, 'single_content' ) ); 935 936 } 937 } 938 939 /** Directory *************************************************************/ 940 941 /** 942 * Update the global $post with directory data 943 * 944 * @since BuddyPress (1.7) 945 */ 946 public function directory_dummy_post() { 947 948 // Title based on ability to create groups 949 if ( is_user_logged_in() && bp_user_can_create_groups() ) { 950 $title = __( 'Groups', 'buddypress' ) . ' <a class="button" href="' . trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create' ) . '">' . __( 'Create a Group', 'buddypress' ) . '</a>'; 951 } else { 952 $title = __( 'Groups', 'buddypress' ); 953 } 954 955 bp_theme_compat_reset_post( array( 956 'ID' => 0, 957 'post_title' => $title, 958 'post_author' => 0, 959 'post_date' => 0, 960 'post_content' => '', 961 'post_type' => 'bp_group', 962 'post_status' => 'publish', 963 'is_archive' => true, 964 'comment_status' => 'closed' 965 ) ); 966 } 967 968 /** 969 * Filter the_content with the groups index template part 970 * 971 * @since BuddyPress (1.7) 972 */ 973 public function directory_content() { 974 bp_buffer_template_part( 'groups/index' ); 975 } 976 977 /** Create ****************************************************************/ 978 979 /** 980 * Update the global $post with create screen data 981 * 982 * @since BuddyPress (1.7) 983 */ 984 public function create_dummy_post() { 985 986 // Title based on ability to create groups 987 if ( is_user_logged_in() && bp_user_can_create_groups() ) { 988 $title = '<a class="button" href="' . trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() ) . '">' . __( 'Groups', 'buddypress' ) . '</a> ' . __( 'Create a Group', 'buddypress' ); 989 } else { 990 $title = __( 'Groups', 'buddypress' ); 991 } 992 993 bp_theme_compat_reset_post( array( 994 'ID' => 0, 995 'post_title' => $title, 996 'post_author' => 0, 997 'post_date' => 0, 998 'post_content' => '', 999 'post_type' => 'bp_group', 1000 'post_status' => 'publish', 1001 'is_archive' => true, 1002 'comment_status' => 'closed' 1003 ) ); 1004 } 1005 1006 /** 1007 * Filter the_content with the create screen template part 1008 * 1009 * @since BuddyPress (1.7) 1010 */ 1011 public function create_content() { 1012 bp_buffer_template_part( 'groups/create' ); 1013 } 1014 1015 /** Single ****************************************************************/ 1016 1017 /** 1018 * Update the global $post with single group data 1019 * 1020 * @since BuddyPress (1.7) 1021 */ 1022 public function single_dummy_post() { 1023 bp_theme_compat_reset_post( array( 1024 'ID' => 0, 1025 'post_title' => bp_get_current_group_name(), 1026 'post_author' => 0, 1027 'post_date' => 0, 1028 'post_content' => '', 1029 'post_type' => 'bp_group', 1030 'post_status' => 'publish', 1031 'is_archive' => true, 1032 'comment_status' => 'closed' 1033 ) ); 1034 } 1035 1036 /** 1037 * Filter the_content with the single group template part 1038 * 1039 * @since BuddyPress (1.7) 1040 */ 1041 public function single_content() { 1042 bp_buffer_template_part( 'groups/single/home' ); 1043 } 1044 } 1045 new BP_Groups_Theme_Compat();
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)