Custom register page with single pages
Permalink 1 user found helpful
I have modified the config/site_theme_paths.php to pull my custom page from /single_pages. Styling is good but the form doesn't work. There are no errors generated and displayed and if the form is filled out correctly it just redisplays the page.
I am assuming that the core location is somehow pulling some vital code into the page.
I am assuming that the core location is somehow pulling some vital code into the page.
can you explain a little more what you did? did you just copy /concrete/single_pages/register.php to /single_pages/register.php and make some changes?
Yes. Just a straight duplication of the core file with a div added for styling. This is the first three lines
[code]
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); ?>
<h2 class="dot-underline italic-head"><?php echo t('Site Registration')?></h2>
<div class="ccm-form wedding-library">
[code]
[code]
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); ?>
<h2 class="dot-underline italic-head"><?php echo t('Site Registration')?></h2>
<div class="ccm-form wedding-library">
[code]
It is a 5.4.x install upgraded to 5.4.0.5. I was wondering if the upgrade folder was giving me problems, somehow.
Same problem as the original poster.
I copied /concrete/single_pages/register.php to /single_pages/register.php so I could customize the form. When attempting to use the page the page simply reloads (with /register/do_register in the address bar) and nothing happens. No errors. Nothing (that I can see).
Seems that the issue is tied to using a custom theme for the register page (in config/site_theme_paths.php).
Does anyone know the answer to this? I'm going to keep looking.
I copied /concrete/single_pages/register.php to /single_pages/register.php so I could customize the form. When attempting to use the page the page simply reloads (with /register/do_register in the address bar) and nothing happens. No errors. Nothing (that I can see).
Seems that the issue is tied to using a custom theme for the register page (in config/site_theme_paths.php).
Does anyone know the answer to this? I'm going to keep looking.
Is the problem that a user doesn't actually get registered when the form is submitted?
I find that custom single pages, even with completely copy-paste code, can behave differently than the default ones (for instance, if you log in with the wrong password, the site does not say "Wrong Password", as in the default login page—the custom login page is just refreshed).
This kind of behavior can be deceptive.
I find that custom single pages, even with completely copy-paste code, can behave differently than the default ones (for instance, if you log in with the wrong password, the site does not say "Wrong Password", as in the default login page—the custom login page is just refreshed).
This kind of behavior can be deceptive.
Got it!
In c5's core theme the view.php file includes this code:
If you include that in your own theme's view.php before
then you'll get error reporting on your register page and others that use view.php.
In c5's core theme the view.php file includes this code:
<?php if (isset($error) && $error != '') { ?> <?php if ($error instanceof Exception) { $_error[] = $error->getMessage(); } else if ($error instanceof ValidationErrorHelper) { $_error = $error->getList(); } else if (is_array($error)) { $_error = $error; } else if (is_string($error)) { $_error[] = $error; } ?> <ul class="ccm-error"> <?php foreach($_error as $e) { ?><li><?php echo $e?></li><?php } ?> </ul>
Viewing 15 lines of 17 lines. View entire code block.
If you include that in your own theme's view.php before
print $innerContent
then you'll get error reporting on your register page and others that use view.php.
Thanks! Will definitely have to try that.
Update!
The code can be a lot simpler, and also should be in a different place.
Here's the code:
Put it on your register.php page NOT your theme's view.php file. Turns out that other single pages (for instance, in the profile pages) include this code.
Let's see if I encounter some other issue with this now...
The code can be a lot simpler, and also should be in a different place.
Here's the code:
if (isset($error) && $error->has()) { $error->output(); }
Put it on your register.php page NOT your theme's view.php file. Turns out that other single pages (for instance, in the profile pages) include this code.
Let's see if I encounter some other issue with this now...
I'm trying to figure this out. The code you pasted, which goes in register.php - does that need to go in the core or do I make a new register.php in /single_pages/ and also does it matter where within register.php the code goes?
Sorry for the late reply.
You should copy /concrete/single_pages/register.php to /single_pages/register.php.
The code can go anywhere, but it makes the most sense to have it near the top of the page near the form.
You should copy /concrete/single_pages/register.php to /single_pages/register.php.
The code can go anywhere, but it makes the most sense to have it near the top of the page near the form.
Hey Kirk - I placed the code:
within my /single_pages/register.php and I'm still not seeing any error messages - did I miss a step somewhere? Thanks for your help - not having feedback when people login in with the wrong password and stuff has been a big annoyance - would love to get it resolved.
if (isset($error) && $error->has()) { $error->output(); }
The top of one of my register pages looks like this:
It shows error messages.
You say "when people login"... that would be on login.php, not register.php. Make sure the same code is at the top of login.php. Of course, you should copy login.php to /single_pages, *not* update the core.
The core should have this built-in, shouldn't it? Perhaps core themes have this in the view.php file? Doesn't seem consistent, so you might get two duplicate error messages if you just put it in your view.php.
<?php defined('C5_EXECUTE') or die("Access Denied."); ?> <h1><?php echo t('Forum registration')?></h1> <div class="ccm-form"> <?php if (isset($error) && $error->has()) { $error->output(); } else if (isset($message)) { ?> <div class="message"><?php echo $message?></div> <script type="text/javascript"> $(function() { $("div.message").show('highlight', {}, 500); }); </script> <?php } ?> <?php if($success) { // more code...
It shows error messages.
You say "when people login"... that would be on login.php, not register.php. Make sure the same code is at the top of login.php. Of course, you should copy login.php to /single_pages, *not* update the core.
The core should have this built-in, shouldn't it? Perhaps core themes have this in the view.php file? Doesn't seem consistent, so you might get two duplicate error messages if you just put it in your view.php.
Wow, I'm an idiot - all this time and I was putting the code in the wrong page... I pasted you snippet into the login.php and it worked perfectly - thank you.
No worries... I've done the same sort of thing too many times to mention. Glad you got it working!
I know this is an old post - but for anyone else searching, this still works in 5.8 :-)
I tried all the samples here and could not get it to work unfortunately. Still no validation. Then I found another post which seems to work. Yay.
http://www.concrete5.org/community/forums/usage/theme-for-registrat...
http://www.concrete5.org/community/forums/usage/theme-for-registrat...