Advertisement:

Author Topic: [SOLVED] Count user items for subscription check  (Read 509 times)

betinhosaad

  • Newbie
  • *
  • Posts: 4
[SOLVED] Count user items for subscription check
« on: August 25, 2016, 07:42:11 am »
Hi, I'm trying to count user items and redirect him in case of having more than 10 listings.
Here's what I got so far

/ocs-includes/osclass/controller/item.php

Code: [Select]
            switch( $this->action ) {
                case 'item_add': // post
                    .
                    .
                    .
// count and redirect user

$logged_user = User::newInstance()->findByPrimaryKey(osc_logged_user_id());
$num_items_user = $logged_user['i_items'];
if ($num_items_user > 1){
osc_add_flash_warning_message( _m(' You have reached your limit of listings ') );
$this->redirectTo(osc_base_url(true));
}
                    .
                    .
                    .

Aparently it's not counting.
Please help  :)
« Last Edit: August 25, 2016, 08:02:32 am by betinhosaad »

betinhosaad

  • Newbie
  • *
  • Posts: 4
Re: Count user items for subscription check
« Reply #1 on: August 25, 2016, 08:01:55 am »
Ok, that was a misspelling.
Gonna leave the post in case of someone's need. 8)