Current location: Hot Scripts Forums » Programming Languages » PHP » Registration Page Errors


Registration Page Errors

Reply
  #1 (permalink)  
Old 12-23-05, 01:59 AM
sikatzonline sikatzonline is offline
New Member
 
Join Date: Dec 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Registration Page Errors

You MIGHT find my problem simple: I want to get rid of the ugly error messages every time a user fails to type the username, the email address and other required fields. I'm posting for the first time in these forums because nobody's helping me in : http://wordpress.org/support/topic/52626

This is the code:
PHP Code:

if ( !get_settings('users_can_register') )

$action 'disabled';

header'Content-Type: ' get_bloginfo('html_type') . '; charset=' get_bloginfo('charset') );

switch(
$action) {

case 
'register':

$user_login $_POST['user_login'];
$user_email $_POST['user_email'];

/* checking that username has been typed */
if ($user_login == '') {
die (
__('ERROR: Please enter a username.'));
}

/* checking e-mail address */
if ($user_email == '') {
die (
__('ERROR: Please type your e-mail address.'));
} else if (!
is_email($user_email)) {
die (
__('ERROR: The email address isn’t correct.'));

WP uses cases, switch to action watchamacallit method. I've tried inserting the code above to the case 'register' and it doesnt work. Then I've tried insterting the code on the case 'registration complete' ODD how it worked. But it's breaking the layout...

How do I change the code to display or return an errorpage.php instead of a page that doesn't even have a header/footer?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 12-23-05, 03:38 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
I didn't try it, but this should show a pop up with the error message and return.

PHP Code:



if ( !get_settings('users_can_register') )
$action 'disabled';

header'Content-Type: ' get_bloginfo('html_type') . '; charset=' get_bloginfo('charset') );

switch(
$action) {

case 
'register':

$user_login $_POST['user_login'];
$user_email $_POST['user_email'];

/* checking that username has been typed */
if ($user_login == '') {
die (
__('<script language = "javascript" type = "text/javascript">
        <!-- // Go back
            alert("Please enter a username.");
            history.go(-1);
        -->
        </script>'
));
}

/* checking e-mail address */
if ($user_email == '') {
die (
__('<script language = "javascript" type = "text/javascript">
        <!-- // Go back
            alert("Please type your e-mail address.");
            history.go(-1);
        -->
        </script>'
));

} else if (!
is_email($user_email)) {
die (
__('<script language = "javascript" type = "text/javascript">
        <!-- // Go back
            alert("The e-mail address is not correct.");
            history.go(-1);
        -->
        </script>'
));

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Classified Ads skipper23 Perl 3 11-22-05 03:22 AM
Disable form fields to be submitted RickyRod JavaScript 2 05-24-04 11:15 AM
Showing errors on a page pernaveikko PHP 3 03-16-04 03:04 PM
Classified Ads skipper23 Perl 2 12-30-03 04:43 AM
creating a php registration page codeguru21 Script Requests 3 11-07-03 02:02 PM


All times are GMT -5. The time now is 12:56 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.