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

Олег Котел

  • **
  • 27 posts
  • Західна ТеплоЕнергетична будівельна компанія. Твердопаливні котли, https://t.co/Zwml1cY34U будуємо котельні під ключ!
How can a registered user hide a category?
« on: January 24, 2020, 10:46:35 AM »
As a specific registered user by ("user name" or "user id") in the account when adding an ad, hide a certain category in the drop-down list - for example (hide for a user with ID - 9 category <option value = "4"> Cars </option>).

*

MB Themes

Re: How can a registered user hide a category?
« Reply #1 on: January 24, 2020, 11:41:08 AM »
@Олег Котел
Only option would be to do it via jQuery
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Олег Котел

  • **
  • 27 posts
  • Західна ТеплоЕнергетична будівельна компанія. Твердопаливні котли, https://t.co/Zwml1cY34U будуємо котельні під ключ!
Re: How can a registered user hide a category?
« Reply #2 on: January 24, 2020, 12:05:02 PM »
Can you set an example?
I'm not very good at jQuery.
Thanks.

*

MB Themes

Re: How can a registered user hide a category?
« Reply #3 on: January 24, 2020, 01:45:10 PM »
Code: [Select]
$(".ct option[value='X']").each(function() {
    $(this).remove();
});
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Олег Котел

  • **
  • 27 posts
  • Західна ТеплоЕнергетична будівельна компанія. Твердопаливні котли, https://t.co/Zwml1cY34U будуємо котельні під ключ!
Re: How can a registered user hide a category?
« Reply #4 on: January 24, 2020, 04:12:45 PM »
Thanks for the quick response.

As I understand it, 'X' is the category id, in my case it is "4" (<option value = "4"> Cars </option>). And how to set user id "9" which does not show this field? And where to write it in (functions.php)?

Thanks again!

*

MB Themes

Re: How can a registered user hide a category?
« Reply #5 on: January 26, 2020, 01:57:35 PM »
You put block into PHP condition for user id... if osc_logged_user_id() == 5...
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Олег Котел

  • **
  • 27 posts
  • Західна ТеплоЕнергетична будівельна компанія. Твердопаливні котли, https://t.co/Zwml1cY34U будуємо котельні під ключ!
Re: How can a registered user hide a category?
« Reply #6 on: January 27, 2020, 07:37:30 AM »
I was already confused, I did not understand what the full code should be! If you can, then please complete the full code ...
I will be very grateful.

Marked as best answer by frosticek on January 28, 2020, 07:21:25 AM
*

MB Themes

Re: How can a registered user hide a category?
« Reply #7 on: January 27, 2020, 03:39:49 PM »
Code: [Select]
<?php if(osc_logged_user_id() == 9) { ?>
  <script>
    $(document).ready(function() {
      ... some jquery to remove item ...
    });
  </script>
<?php ?>
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Олег Котел

  • **
  • 27 posts
  • Західна ТеплоЕнергетична будівельна компанія. Твердопаливні котли, https://t.co/Zwml1cY34U будуємо котельні під ключ!
Re: How can a registered user hide a category?
« Reply #8 on: January 28, 2020, 12:58:40 AM »
Thanks a lot, everything works great ...