Support » Plugin: Custom Upload Dir » user_ID

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi kryvulena. You can achieve that editing the plugin file custom_upload_dir.php as follows:

    ORIGINAL CODE

    
    function cud_generate_path(){	
       global $post, $post_id, $current_user, $cud_file_ext, $cud_file_type, $cud_rpc_id;
    

    MODIFIED CODE

    
    function cud_generate_path(){	
       global $post, $post_id, $current_user, $user_id, $cud_file_ext, $cud_file_type, $cud_rpc_id;  // variable $user_id added to the code
    

    ORIGINAL CODE

    
    $customdir = str_replace('%current_user%', 	cud_get_user_name($user_id),$customdir);
    

    MODIFIED CODE

    
    $customdir = str_replace('%current_user%', 	cud_get_user_name($user_id),$customdir);
    $customdir = str_replace('%current_user_id%', 	$user_id, $customdir);  // this line added to the code
    

    ORIGINAL CODE

    
    'current_user'		=> __('The currently logged in user', 'cud'),
    

    MODIFIED CODE

    
    'current_user'		=> __('The currently logged in user', 'cud'),
    'current_user_id'		=> __('The currently logged in user ID', 'cud'),  // this line added to the code
    

    Fantastic! Thank you so much. Much appreciated 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘user_ID’ is closed to new replies.