another problem when it's a single item
-
Hi; I got another problem while trying to handle a single item.
First, this is the code which ‘handles’ my navigation (checks if we are in our profile, in another profile, in the directory or viewing a single item)
if ($bp->current_component == $bp->classifieds->slug) { //we are in classifieds
if (bp_is_home()) { //we are in our profile
...
}elseif (($bp->displayed_user->id) && (!bp_is_home())) {//we are in someone else profile
...
}else if ( $bp->is_single_item ) {
// We are viewing a single classified, so set up the
// classified navigation menu using the $classified_obj global.
/* When in a single classified, the first action is bumped down one because of the
classified name, so we need to adjust this and set the classified name to current_item. */
$bp->current_item = $bp->current_action;
$bp->current_action = $bp->action_variables[0];
array_shift($bp->action_variables);
$classified_link = $bp->root_domain . '/' . $bp->classifieds->slug . '/' . $classified_obj->slug . '/';
// Reset the existing subnav items
bp_core_reset_subnav_items($bp->classifieds->slug);
bp_core_add_nav_default( $bp->classifieds->slug, 'classifieds_screen_classified_home', 'home' );
bp_core_add_subnav_item( $bp->classifieds->slug, 'home', __('Home', 'buddypress'), $classified_link, 'classifieds_screen_classified_home', 'classified-home' );
// If the user is a classified mod or more, then show the classified admin nav item */
}else { //we are in directory
$bp->is_directory = true;
...
}
}
}So if we are viewing a single item; this is the function called :
function classifieds_screen_classified_home() {
global $bp;
echo "function classifieds_screen_classified_home";exit;
if ( isset($_GET['new']) ) {
// Delete classified request notifications for the user
}
do_action( 'classifieds_screen_classified_home' );
bp_core_load_template( apply_filters( 'classifieds_template_classified_home', 'classifieds2/classified-home' ) );
}Here’s my problem :
If I go to /classifieds/classified1234
It goes to the function classifieds_screen_classified_home() and runs the code echo “function classifieds_screen_classified_home”; exit; ).
But If I go to /classifieds/classified1234/watch
It does not !
What is strange is that in my code above; if I put
echo “single item”;exit;
at the top or at the bottom inside my statement
}else if ( $bp->is_single_item ) {
and that I try
/classifieds/classified1234 or /classifieds/classified1234/watch, it does echoes “single item” then exit.
So I don’t understand why after it doesn’t run the function classifieds_screen_classified_home.
Any idea ?
Thanks a LOT.
- The topic ‘another problem when it's a single item’ is closed to new replies.