Check if current page is single media, media gallery and single media edit


#1

I can check if the current page that is being viewed is a media component page using this code bp_is_current_component( 'media' )

Does anybody know if there is a way to check if the current page is:

  1. Single media page

  2. Single media edit page

  3. Media gallery page

Thanks in advance Henry


#2

You could check these conditional tags available in rtMedia -> http://rtcamp.com/rtmedia/docs/developer/conditional-tags/

There is no conditional tag to check if it is an edit page. But you could use the available conditional tags in the following manner.

global $rtmedia_query;  
if ( is_rtmedia_single() && isset( $rtmedia_query->media_query ) &&  
            $rtmedia_query->action_query->action == 'edit' ) {  
    //single media edit page  
}

#3

@joshuaabenazer I must have missed these when looking through the documentation. They're just what I needed - thanks..!


#4

@joshuaabenazer Just tried it and I get a slight problem when using is_rtmedia_gallery() in header.php. The following error message appears on screen whenI try to view the members directory (e.g. example.com/members):

Fatal error: Call to a member function is_gallery() on a non-object in wp-content/plugins/buddypress-media/app/main/controllers/template/rt-template-functions.php on line 555


#5

Thanks for pointing that out. We will resolve this issue in the next update. For now you could try checking the following too.

global $rtmedia_query;  
    if ( $rtmedia_query ) {  
}

#6

#7

#8