WordPress.org

Ready to get started?Download WordPress

Forums

WP User Frontend
This page is restricted? (7 posts)

  1. robbycornish
    Member
    Posted 1 year ago #

    In the place where I enter: [wpuf_addpost]

    I get the following on my page:
    This page is restricted. Please Log in to view this page.

    I thought users didn't have to login to post to the site?

    Any thoughts?

    http://wordpress.org/extend/plugins/wp-user-frontend/

  2. ersaldivar
    Member
    Posted 1 year ago #

    Have you found any answer to this? I'm looking to an answer to this question.

    Thanks!

  3. ersaldivar
    Member
    Posted 1 year ago #

    You have to add them as a user in WP. Whether it is "Contributor" "Subscriber", etc....

    After, they loggin to the WP back end, will they be able to use the WP Front End.

  4. robbycornish
    Member
    Posted 1 year ago #

    I tried that, still didnt work.

  5. BooneSesvold
    Member
    Posted 1 year ago #

    To avoid the "This page is restricted. Please Log in to view this page." message and allow non-logged in users to access the WP User Frontend form, you have to modify 1 file in the plugin and then add a code block to your theme's functions.php file.

    [Note: this fix is wiped the next time you upgrade to the latest/greatest version of this plugin. Hopefully the plugin author (Tareq Hasan) will build this functionality into his next release.]

    1) Plugin Edits:
    In the 'wp-user-frontend' plugin folder, find 'wpuf-add-post.php.'

    Change this:
    if ( is_user_logged_in() ) {
    $this->show_form();
    } else {
    printf( __( "This page is restricted. Please %s to view this page.");
    }
    To this:
    if ( is_user_logged_in() ) {
    $this->post_form( $post_type );
    } else {
    $this->post_form( $post_type );
    }

    This displays the form to non-logged-in users. However, after successful submission the plugin takes the user to the post they just created. Because the new post is probably in pending status for approval and the non-logged in user does not have access to the new page, they are redirected to a 404 page.

    2) Theme Edits:
    To avoid the 404 redirect mentioned above, we have to add some code to your theme so that users are redirected to a different page. Scroll to the bottom of your theme's functions.php file.

    Add the following:

    /*-------- WP User Frontend - Post Redirect --------*/
    function custom_redirect( $url ) {
    global $post;

    return get_permalink( $post->ID=ENTER_PAGE_ID_HERE );
    }
    add_filter( 'wpuf_after_post_redirect', 'custom_redirect' );

    Above, where it says 'ENTER_PAGE_ID_HERE,' enter the ID of the page/post you want to take the user to.

    In my case, I created a simple Thank you page for the user, after submission. Hope that helps!

  6. robbycornish
    Member
    Posted 1 year ago #

    great! thank you for the fix!!

  7. robbycornish
    Member
    Posted 1 year ago #

    Actually, I just tried doing the update.

    The 2nd half works great! (redirecting page)

    But the 1st part does not. The form DOES appear to non-login users, but I have an image upload button, non users are NOT able to do this. Seems like the upload disappears. Any thoughts on that?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic