Title: Using PHP code
Last modified: February 21, 2017

---

# Using PHP code

 *  Resolved [RPL](https://wordpress.org/support/users/rpl/)
 * (@rpl)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/using-php-code-2/)
 * I want to be able to display a different message depending on whether a user 
   is logged in / not logged in.
 * I think the code I need to run is as follows:
 * <?php if ( zmember_valid_subscription() ) { ?>
    <!– if user is logged in –> <
   p>You are logged in</p> <?php } else { ?> <!– if user is not logged in –> <p>
   You are logged out</p>
 * When I insert this code, even with the “allow PHP” checkbox ticked, it gives 
   an error:
 * Parse error: syntax error, unexpected end of file in /home/iar2017/public_html/
   wp-content/plugins/advanced-ads/classes/ad_type_plain.php(106) : eval()’d code
   on line 6
 * Can anyone advise what modifications I need to make to the code to get it to 
   run?
 * Many thanks 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [RPL](https://wordpress.org/support/users/rpl/)
 * (@rpl)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/using-php-code-2/#post-8829844)
 * Hi, ignore this, I’ve solved it. I didn’t realise you had to insert the opening
   and closing php tags!
 * <?php
    if ( zmember_valid_subscription() ) { echo ‘<p>Logged In</p>’ ; } else{
   echo ‘<p>Logged out</p>’ ; } ?>
 *  Plugin Author [Thomas Maier](https://wordpress.org/support/users/webzunft/)
 * (@webzunft)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/using-php-code-2/#post-8830079)
 * Hi RPL,
 * thanks for also sharing the solution!
 * Thomas

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Using PHP code’ is closed to new replies.

 * ![](https://ps.w.org/advanced-ads/assets/icon-256x256.gif?rev=2773443)
 * [Advanced Ads – Ad Manager & AdSense](https://wordpress.org/plugins/advanced-ads/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-ads/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-ads/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-ads/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-ads/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-ads/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Thomas Maier](https://wordpress.org/support/users/webzunft/)
 * Last activity: [9 years, 3 months ago](https://wordpress.org/support/topic/using-php-code-2/#post-8830079)
 * Status: resolved