Support » Plugin: User Submitted Posts » Required Login option return errors 2 out of 3 methods

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jeff Starr


    Just to be clear for anyone else reading the thread, the USP plugin works fine; you’re asking about the 3rd party scripts that people are using to require users to be logged in.

    That said, it sounds like something else is interfering. I say that mostly because the methods for requiring users to log in are about as basic as they get. Here is the essence of what the code is doing:

    <?php if ( is_user_logged_in() ) {
        echo 'Welcome, registered user!';
    } else {
        echo 'Welcome, visitor!';
    } ?>

    So something like that should definitely work — it’s basically one template tag, so if there are any errors, something else is up. Maybe a plugin, theme, server config, etc.

    Yes, copy that … always many ways to accomplish the same thing. If further use and testing/troubleshooting reveals what might be interfering with methods 1 or 2 I’ve got a note to update this post, but best not to hold one’s breath!

    As for 3a) … hyperlink within the pre-wrapper possible?

    Thanks Jeff!

    Plugin Author Jeff Starr


    Yes absolutely there is — just use single quotes for the href value, like so:

    [usp_member deny="Please <a href='/login.php'>log in</a> to submit posts."]

    Or if that doesn’t work you can just change the shortcode:

    function usp_member($attr, $content = null) {
    		'deny' => '',
    	), $attr));
    	if (is_user_logged_in() && !is_null($content) && !is_feed()) return $content;
    	return "Please <a href='/login.php'>log in</a> to submit posts.";
    add_shortcode('usp_member', 'usp_member');

    Nope, and yep.

    Option A returns the raw syntax, too:

    Please log in to submit posts.

    Option B worked once deny=”Please log in to submit posts.” was removed from the pre-wrapper.

    Super, thanks again Jeff. Next customer …

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Required Login option return errors 2 out of 3 methods’ is closed to new replies.