• Nenelco

    (@nenelco)


    Hello, excellent plugin, I want to add a counter of uploaded files, how can I achieve it?

    I speak Spanish, sorry if it is mistranslated

    Thank you very much for your help.

    ———–
    Espa?ol:

    Hola, excelente plugin, deseo agregar un contador de archivos subidos, como lo puedo lograr?

    Yo hablo espa?ol disculpe si esta mal traducido.

    Muchas gracias por su ayuda.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author lynton_reed

    (@lynton_reed)

    files land under the users upload folder in a subfolder as specified by the shortcode attributes for the dir and subdir, so you could add some php to your page to count the files in this directory.

    to do this try something like this

    
    global $current_user;
    get_currentuserinfo();
    
    $upload_dir = wp_upload_dir();
    $user_dirname = $upload_dir['basedir'].'/'.$current_user->ID;
    $dir = $user_name . '/' .  "upload-dirname" . '/' . "upload-subdirname" . '/';
    $filecount = count(glob($dir . "*"));

    this is untested, but should be close to what you need.

    lynton

    Plugin Author lynton_reed

    (@lynton_reed)

    oh , and i just remembered , the pro plugin adds another shortcode wtf-list-files that has advanced formating options and can include the total file count in the display of the users files.

    see the documentation pages for the [wtf_fu_list_files] shortcode to see the full details. by default the summary heading includes the numbers of files and total file size for each user or users.

    Thread Starter Nenelco

    (@nenelco)

    Friend thanks for your answer, sorry but can you indicate in which file I can save this code for numbering??

    Another question, it is possible that before the file name is shown the number, something like this:

    1. File name.
    2. File name.
    3. File name.

    Friend thanks for your help.

    Plugin Author lynton_reed

    (@lynton_reed)

    the php code can be placed in any file you like. you could easily extend this to loop through and print each filename with a number.

    you may prefer the pro plugin though which can be configured to do this and other formatting such as filetype icons without any coding see the documentation for wtf_fu_list_files shortcode to see if it meets your requirements.

    Thread Starter Nenelco

    (@nenelco)

    Friend, I paste the code in the funtions.php and it did not work, I also pasted it in the file: “wtf-fu-templates.php” and it did not work either.

    In the “wtf-fu-templates.php” file I added:
    <p class=”number-photos”>Photo Number: {%=i+1%}</p> on line 89, but it only works for me if I refresh Page, can you help me with the numbering for uploaded files ??

    thank you very much

    • This reply was modified 7 years, 11 months ago by Nenelco.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Uploaded file counter’ is closed to new replies.