WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: Frontend Uploader] Admin-side : Force File Author ?

[Resolved] [Plugin: Frontend Uploader] Admin-side : Force File Author ?

  • dapickboy
    Member

    @dapickboy

    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 !

    http://wordpress.org/extend/plugins/frontend-uploader/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Rinat Khaziev
    Participant

    @rinatkhaziev

    Howdy,

    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? 🙂

    dapickboy
    Member

    @dapickboy

    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…

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] [Plugin: Frontend Uploader] Admin-side : Force File Author ?’ is closed to new replies.