Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
add a default value to comment_name_input & comment_email_input
Hello Txp Community,
With <txp:cbe_frontauth_if_logged>
, I want add default author connected name to comment_name_input
tag and this email to comment_email_input
tag.
Is there a solution ?
These tags have no attributes and lack of flexibility unlike other txp tags. Why no wrap
, class
or value
attribute ?
Thanks
Offline
Re: add a default value to comment_name_input & comment_email_input
Hi sacripant.
I think etc_query can help you. Look at the Help docs, there is an example about how to process some “hardcoded” output from TXP tags. Alternatively, you may be able to solve this via JS.
Offline
Re: add a default value to comment_name_input & comment_email_input
Hi guys.
You can try to replace <txp:comment_name_input />
in comment_form
with
<txp:variable name="user_name" value='<txp:cbe_frontauth_whois type="RealName" />' />
<txp:etc_query data='<txp:comment_name_input />'
query="input[@id='name']"
sanitize="variable"
replace="@@value={?user_name}" />
I have wrapped <txp:cbe_frontauth_whois type="RealName" />
in a variable only to escape it.
If you prefer JS, you must pass user name on the client side, so you’ll have to inject it somewhere anyway, but it’s feasible.
Offline
Re: add a default value to comment_name_input & comment_email_input
Thanks etc, thanks maniqui.
Never use etc_query. It’s a big plugin.
Use etc_query for that, it’s like out a tank to kill an ant ? non ?
I use Javascript, waiting maybe a better flexibility for comment tags.
Offline
Re: add a default value to comment_name_input & comment_email_input
sacripant wrote:
Use etc_query for that, it’s like out a tank to kill an ant ? non ?
Si! and thus all the funnier. Honestly, etc_query
is called a dozen of times on this page, without any noticeable drawback.
Last edited by etc (2012-09-20 15:46:40)
Offline