Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: another problem when it's a single item


Burt Adsit
Participant

@burtadsit

I think you are relying on $bp->is_single_item for your url parsing. I’m not sure that var gets set to what you expect it to be set to. In the url signature you mention above:

/classifieds/classified1234

The $bp->current_component is ‘classifieds’ the $bp->current_action would be ‘classified1234’ and $bp->action_var’s would be an empty array. Adding the ‘watch’ to the end of the url such as:

/classifieds/classified1234/watch

would make the $bp->action_var[0] be ‘watch’.

It might be better to know the url signature you are expecting and trap for that pattern. Like:

if ($bp->current_component == $bp->classifieds->slug && $bp->current_action){

.. figure out if the user is in their profile or someone else’s profile ..

}

if ($bp->current_component == $bp->classifieds->slug && $bp->current_action

&& ‘watch’ == $bp->action_vars[0]){

.. ‘watch’ the classified specified in $bp->current_action ..

}

Skip to toolbar