Advertisement:

Author Topic: New listings are disappearing after 5-10 seconds - help please!  (Read 396 times)

leegriffiths

  • Newbie
  • *
  • Posts: 16
Re: New listings are disappearing after 5-10 seconds - help please!
« Reply #15 on: May 15, 2019, 12:38:20 pm »
Yes, if I make it that anonymous users can then it causes this problem.

I didn't want to make users register to post an advert but it has caused the problem to go away so it must be connected to user type ?

Lee

calinbehtuk

  • Sr. Member
  • ****
  • Posts: 473
Re: New listings are disappearing after 5-10 seconds - help please!
« Reply #16 on: May 15, 2019, 12:53:58 pm »
I can't tell you what is your issue.
If you follow all the steps in replacing the osclass files and you say that you have no changes on your theme or some plugin that allow the delete of items, i can't point you in other direction.

For deletion, you need item id and secret. This is stored in the database so nobody has access to that. Only the publisher, will receive and delete and edit link.

You can try to stop the deletion process for testing purposes.

oc-includes/osclass/controller/item.php
around line 285

Code: [Select]
                case 'item_delete':
                    $secret = Params::getParam('secret');
                   $id     = Params::getParam('id');
exit(); //this code to stop delete

                    $item   = $this->itemManager->listWhere("i.pk_i_id = %d AND ((i.s_secret = %s) OR (i.fk_i_user_id = %d))", (int)($id), $secret, (int)($this->userId));
                    if (count($item) == 1) {
                        $mItems = new ItemActions(false);
                        $success = $mItems->delete($item[0]['s_secret'], $item[0]['pk_i_id']);
                        if($success) {
                            osc_add_flash_ok_message( _m('Your listing has been deleted') );
                        } else {
                            osc_add_flash_error_message( _m("The listing you are trying to delete couldn't be deleted") );
                        }
                        if($this->user!=null) {
                            $this->redirectTo(osc_user_list_items_url());
                        } else {
                            $this->redirectTo( osc_base_url() );
                        }
                    }else{
                        osc_add_flash_error_message( _m("The listing you are trying to delete couldn't be deleted") );
                        $this->redirectTo( osc_base_url() );
                    }
                break;

I break to code after id parameter with exit.
Try to publish an add as non registered user and after that make all the steps that you made before to see if the ad is deleted.
In this way, you can find if this is the path used on delete
« Last Edit: May 15, 2019, 01:03:14 pm by calinbehtuk »

leegriffiths

  • Newbie
  • *
  • Posts: 16
Re: New listings are disappearing after 5-10 seconds - help please!
« Reply #17 on: May 16, 2019, 08:02:40 pm »
Thanks, this is a good idea since I didn't really know where to start on this framework.

I've not had time to try it but will do and report back