*

bobyrou

  • ****
  • 107 posts
Contact details for registered users only
« on: July 18, 2020, 03:09:51 AM »
Hello, Is it possible to hide seller contact information for non-registered/non-logged-in users?
Currently, even if the user is not logged-in, on clicking the "Show" link full contact details can be seen. I want to restrict this. Meaning it should still show partial information but details can only be seen by registered users. Any help is much appreciated!

P.s. It will be nice if the theme as an ON/OFF button on backend Config page to show Contact details to registered users only.

*

MB Themes

Re: Contact details for registered users only
« Reply #1 on: July 18, 2020, 10:12:33 AM »
You must wrap block that should be shown to logged user only to function osc_is_web_user_logged_in()
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

bobyrou

  • ****
  • 107 posts
Re: Contact details for registered users only
« Reply #2 on: July 18, 2020, 11:41:05 AM »
Hi, I know is in item.php file but I don't know exactly where and the code which I need to change with :-[

*

bobyrou

  • ****
  • 107 posts
Re: Contact details for registered users only
« Reply #3 on: July 18, 2020, 06:45:35 PM »
I tryed the same solution which worked in Veronika theme on item.php but it seems like same solution doesn't work on Gamma theme item.php file.
« Last Edit: July 18, 2020, 08:42:53 PM by bobyrou »

*

bobyrou

  • ****
  • 107 posts
Re: Contact details for registered users only
« Reply #4 on: July 19, 2020, 11:35:58 AM »
Below is the code which I used for Veronika theme in item.php file to get the contact details show for registered users only. But it seems like same solution doesn't work on Gamma theme. If someone please help!

Code: [Select]
<?php if($mobile <> __('No phone number''veronika')) { ?>
          $('.phone-show, .phone-block').click(function(e){
            e.preventDefault();
            var mobile = "<?php echo $mobile?>";

            if($('.phone-block').attr('href') == '#') {
              $('.phone-block, .phone-show').attr('href', 'tel:' + mobile).addClass('shown');
              $('.phone-block span').text(mobile).css('font-weight', 'bold');
              $('#side-right .btn.contact-button .bot').text(mobile);
              $('.phone-show').text("<?php _e('Click to call''veronika'); ?>");

              return false;
            }
          });
        <?php } else { ?>
          $('.phone-show, .phone-block').click(function(){
            return false;
          });
        <?php ?>

replaced with

Code: [Select]
<?php if(osc_is_web_user_logged_in()) { ?>
 
 <?php if($mobile <> __('No phone number''veronika')) { ?>
          $('.phone-show, .phone-block').click(function(e){
            e.preventDefault();
            var mobile = "<?php echo $mobile?>";

            if($('.phone-block').attr('href') == '#') {
              $('.phone-block, .phone-show').attr('href', 'tel:' + mobile).addClass('shown');
              $('.phone-block span').text(mobile).css('font-weight', 'bold');
              $('#side-right .btn.contact-button .bot').text(mobile);
              $('.phone-show').text("<?php _e('Click to call''veronika'); ?>");

              return false;
            }
          });
        <?php } else { ?>
          $('.phone-show, .phone-block').click(function(){
            return false;
          });
        <?php ?>

   <?php } else { ?>
     $('.phone-show').attr('href', '<?php echo osc_user_login_url(); ?>');
                $('.phone-show').text("<?php _e('Only for logged (click to login)''veronika'); ?>");
              <?php ?>

*

bobyrou

  • ****
  • 107 posts
Re: Contact details for registered users only
« Reply #5 on: July 20, 2020, 07:01:22 PM »
If I can't find a solution to this I need to revert back to Veronika theme.

*

MB Themes

Re: Contact details for registered users only
« Reply #6 on: July 21, 2020, 10:51:00 AM »
@bobyrou
Same code will, of course, not work, but you can clearly see idea in your code how to avoid showing phone to unlogged users. If you have no clue about coding, no solution will work for you just to get exact code, line, file, ...
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

bobyrou

  • ****
  • 107 posts
Re: Contact details for registered users only
« Reply #7 on: July 24, 2020, 05:48:27 PM »
To be honest this option should be included in Gamma Theme configurations list.

*

omadmin

  • ***
  • 22 posts
Re: Contact details for registered users only
« Reply #8 on: September 01, 2020, 10:41:34 AM »
To be honest this option should be included in Gamma Theme configurations list.

I try using this in gamma

Code: [Select]
<div class="mobile btn">                                   
        <?php if ( osc_user_phone(osc_item_user_id()) != '' && osc_is_web_user_logged_in()  ) { ?>
         <?php _e(""'Gamma'); ?> <?php echo osc_user_phone() ; ?>
        <?php ?>
        </div>

an Website Specialist