Support » Plugin: WP User Frontend » [Plugin: WP User Frontend] This page is restricted?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Have you found any answer to this? I’m looking to an answer to this question.


    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.

    I tried that, still didnt work.

    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() ) {
    } 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!

    great! thank you for the fix!!

    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?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: WP User Frontend] This page is restricted?’ is closed to new replies.