I have a custom page that submits a form to another custom Wordpress page. I need to check the userID on this page, so I do this :
$user_ID= get_current_user_id();
When i echo that variable I get 0. HOWEVER, if i access the page directly (without submitting the form) it shows the correct userID.
To make it stranger, when i submit the form my admin bar will disappear as if i wasn't logged in, again, if i access the page directly the admin page will appear.
What could be happening when i submit the form that will cause this?
I should mention the page im submitting to is a copy of page.php with a few lines of code to submit the variables to a database. Anybody have some suggestions?