This topic contains a post which is marked as Best Answer. Press here if you would like to see it.
*

nishantpawar

  • ***
  • 24 posts
Disable contact information details for non-registered users
« on: April 03, 2017, 11:37:28 AM »
Hello, Is it possible to hide seller contact information for non-registered or non-logged-in users?
Currently, even if the user is not logged-in, on clicking the "Show" link full 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. The box shows the message correctly but some reason the functionality is not working. Please refer attached image.

*

MB Themes

Re: Disable contact information details for non-registered users
« Reply #1 on: April 03, 2017, 12:32:20 PM »
@nishantpawar
You can wrap them into:
Code: [Select]
<?php if(osc_is_web_user_logged_in()) { ?>
... your code ...
<?php ?>
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

nishantpawar

  • ***
  • 24 posts
Re: Disable contact information details for non-registered users
« Reply #2 on: April 03, 2017, 01:07:46 PM »
@nishantpawar
You can wrap them into:
Code: [Select]
<?php if(osc_is_web_user_logged_in()) { ?>
... your code ...
<?php ?>
Right but that will hide the numbers entirely. Is there any way to partially show them as its is now but the "Show" button action should request users to login? The option of Suffixing with "XXXX" is a good option and I don't want to lose it. Awaiting feedback.

*

MB Themes

Re: Disable contact information details for non-registered users
« Reply #3 on: April 03, 2017, 05:30:03 PM »
It would require much more changes iin item.php that I am not able to check at all.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

bobyrou

  • ****
  • 107 posts
Re: Disable contact information details for non-registered users
« Reply #4 on: April 24, 2017, 12:43:16 PM »
Hi, I am very interested in this also. If someone please advise how to achieve this will be really nice!

*

bobyrou

  • ****
  • 107 posts
Re: Disable contact information details for non-registered users
« Reply #5 on: April 25, 2017, 02:43:44 PM »
It would require much more changes iin item.php that I am not able to check at all.

Hi, I will like to pay you to do this custom work for my website.

*

MB Themes

Re: Disable contact information details for non-registered users
« Reply #6 on: April 25, 2017, 02:53:01 PM »
@bobyrou
In item.php find:
Code: [Select]
            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;
            }


Replace with:
Code: [Select]

            if($('.phone-block').attr('href') == '#') {
              <?php if(osc_is_web_user_logged_in()) { ?>
                $('.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'); ?>");
              <?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 ?>
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

bobyrou

  • ****
  • 107 posts
Re: Disable contact information details for non-registered users
« Reply #7 on: April 25, 2017, 10:31:46 PM »
Hi @frosticek

I tried your solution but doesn't seem to work. The phone number/email doesn't show even if you are logged in.  But allows to send Message to seller even if you are not logged in. Also doesn't show the "Only for logged (click to login)". I think the solution is somewhere there but just needs a bit tweaked to work as it should.

Marked as best answer by frosticek on April 26, 2017, 01:11:58 PM
*

Ivanko

  • *****
  • 391 posts
Re: Disable contact information details for non-registered users
« Reply #8 on: April 26, 2017, 06:59:22 AM »
In item.php find:

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 ?>

replace 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: Disable contact information details for non-registered users
« Reply #9 on: April 26, 2017, 12:44:44 PM »
@Ivanko

Thanks Man, that worked PERFECT!

*

ally

  • ***
  • 33 posts
Re: Disable contact information details for non-registered users
« Reply #10 on: November 18, 2017, 05:48:02 AM »
I tried it on Zara Theme and it shows "Only for logged (click to login)" but if a user login only part of the phone number shows and when you click the show phone number, it doesn't do anything.

Anybody tried this on Zara Theme?


*

MB Themes

Re: Disable contact information details for non-registered users
« Reply #11 on: November 18, 2017, 12:48:05 PM »
If it does not show anything, you have some javascript errors there.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

ally

  • ***
  • 33 posts
Re: Disable contact information details for non-registered users
« Reply #12 on: November 19, 2017, 04:56:27 AM »
How can I fix this  javascript errors? I just bought this Zara Premium Theme 1.2.9 this week and installed it.

*

MB Themes

Re: Disable contact information details for non-registered users
« Reply #13 on: November 19, 2017, 10:03:52 AM »
@ally
This problem is not related to this thread. Create new one, setup google API key.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

ally

  • ***
  • 33 posts
Re: Disable contact information details for non-registered users
« Reply #14 on: November 19, 2017, 06:08:37 PM »
I solved the google map javascript error. I'll post a new topic so member knows how I did if someone encounters this kind of problem.