Changeset 3904
- Timestamp:
- 05/15/2012 06:04:12 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-extend-buddypress.php
r3840 r3904 6 6 * @package bbPress 7 7 * @subpackage BuddyPress 8 * @todo maybe move to BuddyPress Forums once bbPress 1.1 can be removed 8 9 */ 9 10 … … 103 104 private $reply_slug = ''; 104 105 105 /** Functions *************************************************************/106 /** Setup Methods *********************************************************/ 106 107 107 108 /** … … 110 111 * @since bbPress (r3395) 111 112 */ 112 function __construct() {113 public function __construct() { 113 114 $this->setup_globals(); 114 115 $this->setup_actions(); 115 116 $this->setup_filters(); 117 $this->fully_loaded(); 116 118 } 117 119 … … 159 161 /** Activity **********************************************************/ 160 162 161 // Register the activity stream actions 162 add_action( 'bp_register_activity_actions', array( $this, 'register_activity_actions' ) ); 163 164 // Hook into topic creation 165 add_action( 'bbp_new_topic', array( $this, 'topic_create' ), 10, 4 ); 166 167 // Hook into reply creation 168 add_action( 'bbp_new_reply', array( $this, 'reply_create' ), 10, 5 ); 169 170 // Append forum filters in site wide activity streams 171 add_action( 'bp_activity_filter_options', array( $this, 'activity_filter_options' ), 10 ); 172 173 // Append forum filters in single member activity streams 174 add_action( 'bp_member_activity_filter_options', array( $this, 'activity_filter_options' ), 10 ); 175 176 // Append forum filters in single group activity streams 177 add_action( 'bp_group_activity_filter_options', array( $this, 'activity_filter_options' ), 10 ); 163 // Bail if activity is not active 164 if ( bp_is_active( 'activity' ) ) { 165 166 // Register the activity stream actions 167 add_action( 'bp_register_activity_actions', array( $this, 'register_activity_actions' ) ); 168 169 // Hook into topic creation 170 add_action( 'bbp_new_topic', array( $this, 'topic_create' ), 10, 4 ); 171 172 // Hook into reply creation 173 add_action( 'bbp_new_reply', array( $this, 'reply_create' ), 10, 5 ); 174 175 // Append forum filters in site wide activity streams 176 add_action( 'bp_activity_filter_options', array( $this, 'activity_filter_options' ), 10 ); 177 178 // Append forum filters in single member activity streams 179 add_action( 'bp_member_activity_filter_options', array( $this, 'activity_filter_options' ), 10 ); 180 181 // Append forum filters in single group activity streams 182 add_action( 'bp_group_activity_filter_options', array( $this, 'activity_filter_options' ), 10 ); 183 } 178 184 179 185 /** Favorites *********************************************************/ … … 241 247 add_filter( 'bbp_get_form_reply_content', array( $this, 'strip_mentions_on_edit' ) ); 242 248 } 249 250 /** 251 * Allow the variables, actions, and filters to be modified by third party 252 * plugins and themes. 253 * 254 * @since bbPress (r3902) 255 */ 256 private function fully_loaded() { 257 do_action_ref_array( 'bbp_buddypress_loaded', array( $this ) ); 258 } 259 260 /** Methods ***************************************************************/ 243 261 244 262 /** … … 278 296 */ 279 297 public function register_activity_actions() { 280 281 // Topics282 298 bp_activity_set_action( $this->component, $this->topic_create, __( 'New topic created', 'bbpress' ) ); 283 284 // Replies285 299 bp_activity_set_action( $this->component, $this->reply_create, __( 'New reply created', 'bbpress' ) ); 286 300 } … … 299 313 */ 300 314 private function record_activity( $args = '' ) { 301 302 // Bail if activity is not active303 if ( !bp_is_active( 'activity' ) )304 return false;305 315 306 316 // Default activity args … … 336 346 */ 337 347 public function delete_activity( $args = '' ) { 338 339 // Bail if activity is not active340 if ( !bp_is_active( 'activity' ) )341 return;342 348 343 349 // Default activity args … … 782 788 $forum_id = get_the_ID(); 783 789 $group_ids = bbp_get_forum_group_ids( $forum_id ); 784 } else 790 } elseif ( bbp_is_single_topic() ) { 785 791 $topic_id = get_the_ID(); 786 792 $slug = get_post_field( 'post_name', $topic_id ); … … 802 808 bp_core_redirect( $redirect_to ); 803 809 } 804 805 810 } 806 811 } … … 824 829 * @since bbPress (r3552) 825 830 */ 826 function __construct() {831 public function __construct() { 827 832 parent::start( 828 833 'forums', … … 843 848 * @global BuddyPress $bp 844 849 */ 845 function setup_globals() {850 private function setup_globals() { 846 851 global $bp; 847 852 … … 871 876 * 872 877 * @since bbPress (r3552) 873 * @global BuddyPress $bp 874 */ 875 function setup_nav() { 876 global $bp; 878 */ 879 private function setup_nav() { 877 880 878 881 // Stop if there is no user displayed or logged in 879 if ( !is_user_logged_in() && ! isset( $bp->displayed_user->id) )882 if ( !is_user_logged_in() && !bp_displayed_user_id() ) 880 883 return; 881 884 … … 895 898 896 899 // Determine user to use 897 if ( isset( $bp->displayed_user->domain) )898 $user_domain = $bp->displayed_user->domain;899 elseif ( isset( $bp->loggedin_user->domain) )900 $user_domain = $bp->loggedin_user->domain;900 if ( bp_displayed_user_id() ) 901 $user_domain = bp_displayed_user_domain(); 902 elseif ( bp_loggedin_user_domain() ) 903 $user_domain = bp_loggedin_user_domain(); 901 904 else 902 905 return; … … 960 963 * @global BuddyPress $bp 961 964 */ 962 function setup_admin_bar() {965 private function setup_admin_bar() { 963 966 global $bp; 964 967 … … 970 973 971 974 // Setup the logged in user variables 972 $user_domain = $bp->loggedin_user->domain;975 $user_domain = bp_loggedin_user_domain(); 973 976 $forums_link = trailingslashit( $user_domain . $this->slug ); 974 977 … … 1024 1027 * @global BuddyPress $bp 1025 1028 */ 1026 function setup_title() {1029 private function setup_title() { 1027 1030 global $bp; 1028 1031 … … 1061 1064 * 1062 1065 * @since bbPress (r3552) 1063 * 1064 */ 1065 function __construct() { 1066 */ 1067 public function __construct() { 1066 1068 1067 1069 // Name and slug … … 1101 1103 } 1102 1104 1103 function display() { 1105 /** 1106 * The primary display function for group forums 1107 */ 1108 protected function display() { 1104 1109 1105 1110 // Prevent Topic Parent from appearing … … 1119 1124 } 1120 1125 1121 /**1122 * Used to start an output buffer1123 */1124 public function ob_start() {1125 ob_start();1126 }1127 1128 /**1129 * Used to end an output buffer1130 */1131 public function ob_end_clean() {1132 ob_end_clean();1133 }1134 1135 1126 /** Edit ******************************************************************/ 1136 1127 … … 1141 1132 * @uses bbp_get_template_part() 1142 1133 */ 1143 function edit_screen() {1134 protected function edit_screen() { 1144 1135 1145 1136 // Add group admin actions to forum row actions … … 1173 1164 * @uses bbp_edit_forum_handler() To check for forum edit 1174 1165 */ 1175 function edit_screen_save() {1166 protected function edit_screen_save() { 1176 1167 1177 1168 // Bail if not a POST action … … 1230 1221 * @since bbPress (r3465) 1231 1222 */ 1232 function create_screen() {1223 protected function create_screen() { 1233 1224 1234 1225 // Bail if not looking at this screen … … 1257 1248 * @since bbPress (r3465) 1258 1249 */ 1259 function create_screen_save() {1250 protected function create_screen_save() { 1260 1251 1261 1252 check_admin_referer( 'groups_create_save_' . $this->slug ); … … 1314 1305 1315 1306 /** 1307 * Used to start an output buffer 1308 */ 1309 public function ob_start() { 1310 ob_start(); 1311 } 1312 1313 /** 1314 * Used to end an output buffer 1315 */ 1316 public function ob_end_clean() { 1317 ob_end_clean(); 1318 } 1319 1320 /** 1316 1321 * Creating a group forum or category (including root for group) 1317 1322 * … … 1647 1652 } 1648 1653 1654 /** Form Helpers **********************************************************/ 1655 1649 1656 public function forum_parent() { 1650 1657 ?> … … 1657 1664 public function topic_parent() { 1658 1665 1659 $forum_ids = bbp_get_group_forum_ids( bp_get_current_group_id() ); 1660 ?> 1666 $forum_ids = bbp_get_group_forum_ids( bp_get_current_group_id() ); ?> 1661 1667 1662 1668 <p>
Note: See TracChangeset
for help on using the changeset viewer.