Checking if user is logged in a post or page or portfolio
I have a post that shows up on my homepage board (see http://www.grossify.com) that contains a registration form. I would like to detect if the user is logged in. If not, it should show the form. If logged in, it should hide it.
I created a .js file that I’ve put in the wp-content directory. I then reference it in the post with the following code:
The problem is I don’t know how to determine in the JS function showRegistrationForm() in the .js file if the user is logged in.
I know there are PHP functions wp_localize_script() and is_user_logged_in(). However, this does no good in .js. I don’t know enough about JS and PHP to figure this out.
- The topic ‘Checking if user is logged in a post or page or portfolio’ is closed to new replies.