Osclass forums

Support forums => Themes => Real Estate => Topic started by: ben_dchost1 on June 25, 2014, 03:21:06 pm

Title: Hide Phone Number + name IF user is not logged in [SOLVED]
Post by: ben_dchost1 on June 25, 2014, 03:21:06 pm
I want to hide the contact details of the publisher/seller if the user is not logged in. In other words, the only way a user can find out the contact details is if the user is logged in. I have attached an image which shows what I want to hide from non-logged in users.

Thanks
Title: Re: Hide Phone Number + name IF user is not logged in
Post by: design on June 25, 2014, 06:07:16 pm
add this before the field and don't forget to close the bracket after the field

<?php if ( osc_is_web_user_logged_in()  ) { ?>

your code

} ?>

Title: Re: Hide Phone Number + name IF user is not logged in
Post by: ben_dchost1 on June 26, 2014, 01:03:20 pm
add this before the field and don't forget to close the bracket after the field

<?php if ( osc_is_web_user_logged_in()  ) { ?>

your code

} ?>

Works perfectly! If anyone has a similar issue, this is how the code should look if you want to hide contact form to non-logged in users:
file: oc-content\themes\modern\inc.search.php

Code:
<div class="has-icon author">                                    
 <?php if( osc_item_user_id() != null && osc_is_web_user_logged_in()  ){ ?>
   <div class="ico-author ico"></div>
        <?php echo osc_item_contact_name(); ?>
<?php } ?>
<div class="mini">
        <?php if( osc_item_show_email() ) { ?>
        <?php echo osc_item_contact_email(); ?>
<?php } ?>
         <?php if ( osc_user_phone(osc_item_user_id()) != '' && osc_is_web_user_logged_in()  ) { ?>
         <?php _e("Tel", 'realestate'); ?>.: <?php echo osc_user_phone() ; ?>
<?php } ?>
</div>

Lines 236