osclass - PHP - Logical operator with IF/Else statement test not working correctly -
code from: oc-content/themes/realestate/item.php
i have piece of php code part of 'framework' called osclass. basically, trying 'hide' user (the publisher of advert) name non-logged in users. in other words, if user logged in, can see if publisher users advert.
i found out need add piece of code osc_is_web_user_logged_in()
, has worked section, however, due else
statement, publishers name still displaying...
how can amend else statement? remove else statement, i'm worried 'break' , unsure osc_item_user_id()
does... add if statement within else statement (complete php newbie here).
<div class="ico-author ico"></div> <?php if( osc_item_user_id() != null && osc_is_web_user_logged_in() ){ ?> <?php echo osc_item_contact_name(); ?> <?php } else { ?> <?php echo osc_item_contact_name(); ?> <?php } ?>
thanks!
in opinion should simple write:
<div class="ico-author ico"></div> <?php if( osc_item_user_id() != null && osc_is_web_user_logged_in() ){ ?> <?php echo osc_item_contact_name(); ?> <?php } ?>
as don't want display publisher name when user not logged, don't need have else section.
Comments
Post a Comment