ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Comment {url} variable not being output or captured

January 26, 2011 6:22pm

Subscribe [3]
  • #1 / Jan 26, 2011 6:22pm

    Hi,

    I have a single entry page with a comment form and the comment entries tag to display the comments. I have it adding and showing comments but the url field is not being captured or displayed on the front-end.

    I have the following blocks of code for this:

    The comment form:

    {exp:comment:form form_class="generic-form comment-form"}
                            <div class="frow frow-text"><label for="comment-name">Name <span class="required">*</span></label><div class="capture-container"><input type="text" id="comment-name" class="text" name="name" value="{name}" /></div></div>
                            <div class="frow frow-text"><label for="comment-email">Email Address <span class="required">*</span></label><div class="capture-container"><input type="text" id="comment-email" class="text" name="email" value="{email}" /></div></div>
                            <div class="frow frow-text"><label for="comment-url">URL <span class="required">*</span></label><div class="capture-container"><input type="text" name="url" value="{url}" id="comment-url" /></div></div>
                            <div class="frow frow-textarea"><label for="comment-comment">Comment</label><div class="capture-container"><textarea id="comment-comment" rows="10" cols="30" name="comment">{comment}</textarea></div></div>
                            <div class="frow frow-action"><input type="submit" value="Post comment →"></div>
                        {/exp:comment:form}

    To show comments:

    {exp:comment:entries}
                        <div class="entry-comment group">
                            <div class="comment-meta group">
                                <h3>{name}</h3>
    <p>                            <a href="http://{url}">Website</a><br />
                            </div><br />
                            <div class="the-comment group"><br />
                                {comment}<br />
                            </div><br />
                            {exp:gravatar email=<br />
                        </div><br />
                        {/exp:comment:entries}


    The following is an outputted comment:

    <div class="entry-comment group">
                            <div class="comment-meta group">
                                <h3>Paul:</h3>
    <p>                            <a href="http://">Website</a> Paul<br />
                            </div><br />
                            <div class="the-comment group"><br />
                                jdkjdkjd<br />
                            </div><br />
                            <a href="http://www.gravatar.com/avatar/c48e0e441c71287b1e9061515d2466df?s=60&d=http://airfront.co.uk/img/global/default-avatar.png">http://www.gravatar.com/avatar/c48e0e441c71287b1e9061515d2466df?s=60&d=http://airfront.co.uk/img/global/default-avatar.png</a><br />
                        </div>

    Please see the attached screenshot, should there be a column showing any comment author urls?

    I’ve read the user guide but believe I’m doing everything it tells me to. I’ve ran out of ideas. :(

  • #2 / Jan 26, 2011 7:25pm

    It seems that no matter what I do, its using the details from my control panel account. :(

    Is this normal behavior? Surely I should be able to type in a different name and have that show instead? Or am I missing something fundamental?

  • #3 / Jan 27, 2011 4:13am

    Aaron Waldon

    66 posts

    Hi paulmichaelsmith! I think the problem is that you are filling out the form while you are logged into your account. If you look at the documentation sample form at http://ellislab.com/expressionengine/user-guide/modules/comment/form.html, you see that they use the following conditional:

    {if logged_out}
        <label for="name">Name:</label> <input type="text" name="name" value="{name}" size="50" /><br > 
        <label for="email">Email:</label> <input type="text" name="email" value="{email}" size="50" /><br > 
        <label for="location">Location:</label> <input type="text" name="location" value="{location}" size="50" /><br > 
        <label for="url">URL:</label> <input type="text" name="url" value="{url}" size="50" /><br > 
    {/if}

    They do that because EE only wants to ask for those fields from people that are not logged in. If you are logged in, it will automatically attempt to pull that data from the account you are signed in with. Does that make sense?

    Let me know if that fixes the problem.

  • #4 / Jan 27, 2011 6:38am

    Hi Aaron,

    That makes sense now, it was very confusing at first because I had the form fields visible and it didn’t seem to be capturing the data. When using {url} it didn’t return anything even though I’d entered it in the form. I now know it was because in my user profile I didn’t have a website url, etc.

    Thanks for the reply.

    - Paul.

  • #5 / Jan 27, 2011 6:45am

    Aaron Waldon

    66 posts

    No worries Paul. I have been tricked with similar situations of member data vs logged in user data a few times myself. 😊 Glad I could help.

  • #6 / Jan 27, 2011 3:32pm

    Ingmar

    29245 posts

    Very glad to see that helped. Please post again as needed.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases