bp_gifts_upload_dir

The Buddypress Gifts Latest 2014 bp gifts upload dir function.

Description

bp_gifts_upload_dir(); 

Usage

  1. if ( !function_exists( 'bp_gifts_upload_dir' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress-gifts-latest-2014/includes/bp-gifts-admin.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_gifts_upload_dir(); 
  7.  

Defined (2)

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

/includes/bp-gifts-admin.php  
  1. function bp_gifts_upload_dir() { 
  2.  
  3. global $bp; 
  4.  
  5.  
  6.  
  7. $user_id = $bp->loggedin_user->id; 
  8.  
  9.  
  10.  
  11. $dir = WP_PLUGIN_DIR.'buddypress-gifts-rebirth/includes/images'; 
  12.  
  13.  
  14.  
  15. $siteurl = trailingslashit( get_blog_option( 1, 'siteurl' ) ); 
  16.  
  17. $url = str_replace(ABSPATH, $siteurl, $dir); 
  18.  
  19.  
  20.  
  21. $bdir = $dir; 
  22.  
  23. $burl = $url; 
  24.  
  25.  
  26.  
  27. $subdir = '/' . $user_id; 
  28.  
  29.  
  30.  
  31. $dir .= $subdir; 
  32.  
  33. $url .= $subdir; 
  34.  
  35.  
  36.  
  37. if ( !file_exists( $dir ) ) 
  38.  
  39. @wp_mkdir_p( $dir ); 
  40.  
  41.  
  42.  
  43. return apply_filters( 'bp_gifts_upload_dir', array( 'path' => $dir, 'url' => $url, 'basedir' => $bdir, 'baseurl' => $burl, error => false ) ); 
  44.  
  45.  
  46.  
/includes/bp-gifts-admin-network.php  
  1. function bp_gifts_upload_dir() { 
  2.  
  3. global $bp; 
  4.  
  5.  
  6.  
  7. $user_id = $bp->loggedin_user->id; 
  8.  
  9.  
  10.  
  11. $dir = WP_PLUGIN_DIR.'buddypress-gifts-rebirth/includes/images'; 
  12.  
  13.  
  14.  
  15. $siteurl = trailingslashit( get_blog_option( 1, 'siteurl' ) ); 
  16.  
  17. $url = str_replace(ABSPATH, $siteurl, $dir); 
  18.  
  19.  
  20.  
  21. $bdir = $dir; 
  22.  
  23. $burl = $url; 
  24.  
  25.  
  26.  
  27. $subdir = '/' . $user_id; 
  28.  
  29.  
  30.  
  31. $dir .= $subdir; 
  32.  
  33. $url .= $subdir; 
  34.  
  35.  
  36.  
  37. if ( !file_exists( $dir ) ) 
  38.  
  39. @wp_mkdir_p( $dir ); 
  40.  
  41.  
  42.  
  43. return apply_filters( 'bp_gifts_upload_dir', array( 'path' => $dir, 'url' => $url, 'basedir' => $bdir, 'baseurl' => $burl, error => false ) ); 
  44.  
  45.  
  46.