If you want to make the contact informations in your listings only visible for registered user and after an user click a button, you can follow this little guide. It's pretty easy and done in under 5 minutes
File functions.php (in your theme folder)
add this function to the end of the file, right before the closing php tag
function toggle_contact_info() {
if (Params::getParam('toggle_contact_info') == 'show_details') {
echo '<div id="showContact_details">';
// Modify the output for the user details here
if(osc_item_show_email()) {
echo '<p class="email"><i class="fa fa-envelope"></i> '.osc_item_contact_email().'</p>';
}
if (osc_user_phone() != '') {
echo '<p class="phone"><i class="fa fa-phone"></i> '.osc_user_phone().'</p>';
}
// Stop modifying here
echo '</div>';
} else {
echo '
<form id="showContact" action="'.osc_item_url().'#contact" method="post">
<input type="hidden" name="toggle_contact_info" value="show_details" />
<button>'.__('Show contact details', 'hidden-user-info').'</button>
</form>';
echo '
<script>
$(document).ready(function() {
$(document).on("submit", "#showContact", function(event){
event.preventDefault();
var form = $(this),
action = form.attr("action"),
method = form.attr("method"),
data = form.serialize();
$.ajax({
url: action,
type: method,
data: data,
cache: false,
beforeSend: function(data){
$("#showContactInfo").fadeOut("slow");
},
success: function(data){
var source = $("<div>" + data + "<>");
content = source.find("#showContact_details");
$("#showContactInfo").html(content).fadeIn("slow");
}
});
});
});
</script>';
}
}
File item.php or
item-sidebar.php (in your theme folder)
Find the place where the contact details are output, it looks like this
<?php if(osc_item_show_email()) { ?>
<p class="email"><i class="fa fa-envelope"></i><?php printf('%s', osc_item_contact_email()); ?></p>
<?php } ?>
<?php if (osc_user_phone() != '') { ?>
<p class="phone"><i class="fa fa-phone"></i><?php printf('%s', osc_user_phone()); ?></p>
<?php } ?>
Replace it with this code
<?php if (osc_is_web_user_logged_in()) { ?>
<div id="showContactInfo">
<?php toggle_contact_info(); ?>
</div>
<?php } ?>
Now, the contact informations will only shown, if a registered user click the button