0

I have a function that checks if the email address already exists in the database or not.

It's working:

Here's that portion.

->callback(function($val) { return !username_exists($val); }, 'The username you entered already exists.') ->validate('username'); 

If the username exists, it will through a message saying "The username you entered already exists". What I want after 3 seconds this message is displayed redirects them to login page.

So I've added this line of code to the existing code:

wp_redirect( 'http://localhost/wordpress/wp-login.php', sleep(3)); exit; 

It does redirect, however I do not see the message anymore. Is there anyway I can display that message and then redirect?

It's a wordpress, so I can't do much in it.

5
  • How exactly is the message being displayed? Commented Nov 4, 2012 at 5:10
  • >It's a wordpress, so I can't do much in it. why ? wordpres not opensourced anymore ? Commented Nov 4, 2012 at 5:12
  • I tend to stay away from pre-made CMSs, so I'm not familiar with Wordpress' code. I would imagine the message is displayed using javascript? Commented Nov 4, 2012 at 5:15
  • Yes, I do have a javascript that does print it. What Happens is that I have a jquery colorbox where I have email, username, and password. If the email exists it takes it to the same page and shows a message. Now when I enter the redirect code, I don't see the message. Commented Nov 4, 2012 at 5:18
  • So when the user submits the form and the email exists, it displays a message on that page using jquery. 3 seconds later you want the user to be redirected to a different page? And you want that message to show up still? Commented Nov 4, 2012 at 5:25

1 Answer 1

2

You will need a HTML or JavaScript solution, not a php solution.

Here is an HTML solution:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Your Page Title</title> <meta http-equiv="REFRESH" content="3;url=http://localhost/wordpress/wp-login.php"></HEAD> <body> ... </body> </html> 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.