Advertisement:

Author Topic: Premium list function help  (Read 366 times)

Pepper

  • Newbie
  • *
  • Posts: 13
Premium list function help
« on: September 28, 2017, 12:31:01 pm »
When a user is logged in to edit their own listing, if listing is not premium i need to echo a true or false

Tried using a few but help needed on this pls

 <?php while(osc_has_premiums() ) { if(osc_premium_is_active() == 1) {
             echo 'true'; }
         else echo 'false';}?>
« Last Edit: September 28, 2017, 12:56:31 pm by Pepper »

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Premium list function help
« Reply #1 on: September 28, 2017, 01:09:11 pm »
Why do you loop with a while if you are editing only one item?

Pepper

  • Newbie
  • *
  • Posts: 13
Re: Premium list function help
« Reply #2 on: September 28, 2017, 01:19:21 pm »
The function is needed if a user is logged in and then he needs to edit an existing listing that is already premium that some html fields is not to be displayed.

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Premium list function help
« Reply #3 on: September 28, 2017, 01:22:15 pm »
osc_item_is_premium() - Gets true if current item is marked premium, else return false

use this with an if not while

Pepper

  • Newbie
  • *
  • Posts: 13
Re: Premium list function help
« Reply #4 on: September 28, 2017, 02:10:55 pm »
Apologies, my changes to code is sometimes not good

 <?php if(osc_premium_is_active() == 1) {
             echo '1true';
          } else {
             echo '0false';
           }?>

premium or not listing returns 0false

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Premium list function help
« Reply #5 on: September 28, 2017, 02:29:37 pm »
try
osc_item_is_premium() - Gets true if current item is marked premium, else return false


Code: [Select]
<?php if(osc_item_is_premium()) {
             echo 
'1true';
          } else {
             echo 
'0false';
           }
?>

Pepper

  • Newbie
  • *
  • Posts: 13
Re: Premium list function help
« Reply #6 on: September 28, 2017, 02:41:23 pm »
Thanks, i see now after you told me osc_item_is_premium

Working as perfectly!