Skip to:
Content
Pages
Categories
Search
Top
Bottom

loading templates problem


  • grosbouff
    Participant

    @grosbouff

    Hello, I got a little error here.

    I’m trying to load the template for a single item.

    My start point was the bp-groups plugin.

    Here’s the function called if it is a single item :

    function classifieds_screen_classified_home() {
    global $bp;

    if ( $bp->is_single_item ) {

    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' ) );

    }
    }

    It does go in that function since it exits if I put “exit;” at the beginning of the function.

    But the template does not load; I got a Sorry, that page was not found alert.

    • I’ve checked the name of the files, it’s ok : I have a bp-themes/bpmember/classifieds2/classified-home.php file.
    • If I put a “exit” at the top of classified-home.php, it does not exit -> so it is sure the template does not loads.
    • If I comment the bp_core_load_template line, it goes to my profile (.

      …/members/admin)

    Does anyone have an idea of what the problem could be ?

    Thanks !

Viewing 4 replies - 1 through 4 (of 4 total)

  • grosbouff
    Participant

    @grosbouff

    I updated my code to fit more like the bp-groups plugin.

    I put two echoes somewhere in the code :

    echo “classifieds_screen_directory”; (line 103)

    echo “classifieds_screen_single”; (line 118)

    which do show when I go to

    wmpu/classifieds

    wmpu/classifieds/test1234.

    But their templates still not loading… The paths are okay.

    Could you have a look ? Thanks, it here : http://pastie.org/546228

    Try taking that $is_single_items check out for debugging.


    grosbouff
    Participant

    @grosbouff

    What do u mean by this ?

    print_r($bp->is_single_item);

    returns me true.

    I read and read again my code, I don’t see what’s wrong with it…

    It is almost exactly the same than in bp-groups.

    My “member” part is ok for loading templates; it is just for single classified and directory that it does not load.

    Updated pastie : http://pastie.org/546674


    grosbouff
    Participant

    @grosbouff

    I finally found out.

    Maybe this should be added to the doc ?

    I forget to add those functions :

    function component_force_buddypress_theme( $template ) {
    global $bp;

    if ( $bp->current_component == $bp->component->slug && empty( $bp->current_action ) ) {
    $member_theme = get_site_option( 'active-member-theme' );

    if ( empty( $member_theme ) )
    $member_theme = 'bpmember';

    add_filter( 'theme_root', 'bp_core_filter_buddypress_theme_root' );
    add_filter( 'theme_root_uri', 'bp_core_filter_buddypress_theme_root_uri' );

    return $member_theme;
    } else {
    return $template;
    }
    }
    add_filter( 'template', 'component_force_buddypress_theme', 1, 1 );

    function component_force_buddypress_stylesheet( $stylesheet ) {
    global $bp;

    if ( $bp->current_component == $bp->component->slug && empty( $bp->current_action ) ) {
    $member_theme = get_site_option( 'active-member-theme' );

    if ( empty( $member_theme ) )
    $member_theme = 'bpmember';

    add_filter( 'theme_root', 'bp_core_filter_buddypress_theme_root' );
    add_filter( 'theme_root_uri', 'bp_core_filter_buddypress_theme_root_uri' );

    return $member_theme;
    } else {
    return $stylesheet;
    }
    }
    add_filter( 'stylesheet', 'component_force_buddypress_stylesheet', 1, 1 );

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘loading templates problem’ is closed to new replies.
Skip to toolbar