* status =public|private|friendsonly|groupsonly|any registered status * * * Please create your template if you need specific templates for photo, video etc * * * * Fallback single Gallery View */ $gallery = mpp_get_current_gallery(); $type = $gallery->type; if (mpp_have_media()) { ?> <?php if (mpp_user_can_list_media(mpp_get_current_gallery_id())) { ?> <?php do_action('mpp_before_single_gallery'); ?> <?php if (mpp_show_gallery_description()) { ?> <div class="mpp-gallery-description mpp-single-gallery-description mpp-<?php echo $type; ?> -gallery-description mpp-clearfix"> <?php
/** * Can the User see this media? * * @param type $media_id * @param type $user_id * @return type */ function mpp_user_can_view_media($media_id, $user_id = null) { if (!$user_id) { $user_id = get_current_user_id(); } $media = mpp_get_media($media_id); $gallery = mpp_get_gallery($media->gallery_id); //a media is only viewable if the parent gallery is viewable $allowed = false; if (mpp_user_can_list_media($gallery->id, $user_id)) { //nw let us check for media permissions $user_permissions = mpp_get_accessible_statuses($gallery->component, $gallery->component_id, $user_id); if (in_array($media->status, $user_permissions)) { $allowed = true; } } return apply_filters('mpp_user_can_view_media', $allowed, $media, $gallery, $user_id); }