*

bobyrou

  • ****
  • 111 posts
Reveal phone number to paid members only
« on: February 03, 2025, 11:46:33 PM »
Hi, I use Osclass 8.2.1 and Gamma Theme 1.7.4 - I was wondering where can I disable revealing phone number from listing pages to users which are not paid members. Basically only members who are registered and purchased a membership should have access to contact details. This will help incentivise users to purchase our membership services.
« Last Edit: February 04, 2025, 12:15:06 AM by bobyrou »

*

bobyrou

  • ****
  • 111 posts
Re: Reveal phone number to paid members only
« Reply #1 on: February 04, 2025, 01:07:33 AM »
I have resolved this myself as I see there is no option in Osclass or Gamma theme to have this feature enabled/disabled. I hope Osclasspoint Team are open minded and will consider adding this feature in all themes or even better in osclass.

If anyone is interested for similar feature/solution where you only reveal phone contact numbers to paid members (not just registered)  for more revenues - you just need to edit item.php in theme file, by replacing few lines in two places on page - (Gamma theme 1.7.4):

1) Replace lines:
Code: [Select]
$mobile_login_required = false;
    if(osc_item_show_phone() == 0) {
      $mobile = __('No phone number', 'gamma');
      $mobile_found = false;
    } else if(osc_get_preference('reg_user_can_see_phone', 'osclass') == 1 && !osc_is_web_user_logged_in() && strlen(trim($mobile)) >= 4) {
      $mobile = __('Login to see phone number', 'gamma');
      $mobile_found = true;
      $mobile_login_required = true;
    } else if(trim($mobile) == '' || strlen(trim($mobile)) < 4) {
      $mobile = __('No phone number', 'gamma');
      $mobile_found = false;
    } 
    $has_cf = false;

with these lines:
Code: [Select]
$mobile_login_required = false;
$is_membership = true;
    if(osc_item_show_phone() == 0) {
      $mobile = __('No phone number', 'gamma');
    $is_membership = $mobile_found = false;
    } else if(osc_get_preference('reg_user_can_see_phone', 'osclass') == 1 && !osc_is_web_user_logged_in() && strlen(trim($mobile)) >= 4) {
      $mobile = __('Login to see phone number', 'gamma');
      $mobile_found = true;
      $mobile_login_required = true;
    } else if(trim($mobile) == '' || strlen(trim($mobile)) < 4) {
      $mobile = __('No phone number', 'gamma');
      $is_membership = $mobile_found = false;
    }
if(osc_is_web_user_logged_in() && osp_get_user_group(osc_logged_user_id()) == 0) {
$mobile = 'no membership';
$is_membership = false;
}
   $has_cf = false;

2) Next replace lines:
Code: [Select]
<?php if($mobile_found) { ?>
<?php if($mobile_login_required) { ?>
<a href="<?php echo osc_user_login_url(); ?>" class="mobile btn login-required" data-phone="" title="<?php echo osc_esc_html(__('Login to show number''gamma')); ?>">
<svg viewBox="0 0 32 32" width="24" height="24"><defs><path id="mbIconCall" d="M15.466 21.406l5.32-1.401 5.64 8.054-.402.573a8.281 8.281 0 01-2.04 2.02c-1.422.995-2.976 1.494-4.61 1.494-1.428 0-2.916-.38-4.433-1.142-3.098-1.554-6.28-4.645-9.46-9.187C2.302 17.275.487 13.227.085 9.786-.34 6.17.845 3.273 3.506 1.409A8.287 8.287 0 016.103.183L6.78 0l5.64 8.055-3.136 4.52 6.184 8.83zm7.37 7.607a6.501 6.501 0 001.123-.991l-4.011-5.728-5.32 1.4L6.845 12.58l3.136-4.52L5.97 2.332a6.475 6.475 0 00-1.317.716c-2.05 1.436-2.92 3.625-2.584 6.506.363 3.108 2.062 6.849 5.05 11.116 2.987 4.267 5.92 7.143 8.718 8.547 2.594 1.302 4.947 1.232 6.999-.204zm-7.325-12.865a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm6 0a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm6-3a1.5 1.5 0 110 3 1.5 1.5 0 010-3z"></path></defs><use fill="currentColor" xlink:href="#mbIconCall" fill-rule="evenodd" transform="translate(1)"></use></svg>
<span><?php echo osc_esc_html(__('Login to show number''gamma')); ?></span>

With these lines:
Code: [Select]
<?php if($mobile_found) { ?>
<?php if($mobile_login_required || !$is_membership) { ?>
<a href="<?php echo ($mobile_login_required osc_user_login_url() : osc_route_url('osp-membership')); ?>" class="mobile btn login-required" data-phone="" title="<?php echo osc_esc_html(__('Login to show number''gamma')); ?>">
<svg viewBox="0 0 32 32" width="24" height="24"><defs><path id="mbIconCall" d="M15.466 21.406l5.32-1.401 5.64 8.054-.402.573a8.281 8.281 0 01-2.04 2.02c-1.422.995-2.976 1.494-4.61 1.494-1.428 0-2.916-.38-4.433-1.142-3.098-1.554-6.28-4.645-9.46-9.187C2.302 17.275.487 13.227.085 9.786-.34 6.17.845 3.273 3.506 1.409A8.287 8.287 0 016.103.183L6.78 0l5.64 8.055-3.136 4.52 6.184 8.83zm7.37 7.607a6.501 6.501 0 001.123-.991l-4.011-5.728-5.32 1.4L6.845 12.58l3.136-4.52L5.97 2.332a6.475 6.475 0 00-1.317.716c-2.05 1.436-2.92 3.625-2.584 6.506.363 3.108 2.062 6.849 5.05 11.116 2.987 4.267 5.92 7.143 8.718 8.547 2.594 1.302 4.947 1.232 6.999-.204zm-7.325-12.865a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm6 0a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm6-3a1.5 1.5 0 110 3 1.5 1.5 0 010-3z"></path></defs><use fill="currentColor" xlink:href="#mbIconCall" fill-rule="evenodd" transform="translate(1)"></use></svg>
 <span><?php echo ($mobile_login_required 'Show Phone number' 'Show Phone number'); ?></span>

Wish you all the best!

*

MB Themes

Re: Reveal phone number to paid members only
« Reply #2 on: February 04, 2025, 03:29:05 PM »
Thanks for sharing ;)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots