Skip to:
Content
Pages
Categories
Search
Top
Bottom

can't get $bp->…->current_… in a function hooked on bp_setup_nav


  • grosbouff
    Participant

    @grosbouff

    Hi guys…
    I’ve created a Classifieds Component.
    The function classifieds_setup_nav() defines $bp->classifieds->current_classified.
    classifieds_setup_nav() is hooked on plugins_loaded.

    function classifieds_setup_nav() {
    global $bp;

    $bp->classifieds->current_classified =…

    }
    add_action( ‘plugins_loaded’, ‘classifieds_setup_nav’ );

    Now, I made an extension for this component.
    I would like to register a “single item” tab.
    So I did :

    function classifieds_maps_setup_nav() {
    global $bp;
    ….
    $classified = $bp->classifieds->current_classified;

    }
    add_action( ‘bp_setup_nav’,’classifieds_maps_setup_nav’);

    Problem : $classified is empty in classifieds_maps_setup_nav().
    I think this is the good order and the goods hooks to use, but it just do not work. I did try setting a lower priority for the hook but it do not work either.
    Now I did try with
    add_action( ‘plugins_loaded’,’classifieds_maps_setup_nav’,11);
    and there I can get $classified.
    But I think this is the wrong hook to use, so I would like to know what is wrong in there and if there is something I forgot to do.

    Thanks !

    G.

  • The topic ‘can't get $bp->…->current_… in a function hooked on bp_setup_nav’ is closed to new replies.
Skip to toolbar