Products and published posts

In the marketpress-ms.php file, the query that searches for products in the mp_list_global_products function does not check if the post related to the product has his status set to 'publish'. Wouldn't that be a better behavior ?


  • DavidM
    • DEV MAN’s Mascot

    Hi Cyprien,

    Good question! Strangely, in testing it, non-published, or draft, products, are not displayed when using that function. Not sure where else that might be accounted for, but just to check, have you tried the function on unpublished products? Are you seeing them displayed?


  • Philip John
    • DEV MAN’s Apprentice


    As we haven't heard back from you we're going to assume the problem was sorted out and mark this thread as resolved.

    If it wasn't resolved, or you have any more questions related to this thread please feel free to post them below and tick the 'Mark as Not Resolved (re-open)' box below the post area (or else we'll miss it!)

    Otherwise, thanks for using the forums, and, as always, for being a member of WPMU DEV, it's a pleasure to help you out and we look forward to being of assistance in the future.


  • cyprien
    • Design Lord, Child of Thor

    Hey ! Re-opening this issue 2 months later. I just installed a clean wordpress/marketpress/gridmarket. And i'm having this strange issue on the main page : draft posts are being displayed (as i'm using the Post Expiry plugin, expired products become draft posts). This is very bothering. I checked the code and neither marketpress nor the framemarket template seem to check the post status in the sql query.

    from marketpress-ms.php, mp_list_global_products function :
    "SELECT blog_id, p.post_id, post_permalink, post_title, post_content FROM {$wpdb->base_prefix}mp_products p INNER JOIN {$wpdb->base_prefix}mp_term_relationships r ON = r.post_id INNER JOIN {$wpdb->base_prefix}mp_terms t ON r.term_id = t.term_id WHERE p.blog_public = 1 AND t.type = 'product_category' AND t.slug = '$category'";

    Any clue ?

  • aecnu
    • WP Unicorn

    Greetings cyprien :slight_smile:

    if I understand correctly you are using the Posts Expiry Plugin which is supposed to move your blog posts into another category at a specified time.

    Am I on the right track here?

    But in your application of this plugin thereof, rather then move the product to another category it marks it as draft?

    Several thoughts on this topic:

    Is it probable that the Posts Expiry Plugin is doing this because of the unique way that Market Press handles posts and categories.

    After looking at this Plugin not only does it not have a compatibility rating but its last update was pre-WordPress 3.3

    Integration of this plugin to perform with Market Press and Grid Press is certainly in the Realm of Custom Development and beyond the venue of this forum and should be referred to the custom jobs board for further custom development.

    Joe :slight_smile:

  • cyprien
    • Design Lord, Child of Thor

    Hello Joe. Thanks for your answer but it's not quite what i was waiting for.
    I am not trying to investigate on the Post Expiry Plugin but rather trying to understand why marketpress displays draft posts.


  • Aaron
    • CTO

    Marketpress indexes products in a global table. If you change a post status the proper way to draft it will get deindexed.

    Your plugin must not be using the proper wp functions to change the post status. It needs to be triggering the 'save_post' action as WP does. They probably are just accessing the db directly or something.

  • cyprien
    • Design Lord, Child of Thor

    Hi Aaron !
    Thanks a lot for this answer. I just checked the plugin's code and in fact, it is accessing the db directly. See code below :
    $query = $wpdb->prepare("UPDATE $wpdb->posts SET post_status = 'draft' WHERE ID='$ID'");

    Now i see the importance of compatibility rating :\

    I'll try modify the plugin so that it uses the correct functions.
    Or maybe there is a plugin that works better. Do you happen to know one ? What i need is just a plugin adding a post expiration datetime metabox, and move the expired posts to some tag or status.

    Thanks again,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.