Advertisement:

Author Topic: Help needed: Users can't delete their ads.  (Read 657 times)

zombie

  • Sr. Member
  • ****
  • Posts: 376
Help needed: Users can't delete their ads.
« on: September 12, 2018, 03:10:29 pm »
I noticed users can't delete their ads. Deleting an ad from the user panel results in not deleting the ad and redirecting to search page. Using oslcass 3.1 with nginx. I did not change anything. Possible issue updating php5.6 modules. Any ideas how to solve this?

Aficionado

  • Guest
Re: Help needed: Users can't delete their ads.
« Reply #1 on: September 12, 2018, 05:56:21 pm »
You can start by enabling OSCLASS debug to a LOG and check for possible errors (and post them here).

This seems like a permalinks error though.

zombie

  • Sr. Member
  • ****
  • Posts: 376
Re: Help needed: Users can't delete their ads.
« Reply #2 on: September 14, 2018, 08:34:23 am »
Thank you for your reply. I don't think it is that. No changes were made to the rewrite rules and it used to work properly. I will try to debug as you suggested.

zombie

  • Sr. Member
  • ****
  • Posts: 376
Re: Help needed: Users can't delete their ads.
« Reply #3 on: September 14, 2018, 09:34:26 am »
Hey, I tried debugging and the log was empty. It appears it is the permalinks issue, really. Are there any special rules for nignx?

Aficionado

  • Guest
Re: Help needed: Users can't delete their ads.
« Reply #4 on: September 14, 2018, 10:19:19 am »
Hey, I tried debugging and the log was empty. It appears it is the permalinks issue, really. Are there any special rules for nignx?

I have no idea about nginx but why not disable permalinks for a while and see if this is the real problem ?


zombie

  • Sr. Member
  • ****
  • Posts: 376
Re: Help needed: Users can't delete their ads.
« Reply #5 on: September 14, 2018, 11:13:45 am »
I did. This IS the problem. Was not a problem a couple of months ago. Weird... Since then I only disabled payments because of payments processor change and installed Ad Importer plugin. Also added SSL certificate but I do not see how these interfere with permalinks. Disabling permalinks solves the issue  but I would prefer to keep them. How about making only the delete function without permalinks for temporary solving it. I can't come up with anything else now.

fog

  • Hero Member
  • *****
  • Posts: 1062
Re: Help needed: Users can't delete their ads.
« Reply #6 on: September 15, 2018, 12:48:46 pm »
Hi, check the JS errors on that page. Press F12 to open console / depurator.

The code to delete user account is a direct link, no matters if permalinks is enabled or not. But, exists a javascript function firstly to open a confirmation window (but if exists JS errors on page, can be possible mess up with that, or not).

You can try use the link without use the ID to that confirmation window, just to test  if will delete the user account or not.

Add this line code on user-profile.php file

Code: [Select]
<a href="<?php echo osc_base_url(true).'?page=user&action=delete&id='.osc_user_id().'&secret='.$user['s_secret']; ?>"> Test delete user </a>
You can comment the javascript function too, just in case, to not interfer with that.

If this direct link not working to delete user account, in that case, some plugin not permit the deletion for some special reason. Maybe user have some premium ads actives (paid with payments plugin or other payments system) and  premium time not expired yet?

Create a fake user, login by user and try delete the user account on profile settings to see if will delete or not. Disable your payment plugin too, for test it.

Come back here again to reporte the situation.

Regards

zombie

  • Sr. Member
  • ****
  • Posts: 376
Re: Help needed: Users can't delete their ads.
« Reply #7 on: September 15, 2018, 02:34:41 pm »
Hey, fog! Thanks! it was about deleting ads, not users, but I will need users to be able to delete their profiles, too. I do not have this in modern theme. Let's see what I can do with what you said. I see how it may help!  8)

Maybe I can modify and replace in user-items.php

Code: [Select]
<a class="delete" onclick="javascript:return confirm('<?php echo osc_esc_js(__('This action can not be undone. Are you sure you want to continue?''modern')); ?>')" href="<?php echo osc_item_delete_url();?>" ><?php _e('Delete''modern'); ?></a>
with

Code: [Select]
<a class="delete" onclick="javascript:return confirm('<?php echo osc_esc_js(__('This action can not be undone. Are you sure you want to continue?''modern')); ?>')" href="<?php echo osc_base_url(true).'?page=item&action=delete&id='.osc_item_id().'&secret='.$item['s_secret']; ?>" ><?php _e('Delete''modern'); ?></a>
and this may help users delete their ads. I will give it a try later today.
« Last Edit: September 15, 2018, 02:42:00 pm by zombie »

fog

  • Hero Member
  • *****
  • Posts: 1062
Re: Help needed: Users can't delete their ads.
« Reply #8 on: September 15, 2018, 09:50:24 pm »
Hi zombie, sorry you are right, nothing to do with users, only items.  :D

Yes do that. The code line to link / delete item, is what you posted here. Check with F12 if exists some JS error first on user-items.php file, to not mess up with dialog message to confirm the deletion.

Well, is the right path I think to find the issue, check payment plugin too, can be related with issue. Or create a new test ad (normal ad) without any fee. Or disable payment plugin to test the item deletion.

Let me know what you found in the end.

Regards

zombie

  • Sr. Member
  • ****
  • Posts: 376
Re: Help needed: Users can't delete their ads.
« Reply #9 on: September 15, 2018, 11:15:46 pm »
No errors on the console. It is definitely permalinks. I replaced the default links for edit and delete functions without the secret parameter and it worked. I will let it be this way for now for it works without any further changes. Permalinks should work. There has to be some kind of rule I am missing.

fog

  • Hero Member
  • *****
  • Posts: 1062
Re: Help needed: Users can't delete their ads.
« Reply #10 on: September 15, 2018, 11:44:18 pm »
That strange, the link working without the secret parameter.
Do you checked these values in phpMyAdmin? And payment plugin was disabled too? The ad to delete is normal ad without premium?

Well, if you did all these things, try remember the date when the issue appeared, and if you have a SQL backup, maybe is better you try that backup on a subdomain to test or something. You need be sure with that backup the problem never existed before, otherwise is lost time. If you have a full backup installation with all files, better.

That's why exists the old rule: backup, backup and backup all daily.

I hope you find your solution, with some recently or old backup, is possible you can find where come from the issue: some new plugin installed / uninstalled, or other unexpected situation caused the issue.

Regards