I have saved extension settings that I want to use in the Registration Form Template (i.e. CP Home › Admin › Members and Groups › Member Profile Templates › Default › Registration Form). I have tried to use a SQL select statement in the Registration Form Template, but the template does not process it. The SQL statement is printed to the screen like plain text.
{exp:query sql="SELECT settings FROM exp_extensions WHERE class = 'broadcaster_registration';"} TESTING: {settings} {/exp:query}
How can I access the saved extension variables in this template?!
Thanks for your help.
What does the output look like exactly? It shows this?
SELECT settings FROM exp_extensions WHERE class = ‘broadcaster_registration’;
When I run that query for an extension I have installed I get the following output:
TESTING: a:1:{s:7:"weblogs";a:2:{i:0;s:1:"1";i:1;s:1:"5";}}
It should look something like that if the query is working properly. Is that kind of output usable for you? There are other ways to get the extension settings if you want output that is in a more usable form…
When I apply the query, the output is literally:
{exp:query sql="SELECT settings FROM exp_extensions WHERE class = ‘broadcaster_registration’;"} TESTING: {settings} {/exp:query}
Keep in mind that this template is located here: CP Home › Admin › Members and Groups › Member Profile Templates › Default › Registration Form. I have yet to find any info on whether these templates allow this kind of EE tag or not. The default templates allow for other EE tags/variables to be used, so I don’t know why the SQL query prints as text. And if the tag is not allowed, then how might I be able to pull the SQL data into the form.
And the settings data will be usable to me because I saved it there so I could use it else where in EE. My problem is that this EE provided template doesn’t seem to allow for SQL queries, and I can’t think of another way to get to my data.
Oh I see - yeah unfortunately the ‘specialty’ templates don’t accept EE tags like normal templates you create yourself - and it’s a bit of mystery as far as which tags are accepted and which aren’t. I tend to make my own registration forms in custom templates but I’ve only done it a couple times and I’m far from an expert. I guess I would suggest doing some searching on the forums, the wiki and the knowledge base for creating registration forms in custom templates. I guess the other option would be to use PHP to do it, but I’m not sure if you can put PHP in those templates either. Do you know PHP at all? I would be surprised if you could, but once again I don’t know much about them - if you can let me know and I could help you set that up…
I don’t have any specific links - probably best just to use the search functionality for that. Here’s a custom registration form I made for a client a bit ago (some of this wouldn’t necessarily be applicable to your site).
<pre><code><form id=’register_member_form’ method=”post” action=”“>
<fieldset>
<input type="hidden" name="XID" value="" />
<input type="hidden" name="ACT" value="7" />
<input type="hidden" name="mbase" value="{path=pages/thank_you/register}" />
<input type="hidden" name="RET" value="{path=pages/thank_you/register}" />
<input type="hidden" name="FROM" value="" />
<label for="username"><span class="required">*</span> Please create a Username</label>
<input class="inputMedium" type="text" name="username" value="<?php echo $_SESSION['username']; ?>" maxlength="32" />
<label for="password"><span class="required">*</span> Please create a Password (NOTE: passwords must be at least 5 characters long)</label>
<input class="inputMedium" type="password" name="password" value="<?php echo $_SESSION['password']; ?>" maxlength="32" />
<label for="password"><span class="required">*</span> Password Confirm</label>
<input class="inputMedium" type="password" name="password_confirm" value="<?php echo $_SESSION['password_confirm']; ?>" maxlength="32" />
<label for="password"><span class="required">*</span> Please create a Screen Name</label>
<input class="inputMedium" type="text" name="screen_name" value="<?php echo $_SESSION['screen_name']; ?>" maxlength="32" />
<label for="password"><span class="required">*</span> Email Address</label>
<input class="inputMedium" type="text" name="email" value="<?php echo $_SESSION['email']; ?>" maxlength="120" />
<label for="password"><span class="required">*</span> <?php if($_SESSION) { echo '<span class="required">'; } ?>Company Password<?php if($_SESSION) { echo '</span>'; } ?></label>
<input class="inputMedium" type="text" name="m_field_id_1" value="" maxlength="32" />
<label for="rules"><span class="required">*</span> Terms of Service</label>
<textarea name='rules' class='textShort' readonly>All messages posted at this site express the views of the author, and do not necessarily reflect the views of the owners and administrators of this site.
By registering at this site you agree not to post anything that is obscene, vulgar, slanderous, hateful, threatening, or that violate any laws. We will permanently ban all users who do so.
The VBSR forums are an information and networking resource for members. We ask that you not post any advertisements, sales, discounts, solicitations, promotions, or any other content to advance your business. We reserve the right to remove any messages that we feel falls under the above categories, and the right to remove, edit, or move any messages for any reason.</textarea>
<ul>
<li><input type='checkbox' name='accept_terms' value='y' />I agree to the terms of service.</li>
</ul>
</fieldset>
<input class="button" type="image" name="submit" src="/css/images/button_register.gif" />
</form>[/code]
The important part are the hidden form fields - I think the only required one is the ACT field. That tells the system to perform a registration. This was a year ago or so and it works but this might be bad practice for some reason or other (and there are fields in there I wasn’t sure how to use) so I don’t know if there are better or more appropriate ways of doing it…
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.