Changeset 2158 for trunk/bp-activity.php
- Timestamp:
- 11/30/2009 12:27:52 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/bp-activity.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity.php
r2128 r2158 83 83 bp_core_add_root_component( BP_ACTIVITY_SLUG ); 84 84 } 85 add_action( 'plugins_loaded', 'bp_activity_setup_root_component' );85 add_action( 'plugins_loaded', 'bp_activity_setup_root_component', 2 ); 86 86 87 87 function bp_activity_setup_nav() { … … 136 136 } 137 137 138 function bp_activity_screen_single_activity_permalink() { 139 global $bp; 140 141 if ( !$bp->displayed_user->id || $bp->current_component != $bp->activity->slug ) 142 return false; 143 144 if ( empty( $bp->current_action ) || !is_numeric( $bp->current_action ) ) 145 return false; 146 147 /* Get the activity details */ 148 $activity = bp_activity_get_specific( array( 'activity_ids' => $bp->current_action ) ); 149 150 if ( !$activity = $activity['activities'][0] ) 151 bp_core_redirect( $bp->root_domain ); 152 153 $has_access = true; 154 /* Redirect based on the type of activity */ 155 if ( $activity->component_name == $bp->groups->id ) { 156 if ( !function_exists( 'groups_get_group' ) ) 157 bp_core_redirect( $bp->root_domain ); 158 159 if ( $group = groups_get_group( array( 'group_id' => $activity->item_id ) ) ) { 160 /* Check to see if the group is not public, if so, check the user has access to see this activity */ 161 if ( 'public' != $group->status ) { 162 if ( !groups_is_user_member( $bp->loggedin_user->id, $group->id ) ) 163 $has_access = false; 164 } 165 } 166 } 167 168 $has_access = apply_filters( 'bp_activity_permalink_access', $has_access, &$activity ); 169 170 if ( !$has_access ) { 171 bp_core_add_message( __( 'You do not have access to this activity.', 'buddypress' ), 'error' ); 172 bp_core_redirect( $bp->loggedin_user->domain ); 173 } 174 175 bp_core_load_template( apply_filters( 'bp_activity_template_profile_activity_permalink', 'activity/single' ) ); 176 } 177 /* This screen is not attached to a nav item, so we need to add an action for it. */ 178 add_action( 'wp', 'bp_activity_screen_single_activity_permalink', 3 ); 138 179 139 180 /******************************************************************************** … … 145 186 */ 146 187 188 function bp_activity_action_permalink_router() { 189 global $bp; 190 191 if ( $bp->current_component != $bp->activity->slug || $bp->current_action != 'p' ) 192 return false; 193 194 if ( empty( $bp->action_variables[0] ) || !is_numeric( $bp->action_variables[0] ) ) 195 return false; 196 197 /* Get the activity details */ 198 $activity = bp_activity_get_specific( array( 'activity_ids' => $bp->action_variables[0] ) ); 199 200 if ( !$activity = $activity['activities'][0] ) 201 bp_core_redirect( $bp->root_domain ); 202 203 $redirect = false; 204 /* Redirect based on the type of activity */ 205 if ( $activity->component_name == $bp->groups->id ) { 206 if ( $activity->user_id ) 207 $redirect = bp_core_get_userurl( $activity->user_id ) . $bp->activity->slug . '/' . $activity->id; 208 else { 209 if ( $group = groups_get_group( array( 'group_id' => $activity->item_id ) ) ) 210 $redirect = bp_get_group_permalink( $group ) . $bp->activity->slug . '/' . $activity->id; 211 } 212 } else 213 $redirect = bp_core_get_userurl( $activity->user_id ) . $bp->activity->slug . '/' . $activity->id; 214 215 if ( !$redirect ) 216 bp_core_redirect( $bp->root_domain ); 217 218 /* Redirect to the actual activity permalink page */ 219 bp_core_redirect( apply_filters( 'bp_activity_action_permalink_url', $redirect . '/', &$activity ) ); 220 } 221 add_action( 'wp', 'bp_activity_action_permalink_router', 3 ); 222 147 223 function bp_activity_action_delete_activity() { 148 224 global $bp; … … 178 254 } 179 255 add_action( 'wp', 'bp_activity_action_delete_activity', 3 ); 180 181 256 182 257 function bp_activity_action_sitewide_feed() {
Note:
See TracChangeset
for help on using the changeset viewer.