• Resolved twoshoesas

    (@twoshoesas)


    Hi,
    When ever I delete something from WP Adverts, either a pricing or payment history or ad, several of my items in Media Library are deleted as well. Luckily I have frequent backups, so I was able to revert and only lost a couple hours work.

    But, now I cannot delete anything in WP Adverts without deleting items from my media library. Any idea what this could be and how to solve it?

    Best regards,
    Stian

    https://wordpress.org/plugins/wpadverts/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    hmm when deleting items WPAdverts is doing force delete, that is it removes the add and all data attached to it.

    The only reason why deleting a payment would delete files from media library as well, would be if you previously had in DB post (or custom post) with ID which the payment histor is now using.

    The best way to check it would be to go to phpMyAdmin, and run there following query

    SELECT * FROM wp_posts WHERE post_parent = 1000;

    where 1000 is an actual id of WPAdverts item which deleting would result in deleting media files as well. Now if this query will return some results this means that some of the attachments are incorrectly assigned (to items which no longer exist), if the query will return no results then something else is causing it. Are you using some other plugins on site, aside of WPAdverts?

    Thread Starter twoshoesas

    (@twoshoesas)

    Nope, the query didn’t return any results.

    Yes I’m using a bunch of plugins (of course) 32 to be exact.

    I tried disabling all plugins except WPAdverts and WPAdverts PayPal, still, the same thing happens. When I delete 1 pricing (doens’t matter which one), About 130 of my media are deleted as well. Images and audio files. And it’s the same files being deleted every time, no matter which element I delete in your plugin.

    I’m on WP Engine hosting and I am using the Kleo theme, just FYI.

    Plugin Author Greg Winiarski

    (@gwin)

    Thanks for feedback, i created an alternative version of a file which deletes Pricings and Payments, the file is here https://gist.github.com/gwin/3f6320c29da9ef0d235653268a8ea70d, can you upload it (or rather replace original file) to wpadverts/addons/payments/includes/admin-pages.php and see if this helps?

    If this won’t help, i will prepare an admin-pages.php alternative file with a log file and few more changes, sorry for using you for debugging, but i can’t seem to replicate this behavior on my dev site.

    Thread Starter twoshoesas

    (@twoshoesas)

    Thanks Greg, this seems to have solved the issue. Although when I delete a payment from payment history (1 payment), it says that it has “deleted 122 payments”. But, as far as I can tell, nothing seems to be missing now šŸ™‚

    Plugin Author Greg Winiarski

    (@gwin)

    Thanks for the debug info, i think i was able to pinpoint the problem and have it fixed properly for version 1.0.8, i tested it and the media items are not deleted and number of removed items show fine, however i would apprecieate if you could try the updated code snippet (https://gist.github.com/gwin/3f6320c29da9ef0d235653268a8ea70d) on your site and see if this works for you as well.

    The previous snippet i posted only stopped deleting Pricing and Payments children, in this one correct children should be removed (if any, right now there shouldn’t be any children but i am planning to use this functionality in one of future WPAdverts updates).

    Thread Starter twoshoesas

    (@twoshoesas)

    I have tested it and everything seems to be working perfectly now šŸ™‚

    Quick feature requests:
    It would be great if there would be generated an activity on the activities page of BuddyPress whenever a member posts a new ad.

    Also, perhaps display the expiration date in the ad, and possibly a filter by date?

    Finally I would ask you if the prices could be styled much better, right now they just appear under each other with a bullet (which isn’t very sexy to be honest, hehe). Would be nice if they were styled more aka 2016 šŸ™‚

    I know, ppl can style using CSS if they want. But, not everyone is familiar with CSS. And what’s right out of the box, is always preferred to having to start customizing šŸ™‚

    Plugin Author Greg Winiarski

    (@gwin)

    Ok, great, this will go into next release.

    1. With version 1.0.8 we will release BuddyPress integration which will have an option to post in user activity when new Ad is published.

    2. You can add following code to your theme functions.php file it will show expiration date on Ad details page

    add_action("adverts_tpl_single_details", "tpl_single_details_expiration_date");
    function tpl_single_details_expiration_date( $post_id ) {
        $expires = get_post_meta( $post_id, "_expiration_date", true );
        if( $expires ) {
            $expires_text = __( 'Never', 'adverts' );
        } else {
            $expires_text = date_i18n( 'Y-m-d H:i:s', $expires );
        }
        ?>
        <div class="adverts-grid-row">
            <div class="adverts-grid-col adverts-col-30">
                <span class="adverts-round-icon adverts-icon-clock"></span>
                <span class="adverts-row-title"><?php _e("Expires", "adverts") ?></span>
            </div>
            <div class="adverts-grid-col adverts-col-65">
                <?php echo $expires_text ?>
            </div>
        </div>
        <?php
    }

    3. I am not sure, can you link to some screenshot so i can see how the prices are displayed?

    Thread Starter twoshoesas

    (@twoshoesas)

    The expiration date for all my ads is “Never”, no matter what expiration date they have. Also I noticed something else right now, the profile picture of the ad creator is not displaying, only the “ghost” icon.

    Screen of the profile picture issue and of the ads expires “Never” (“Aldri” in Norwegian):
    https://1drv.ms/i/s!AsxhV6RNvrbIhOlu-zKSoTRnp69jmA

    Screen of the styling of pricing:
    https://1drv.ms/i/s!AsxhV6RNvrbIhOlvA4CP0JeDTKLSHA

    And also, when clicking the categories/choosing categories, there is a drop-down and this drop-down is hanging there. It covers the image upload function, and unless you click away from it, you will not see the image upload function at all. Even when you are finished choosing your categories and move on to the next field, it still stays open. Here is a screen:
    https://1drv.ms/i/s!AsxhV6RNvrbIhOlwE-CR930nYhz13Q

    Plugin Author Greg Winiarski

    (@gwin)

    1. The “if” statment is incorrect just change it to

    if( $expires ) {
            $expires_text = date_i18n( 'Y-m-d H:i:s', $expires );
        } else {
            $expires_text = __( 'Never', 'adverts' );
        }

    2. Since annonymous users can post Ads, on Ad details pages WPAdverts is using Gravatar image associated with user email entered in Create Ad form, not the current user logo image.

    3. Dropdown options hide on blur – that is when you click outside of dropdown.

    4. in version 1.0.8 i am actually planning to change how the pricings will look, so the users will know this is not just a standard input field.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Items Deleted from Media Library’ is closed to new replies.