WordPress.org

Ready to get started?Download WordPress

Forums

Frontend Uploader
[resolved] Upload only for logged in users? (4 posts)

  1. Marketing Master
    Member
    Posted 1 year ago #

    Is there any possibility to restrict upload only for registered and logged in users?

    Thx, BR

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

  2. Daniel Bachhuber
    Hand Built
    Plugin Contributor

    Posted 1 year ago #

    Yep, I've put together a little code snippet you can follow:

    add_action( 'init', 'wpfx_hide_logged_out' );
    function wpfx_hide_logged_out() {
    
    	if ( ! is_user_logged_in() ) {
    		add_shortcode( 'fu-upload-form', 'wpfx_logged_out_message' );
    	}
    }
    function wpfx_logged_out_message() {
    	return '<div id="ugc-media-logged-out">You must be logged in to submit a post.</div>';
    }

    Hope this helps.

  3. Rinat Khaziev
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks Daniel!

  4. Angels22
    Member
    Posted 1 year ago #

    Where would one add this?

    Update, couple minutes later: Oh, I got it, you add it to the functions.php
    Just in case anyone else was wondering...
    Works great, thank you!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.