rtmedia_user_album_list

Get user's album list.

Description

(bool|string) rtmedia_user_album_list( (constant) $get_all = false, (bool) $selected_album_id = false ); 

Returns (bool|string)

Parameters (2)

0. $get_all — Optional. (constant) => false
The get all.
1. $selected_album_id — Optional. (bool) => false
The selected album id.

Usage

  1. if ( !function_exists( 'rtmedia_user_album_list' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'rtmedia-for-wordpress-buddypress-and-bbpress/app/main/controllers/template/rtmedia-functions.php'; 
  3.  
  4. // The get all. 
  5. $get_all = false; 
  6.  
  7. // The selected album id. 
  8. $selected_album_id = false; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = rtmedia_user_album_list($get_all, $selected_album_id); 
  12.  

Defined (1)

The function is defined in the following location(s).

/app/main/controllers/template/rtmedia-functions.php  
  1. function rtmedia_user_album_list( $get_all = false, $selected_album_id = false ) { 
  2.  
  3. global $rtmedia_query; 
  4.  
  5. $model = new RTMediaModel(); 
  6. $global_option = rtmedia_global_album_list( $selected_album_id ); 
  7. $global_albums = rtmedia_global_albums(); 
  8.  
  9. $user_id = apply_filters( 'rtmedia_album_by_user', get_current_user_id() ); 
  10. $album_objects = $model->get_media( array( 
  11. 'media_author' => $user_id,  
  12. 'media_type' => 'album',  
  13. ), false, 'context' ); 
  14. $option_group = ''; 
  15. $profile_option = ''; 
  16.  
  17. if ( $album_objects ) { 
  18. foreach ( $album_objects as $album ) { 
  19. if ( ! in_array( $album->id, array_map( 'intval', $global_albums ), true ) && ( ( isset( $rtmedia_query->media_query['album_id'] ) && ( $album->id !== $rtmedia_query->media_query['album_id'] || $get_all ) ) || ! isset( $rtmedia_query->media_query['album_id'] ) ) ) { 
  20. if ( 'profile' === $album->context ) { 
  21. $profile_option .= '<option value="' . esc_attr( $album->id ) . '" ' . selected( $selected_album_id, $album->id, false ) . '>' . esc_html( $album->media_title ) . '</option>'; 
  22.  
  23. $option = apply_filters( 'rtmedia_global_albums_in_uploader', "$global_option" ); 
  24.  
  25. if ( '' != $profile_option ) { 
  26. $option .= "<optgroup label='" . esc_attr__( 'Profile Albums', 'buddypress-media' ) . " ' value = 'profile'>$profile_option</optgroup>"; 
  27.  
  28. if ( '' != $option_group && class_exists( 'BuddyPress' ) ) { 
  29. $option .= "<optgroup label='" . esc_attr__( 'Group Albums', 'buddypress-media' ) . "' value = 'group'>$option_group</optgroup>"; 
  30.  
  31. if ( $option ) { 
  32. return $option; 
  33. } else { 
  34. return false; 
  35.