WordPress.org

Support

Support » Plugins and Hacks » Frontend Uploader » [Resolved] Upload only for logged in users?

[Resolved] Upload only for logged in users?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Daniel Bachhuber

    @danielbachhuber

    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.

    Plugin Author Rinat Khaziev

    @rinatkhaziev

    Thanks Daniel!

    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!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Upload only for logged in users?’ is closed to new replies.
Skip to toolbar