Redirect user problem before and after registration

I made a button for submitting an article : http://www.articlespedia.org and i wish to do the following when i click it:
If i am not logged in then it should redirect to the following page: http://www.articlespedia.org/author, else should go the http://www.articlespedia.org/wp-admin/post-new.php. How am i going to do this? I am a noob in php.

Because you are using WordPress, you can use some of its build in functions for this. E.g:

http://codex.wordpress.org/Function_Reference/auth_redirect

http://snipplr.com/view/46533/

Thank you ralph for helping me as always, wished i was advance like you, i thought on this, and my little brain came up to this:
How i wish i would know programming, but i know just some base code. In my mind i would do this:

<p class=“buttonn”><a href=“http://www.articlespedia.org/”></a></p> this is the button. After i click it, i believe that this code will enter in action, to do this: if(!is_user_logged_in() && $pagenow != ‘wp-login.php’) {
wp_redirect( ‘/authors’, 302 );
}

The problem is that i don’t know how to write this and if it’s possible to write it side by side on the button.
Sorry for being a noob, still got to learn many things.

Don’t worry! I’m a noob too. I’ll move this to the WordPress forum, because I’m not familiar with WordPress. (I just Googled what you were trying to do.)

Ok, thanks anyway, i posted here because you helped me many times :slight_smile:

Problem solved. I did not know that when you are logged in, the register page will show the correct message, i needed to add <p class=“buttonn”><a href=“http://www.articlespedia.org/authors”></a></p> and it does everything automatically.

One more thing" When the use is logged in and clicks the button, it sends him the following message “Thank you for registering”. Instead of this message i want to be redirected to another page. i located the code, and tried the following:

if(empty($first_visit)) {
$message = !empty($atts[‘message’])?$atts[‘message’]:“Thank you for registering.”;
update_user_meta($user_ID,‘first_visit’,date(‘Y-m-d’));
echo ‘<div id=“message” class=“success”><p>’.$message.‘</p></div>’;
} else {
echo “You are already registered for this site.”; // instead of this, replaced with wp_redirect( ‘http://www.articlespedia.org/wp-admin/post-new.php’, 301 ); exit; }

But it did not work, it stopped the page from working.