WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need help with coding this piece. Basically i want with someone click on my author page. It stored a cookie of that author name and email. I want the cookie to stay in place untill the person close their browser, or however long. not a big deal. I should then be able to use this info in any gravityform on my site. Basically i am tracking leads generated by my authors. If you have a better way of doing this, i am happy for suggestions. Thanks . Heres is my current author.php code to get the author info

if(isset($_GET['author_name'])) :
$curauth = get_userdatabylogin($author_name);
else :
$curauth = get_userdata(intval($author));

share|improve this question
Probably this Question is related to gravity forms. Have you asked in their support forums? Can you probably place a link to that question in their forums if so? – hakre Nov 9 '10 at 18:27

When you are on an author.php template page, you should be able to get the current author via $wp_query->get_queried_object(). That is also what is_author() uses when you want to check for a specific author.

Do you also have a question about setting the cookies? I don't think WordPress has specific cookie functions. wp_setcookie() is deprecated by wp_set_auth_cookie(), but that seems to do more advanced stuff than just set a simple cookie.

If you use a specific visitor tracking system (like Google Analytics) I'm sure you can also save this kind of "lead" info with them. If you want to know more about that, the Pro Webmasters Stack Exchange site is probably a better place.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.