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

katalin2k

  • **
  • 27 posts
Report ad just for registered users
« on: November 17, 2024, 01:59:49 PM »
Hello,
How can we make ads reporting be available only to registered users? Moreover I would like to be able to add also a small text describing the issue.
Running on latest version of osclass with zeta theme.

*

MB Themes

Re: Report ad just for registered users
« Reply #1 on: November 17, 2024, 05:25:08 PM »
You mean "mark as ..."?
That is not possible right now. In future updates we plan to redesign this feature.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

katalin2k

  • **
  • 27 posts
Re: Report ad just for registered users
« Reply #2 on: November 17, 2024, 05:46:52 PM »
I made it only work for logged in users, here is my code, I can't add it here because it says it contains external links but it doesn't:

pastecode.io/s/12a8dfbo

*

MB Themes

Re: Report ad just for registered users
« Reply #3 on: November 19, 2024, 09:05:55 PM »
It's not sufficient solution, spam bots already know links so hiding them will not help you.

Here is your code:
Code: [Select]
<?php if (osc_is_web_user_logged_in()) : ?>
  <div class="report-wrap" style="display:none;">
    <div class="head"><?php _e('Report listing''zeta'); ?></div>
    <div class="wrap">
      <div class="line"><?php _e('If you find this listing as inappropriate, offensive, or spammy, please let us know about it.''zeta'); ?></div>
      <div class="line"><strong><?php _e('Select one of the following reasons:''zeta'); ?></strong></div>
     
      <div class="text">
        <a href="<?php echo osc_item_link_spam(); ?>" rel="nofollow" class="btn btn-white"><?php _e('Spam''zeta'); ?></a>
        <a href="<?php echo osc_item_link_bad_category(); ?>" rel="nofollow" class="btn btn-white"><?php _e('Misclassified''zeta'); ?></a>
        <a href="<?php echo osc_item_link_repeated(); ?>" rel="nofollow" class="btn btn-white"><?php _e('Duplicated''zeta'); ?></a>
        <a href="<?php echo osc_item_link_expired(); ?>" rel="nofollow" class="btn btn-white"><?php _e('Expired''zeta'); ?></a>
        <a href="<?php echo osc_item_link_offensive(); ?>" rel="nofollow" class="btn btn-white"><?php _e('Offensive''zeta'); ?></a>
      </div>
     
      <div class="line center"><?php _e('Thanks for helping us!''zeta'); ?></div>
    </div>
  </div>
<?php else : ?>
  <div class="report-wrap" style="display:none;">
    <div class="head"><?php _e('Report listing''zeta'); ?></div>
    <div class="wrap">
      <div class="line"><?php _e('Please log in to report this listing.''zeta'); ?></div>
      <div class="text center">
        <a href="<?php echo osc_user_login_url(); ?>" class="btn btn-primary"><?php _e('Login''zeta'); ?></a>
      </div>
    </div>
  </div>
<?php endif; ?>

<script>
document.querySelector('.report-button').addEventListener('click', function(e) {
    e.preventDefault();
    document.querySelector('.report-wrap').classList.toggle('visible');
});

  document.addEventListener("DOMContentLoaded", function() {
  document.querySelector('.report-wrap').style.display = 'none';
});
</script>
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

Marked as best answer by katalin2k on November 19, 2024, 11:40:00 PM
*

MB Themes

Re: Report ad just for registered users
« Reply #4 on: November 19, 2024, 09:18:42 PM »
If you go to controller/item.php,
find:
Code: [Select]
      case 'mark':

and below add:
Code: [Select]
if(!osc_is_web_user_logged_in()) {
  return false;
}
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

katalin2k

  • **
  • 27 posts
Re: Report ad just for registered users
« Reply #5 on: November 19, 2024, 11:40:09 PM »
If you go to controller/item.php,
find:
Code: [Select]
      case 'mark':

and below add:
Code: [Select]
if(!osc_is_web_user_logged_in()) {
  return false;
}
Thanks!