WP gurus... Password Protect?

20 replies
Heya folks!

I've been rummaging through my WP files for the one(s) I need to mod, but I can't seem to come up with anything. I'm not sure if it's part of the theme or part of the core files... Hmmm....

What I'd like to do is take the regular message that says "This post is password protected", and add a little pizazz to it.

But I can't find the file (or files) to mod.

I thought it would be the bit at the very bottom of "/includes/post-template.php"

But I modded that, FTP-ed it, refreshed... nada!


Can anyone point me in the right direction?

Thanks very much!

TheNightOwl
#gurus #password #protect
  • Profile picture of the author Geejayz
    When you talk of password protection do you mean, the post/page itself is protected and you have to be logged in to view or do you mean the comments part is password protected?

    If the latter then check the comments.php file for "This post is password protected. Enter the password to view comments" or similar - it may appear several times in the same file.
    {{ DiscussionBoard.errors[648937].message }}
  • Profile picture of the author TheNightOwl
    Heya Geejayz

    Thanks for responding.

    I mean when you password protect a post.

    When you do this, there's a little message that comes up (as quoted above).

    I can't seem to find where to change this. I can find this EXACT text in the file I mentioned, but altering it and refreshing doesn't appear to do anything! That's why I'm confused.

    How do I change the default wording: "This post is password protected"?

    Cheers
    Signature
    {{ DiscussionBoard.errors[651080].message }}
  • Profile picture of the author kdavies
    Try the following files:
    wp-includes/post-template.php (line 984)
    wp-content/comments.php (line 12)
    {{ DiscussionBoard.errors[657046].message }}
    • Profile picture of the author TheNightOwl
      Hey guys

      Thanks for the replies. As I said, I'd found the 'wp-includes/post-template.php' file (not line 984, though. More like 450 or something... at the very end at any rate) but whatever I was doing to mod it wasn't working. Just tried it again and it went okay; I was able to change the text before the password entry field.

      However, I can't find anything about ' wp-content/comments.php' I looked in two different WP installations (running different versions) and couldn't find it in either.

      I was able to alter the text sitting after the password field by modding the 'comments.php' file in the Theme Editor of one site, but couldn't find anything at all in the other theme template.

      Spent about an hour searching through file after file. Nothing. **groan**

      Any ideas?

      Thanks,
      TheNightOwl


      Signature
      {{ DiscussionBoard.errors[667139].message }}
  • Profile picture of the author Lisa Copen
    Try this file:

    \wp-content\themes\<theme name>\comments.php


    Lisa
    {{ DiscussionBoard.errors[668374].message }}
  • Profile picture of the author TheNightOwl
    Heya Lisa

    Thanks for responding.

    The theme in question doesn't have that file. I can access all the files for the theme in the Theme editor of the Admin interface and... nada.

    I cannot for the life of me work out where it's pulling the text that sits after the password field.

    Any ideas folks?

    Thanks,
    TheNightOwl
    Signature
    {{ DiscussionBoard.errors[669087].message }}
    • Profile picture of the author Lisa Copen
      What theme are you using?

      Lisa
      {{ DiscussionBoard.errors[673579].message }}
  • Profile picture of the author houdy
    If the theme doesn't have a comments.php file then the comment code is probably on the single.php file or whatever file is used to display the posts. It's theme specific and each theme is coded differently.
    {{ DiscussionBoard.errors[669218].message }}
  • Profile picture of the author TheNightOwl
    Heya folks

    Thanks. No cigar there. The theme I'm using only has about 6 files in it and I've looked in all of 'em. Nada.

    WP obviously isn't pulling this line of text out of thin air, but I give up. I just cannot find where it's coming from. This is what it says in the code. Perhaps the "class" name might serve as a hint as to where I can find this; it's got me beat.

    < p class="nocomments">This post is password protected. Enter the password to view comments.</ p>

    (spaces inserted so Vbulletin doesn't render the code)

    Thanks for your suggestions.
    Signature
    {{ DiscussionBoard.errors[671168].message }}
    • Profile picture of the author agriffin
      Hey Night Owl, You will have to show me how you did that really cool opt-in on your website!
      It is too cool!!!!
      {{ DiscussionBoard.errors[671677].message }}
  • Profile picture of the author TheNightOwl
    Heya Lisa

    Up for the challenge, then?

    This one:

    Unthemed Clean Blue - Unthemed

    As I said, it only has a half dozen files and they're all really lean code from what I can tell (I'm not a code-monkey).

    I found the line in the "comments.php" file of the other theme, but I can't find it in this one. It should be the theme that controls this, right? But I can't find it anywhere. I must be looking in the wrong place in the theme.

    Appreciate your taking a moment to check it out.

    TheNightOwl
    Signature
    {{ DiscussionBoard.errors[674385].message }}
    • Profile picture of the author Lisa Copen
      Originally Posted by TheNightOwl View Post

      Heya Lisa

      Up for the challenge, then?

      TheNightOwl
      Always love a challenge.

      Going back over this thread, I think I'm a little confused by what you are trying to do. I was able to change the text "This post is password protected. To view it please enter your password below:" by editing the /wp-includes/post-template.php file and saving it to the server. I saw that you also wanted to change text _after_ the password box. Do you mean something like the image here (can't post URLs yet - remove the space before .com):

      lisacopenrecommends .com/wf1.jpg

      where I have "New text goes here" ?

      If so, you can edit that same file, the same function (function get_the_password_form()), and add text just before the < /form > tag like below:
      Code:
      	<p>New text goes here</p>
      	</form>
      {{ DiscussionBoard.errors[675944].message }}
  • Profile picture of the author TheNightOwl
    @Angela

    Thanks for the big-up. Nothing fancy, though: Photoshop + HTML by hand.

    TheNightOwl
    Signature
    {{ DiscussionBoard.errors[674391].message }}
  • Profile picture of the author MemberWing
    TheNightOwl - get free version of software from my link (at my signature).
    - Install plugin, activate.
    - Insert {+++} marker into any post - and anything below this marker will be visible only to users who are members of the "Gold Members" group or admins.
    Anything above it will be visible to anyone.

    No need in hassles with coding.

    This way you may protect content of any post and even selectively assign certain members to view certain posts but not other posts, if you wish.

    Regards,

    Gleb
    {{ DiscussionBoard.errors[676152].message }}
  • Profile picture of the author TheNightOwl
    @Lisa: Thanks very, very much for taking the challenge. That looks like what I'm after. I'd actually like to remove the "Enter your password to view comments" line, to be honest. Any idea where that line is being pulled from?

    At any rate, it looks like what I'm after. I'll look into it and get back to you. Thanks again.

    @Gleb: Thanks. I've looked at Memberwing a few times. In fact, I was pondering this morning whether that might be my best solution for a different site I'm working on. (So it's weird that I should come in and see your response here! Ha!).

    I'll PM you my question about Memberwing.

    Thanks again, folks!

    TheNightOwl
    Signature
    {{ DiscussionBoard.errors[677392].message }}
    • Profile picture of the author Lisa Copen
      Aha! Then this is the file you need to edit:

      \wp-includes\comment-template.php

      In the function comments_popup_link:
      Code:
      	if ( post_password_required() ) {
      		echo __('Enter your password to view comments -- HERE');
      		return;
      	}
      if you want nothing to show, completely remove the "echo __('Enter your password to view comments -- HERE');" line,
      OR change the text to blank "echo __('');"
      The second choice will allow you to easily go back in and add text later on.

      And if you bring in RRS feeds for articles, there is another line just like it in \wp-includes\feed-rss2-comments.php


      Glad I could help!

      Lisa
      {{ DiscussionBoard.errors[678652].message }}
  • Profile picture of the author edynas
    Banned
    What i do in this kind of cases is this. I have a local copy of the site here at my pc and i use notetab light (free version) to search thru files fast
    Fookes Software - Downloads
    it lets you search for text within files and points to the right place where it found n occurence.
    {{ DiscussionBoard.errors[681059].message }}
  • Profile picture of the author KathyK
    LOL - Edynas, I was going to recommend EXACTLY the same thing, till I scrolled down and saw your post. So I'll just second that. That disk search of NoteTab (I also use light) has saved me countless hours of hunting.
    Signature

    Cheers,
    Kathy

    {{ DiscussionBoard.errors[682390].message }}
  • Profile picture of the author TheNightOwl
    Thanks Lisa, edynas, and Kathy.

    Much appreciated.

    There's still another line that's not behaving itself, but I'm over it. LOL!

    Thanks again,
    TheNightOwl
    Signature
    {{ DiscussionBoard.errors[708994].message }}

Trending Topics