• Resolved aemars

    (@aemars)


    Hello,

    I’m currently trying to edit my comments form section and I would like for the fields author, email, and URL to be shown whether a viewer is logged in or out of WordPress.

    Right now when someone is logged in these fields do not show up. They only show when a user is not logged in.

    My site is: https://www.jonathanmars.com

    I’ve searched through the Codex but have only further confused myself.

    Thanks for any help,

    Aimee

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi Aimee,

    I’ll do what I can to help you here. If I understand correctly, you’d like to prompt your logged-in site visitors to provide information each time they comment, is that correct?

    The behavior you’re describing (not showing these fields to logged-in users) is the default WordPress behavior. If I’m not mistaken, the thinking is that the users have provided at least some of this information (e.g. email address is a required field) upon creation of their user account for your site.

    Is there something you’re hoping to achieve by prompting them each time they comment?

    Thanks!

    Most likely there’s logic in the comment form display code which says the form should only be displayed when user is -not- logged in. Probably the code was inserted into a portion of a file with this logic there already?

    Can you post your comment form code? You may use any of the public code paste bins.

    • This reply was modified 7 years, 8 months ago by George Appiah.
    Thread Starter aemars

    (@aemars)

    Hi David @haveanepiphany

    You are correct and I actually see what you’re saying now that users have already provided that information. I guess I should not change that then and really my goal is actually uniformity.

    When a user has currently signed “out” the fields author, email, and URL are to the right of the comment box, which I’d like to keep, but when a user is signed “in” the comment box remains the same size unless I set the width to 100%. If I set the 100% then when a user has signed “out” the field boxes are now below the comment box. Could you help me figure out how to change the size of the comment box based on these contents? Below is my code (sorry if I didn’t place it correctly):

    #commentform {
    padding-left: 30px;
    padding-right: 30px;
    padding-top: 20px;
    padding-bottom: 30px;
    width: 100%;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='https://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%23c7c7c7' fill-opacity='0.14'%3E%3Cpath d='M0 38.59l2.83-2.83 1.41 1.41L1.41 40H0v-1.41zM0 1.4l2.83 2.83 1.41-1.41L1.41 0H0v1.41zM38.59 40l-2.83-2.83 1.41-1.41L40 38.59V40h-1.41zM40 1.41l-2.83 2.83-1.41-1.41L38.59 0H40v1.41zM20 18.6l2.83-2.83 1.41 1.41L21.41 20l2.83 2.83-1.41 1.41L20 21.41l-2.83 2.83-1.41-1.41L18.59 20l-2.83-2.83 1.41-1.41L20 18.59z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    }
    
    .form-submit {
    margin-top: 220px;
    }
    
    #submit {
    float: right;
    display: inline;
    }
    
    #nsu-checkbox {
    margin-top: 75px;
    }
    
    #respond {
    width: 600px;
    }
    
    #respond form input[type="text"], #respond form textarea {
        -moz-box-sizing: border-box;
        font-size: 0.857143rem;
        line-height: 1.71429;
        padding: 0.714286rem;
        width: 100%;
        height: 100px;
    }
    
    #respond #comment {
    float: right;
        width: 300px !important;
        height: 155px !important;
    }
    
    #respond #author {
        width: 175px !important;
        height: 20px !important;
    }
    
    #respond #email {
        width: 175px !important;
        height: 20px !important;
    }
    
    #respond #url {
        width: 175px !important;
        height: 20px !important;
    }

    Thanks so much for your help! This has been a huge frustration for me.

    Aimee

    Hi Aimee,

    OK just so I understand correctly, you’d like the comment box itself to remain as it is for logged-out users (so that the other fields display to its right-hand side), but when the user is logged-in, you’d like the box to occupy 100% of the available space.

    Is that correct?

    Incidentally, looking at this blog post just now, the 3 fields (author, email & website) are to the left, and the comment box is to the right. Perhaps this is the way you want things to display for logged-out users? (I’m obviously logged out, as I don’t have a user account on the site.)

    Sorry if this is confusing — I’m just trying to make sure I understand exactly what you want to accomplish. We’ll get you there!

    Thanks!

    Thread Starter aemars

    (@aemars)

    Hey David,

    You are exactly correct!

    I might actually be the one misunderstanding. You said, “I’m obviously logged out, as I don’t have a user account on the site.” Would this mean that technically everyone with the exception of myself would be logged out unless they created an account? If so then everyone will see the posts just as you have seen them and that would be okay. Otherwise, I’d like to try and find a solution.

    Let me know if that makes sense.

    Thanks again.

    Hi Aimee,

    Apologies for the delayed response… I’ve been traveling.

    Yes, you are correct. All users will be “logged out” unless and until a user account is created for them in your WordPress installation. So, if you are the only user with an account, then no one else will be logged in.

    Does that help you?

    Thanks!

    Thread Starter aemars

    (@aemars)

    Sorry for my delayed response as well…

    Yes, that does help! Thank you for getting back to me.

    Best,

    Aimee

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘comment_form() fields being displayed only for non logged in users’ is closed to new replies.