Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Plugin Request: display a remembered commenter's name
I’ve seen Wordpress sites that alter the comment form for visitors who have a cookie, so that they not only don’t see the name, email, and url input boxes they’ve filled in before, they get a message “Welcome Back, [Remembered Name].”
I can make the input boxes go away using txp:if_cookie and display:none, but it would be nice to have the ability to insert their remembered name somehow.
Any takers? My thanks in advance…
TextPattern user since 04/04/04
Offline
Re: Plugin Request: display a remembered commenter's name
Reid, I’m using <code><?php echo pcs(‘name’); ?></code> in my comment form for returning visitors to pick up their name in a welcome message. I’m also using the if_cookie plug-in. Is that what you are after?
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
Re: Plugin Request: display a remembered commenter's name
That is exactly what I was looking for (though I wrapped the function in the recommended <txp:php></txp:php>
) Thanks!!!
Last edited by reid (2005-09-01 04:47:45)
TextPattern user since 04/04/04
Offline
Re: Plugin Request: display a remembered commenter's name
Reid, I’ve not come across txp:if_cookie before, could you show me your syntax? (not a come-on in case anyone was wondering)
Cheers,
Jon VC#9
Offline
Re: Plugin Request: display a remembered commenter's name
It’s a plugin where the author didn’t prefix his functions with his initials (which leads to confusions and might lead to name clashes down the road).
I would also like to point out, that pages that are modified depending on cookies should double check that they are also sending the correct HTTP-Headers, because otherwise you might run into trouble with Proxies…
Offline
Re: Plugin Request: display a remembered commenter's name
superb – thanks Sencer
Cheers,
Jon VC#9
Offline
Re: Plugin Request: display a remembered commenter's name
Jon, the “syntax” I’m using was lifted from the method Paul Arms details here. My whole code chunk is kinda ugly, but here’s the code for hiding the “Website” input box, and the added part with the remembered name:
<code>
<dd class=“textinput”<txp:if_cookie> style=“display: none;”</txp:if_cookie>><label><txp:text item=“Website” /> :<txp:comment_web_input /></label></dd>
<txp:if_cookie><dd id=“remembered”>Welcome back, <txp:php>echo pcs(‘name’);</txp:php>. Your info is “remembered.” Comment away!</dd></txp:if_cookie>
</code>
Sencer, I assume checking for correct HTTP headers is something that needs to be within the plugin?
Last edited by reid (2005-09-02 01:07:27)
TextPattern user since 04/04/04
Offline