get_globals() static public method

Get the list of all global albums
static public get_globals ( ) : bool/mixed/void
return bool/mixed/void
function rtmedia_global_albums()
{
    return RTMediaAlbum::get_globals();
    //get_site_option('rtmedia-global-albums');
}
Beispiel #2
0
function parentlink_global_album($id)
{
    $global_albums = RTMediaAlbum::get_globals();
    $parent_link = '';
    if (is_array($global_albums) && '' !== $global_albums) {
        if (in_array($id, $global_albums) && function_exists('bp_displayed_user_id')) {
            $disp_user = bp_displayed_user_id();
            $curr_user = get_current_user_id();
            if ($disp_user == $curr_user) {
                $parent_link = get_rtmedia_user_link($curr_user);
            } else {
                $parent_link = get_rtmedia_user_link($disp_user);
            }
            global $rtmedia_query;
            if (isset($rtmedia_query->is_gallery_shortcode) && true === $rtmedia_query->is_gallery_shortcode) {
                $parent_link = get_rtmedia_user_link(get_current_user_id());
            }
        }
    }
    return $parent_link;
}
Beispiel #3
0
/**
 * Get global albums
 *
 * @return      array
 */
function rtmedia_global_albums()
{
    return RTMediaAlbum::get_globals();
}
 function get_other_album_count($profile_id, $context = "profile")
 {
     $global = RTMediaAlbum::get_globals();
     $sql = "select distinct album_id from {$this->table_name} where 2=2 AND context = '{$context}' ";
     if (is_multisite()) {
         $sql .= " AND {$this->table_name}.blog_id = '" . get_current_blog_id() . "' ";
     }
     if (is_array($global) && count($global) > 0) {
         $sql .= " and album_id in (";
         $sep = "";
         foreach ($global as $id) {
             $sql .= $sep . $id;
             $sep = ",";
         }
         $sql .= ")";
     }
     if ($context == "profile") {
         $sql .= " AND media_author={$profile_id} ";
     } else {
         if ($context == "group") {
             $sql .= " AND context_id={$profile_id} ";
         }
     }
     global $wpdb;
     $result = $wpdb->get_results($sql);
     if (isset($result)) {
         return count($result);
     } else {
         return 0;
     }
 }
Beispiel #5
0
 /**
  *
  * @param  integer $profile_id
  * @param  string $context
  *
  * @return int
  */
 function get_other_album_count($profile_id, $context = 'profile')
 {
     global $wpdb;
     $global = RTMediaAlbum::get_globals();
     $sql = $wpdb->prepare("select distinct album_id from {$this->table_name} where 2=2 AND context = %s ", $context);
     if (is_multisite()) {
         $sql .= $wpdb->prepare(" AND {$this->table_name}.blog_id = %d ", get_current_blog_id());
     }
     if (is_array($global) && count($global) > 0) {
         $sql .= ' and album_id in (';
         $sep = '';
         foreach ($global as $id) {
             $sql .= $sep . esc_sql($id);
             $sep = ',';
         }
         $sql .= ')';
     }
     if ('profile' === $context) {
         $sql .= $wpdb->prepare(' AND media_author=%d ', $profile_id);
     } else {
         if ('group' === $context) {
             $sql .= $wpdb->prepare(' AND context_id=%d ', $profile_id);
         }
     }
     $sql .= 'limit 100';
     $result = $wpdb->get_results($sql);
     if (isset($result)) {
         return count($result);
     } else {
         return 0;
     }
 }