Frontend Uploader
[resolved] Admin-side : Force File Author ? (3 posts)

  1. dapickboy
    Posted 3 years ago #

    Hi !
    When I upload a file as a visitor (i.e. not logged in), the file get no author. It's fine for me, but when I approve it through the manager, it sets my user as the author of the file.
    Could it be possible to force it to be "visitor" (for example, but maybe it's impossible for WP to set it at a non-existent user...) at upload ?
    Or maybe add some info via filters to let us know that, in our big media library, this file was uploaded via frontend uploader ?

    Anyway, the plugin works like a charm !


  2. Rinat Khaziev
    Plugin Author

    Posted 3 years ago #


    Yes, it's totally possible with filter 'fu_after_upload'. You might want to create a dummy user, say "Visitor", set its role to Subscriber. Say, it has ID 3. After that put something like the code snippet below into your theme's functions.php.

    add_action( 'fu_after_upload', 'my_fu_after_upload' );
    function my_fu_after_upload( $attachment_ids ) {
        // do something with freshly uploaded files
        foreach ( $attachment_ids as $att_id ) {
           // Set a different author
            wp_update_post( array( 'ID' => $att_id, 'post_author' => 3 ) );
        // This happens on POST request, so $_POST will also be available for you

    I'm glad that you're enjoying the plugin, mind giving some stars? :)

  3. dapickboy
    Posted 3 years ago #

    Hi !

    For sure I'll give it five stars ! Though there might be some improvement or functions to come, it does a very good job and is really versatile through the hooks and filters. That's great !

    And thanks a lot for your snippet, it's just what I wanted. And I even didn't thought of creating a dummy user...

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Frontend Uploader
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.