WordPress.org

Ready to get started?Download WordPress

Forums

Require user login to view other content (3 posts)

  1. joshjohnson
    Member
    Posted 8 years ago #

    Ok, I have searched the forum and the web near and far and have yet to come across this question, so I will ask.

    I want to create a static page for my webcam that requires a user to be logged in to view the content. Otherwise they will be redirected to the login. This will be much similiar to wp-comments-post.php... I am just not that great at php to work the code.

    Ohh, and I tried all of the tricks on here and followed all of the tips to create a static page, but I cannot get my theme to carry over to the new page (it seems that these tricks work in 1.5 and not 2.0?).

  2. Orin
    Member
    Posted 8 years ago #

    Hmm... well, although I haven't used this plugin in my 2.0 blogs yet I do know Scott O'Reilly's Hide/Cut Post Text plugin has some of the functionality your speaking of. That is, keep portions hidden from visitors below a certain level. I know it's not what you're looking for in terms of 1) hiding the whole page or 2) redirecting to the login, but you may want to take a look at the code anyways.

  3. joshjohnson
    Member
    Posted 8 years ago #

    The "Hide portion(s) of post text" would work but this is a static page, so I dont "think" that it would work. I wouldn't mind editing the php. I guess what I am looking for is actually written in the wp-comments-post.php as:

    // If the user is logged in
    get_currentuserinfo();
    if ( $user_ID ) :
    $comment_author = $wpdb->escape($user_identity);
    $comment_author_email = $wpdb->escape($user_email);
    $comment_author_url = $wpdb->escape($user_url);
    else :
    if ( get_option('comment_registration') )
    die( __('Sorry, you must be logged in to post a comment.') );
    endif;

    I just need to figure out how to edit this and include it in my webcam.php static page.

Topic Closed

This topic has been closed to new replies.

About this Topic