• Hi,

    the functionality of your plugin is working very well when I use it as you intended thank you. I’m using it only on ‘products’.

    temporary login: admin_bbid / b97ev0IUjJPAD*wigW

    When logged in you can add or edit an offer (these are products without the basket). I want the offer to expire on a set date and want this time to trigger the code in your plugin to set the product/offer to ‘draft’. So far I have successfully set the date in the plugin on create/edit using:

    update_post_meta($post_id, ‘_expiration-date’, $dates_to) within my child functions.php.

    I can’t get the functionality to trigger the action of setting the status to ‘draft’. I see you have custom action hooks in your code. Is this what I should be using?

    When I create or edit a product in the backend, the functionality all works beautifully. If I update the end date using the add/edit offer from the logged-in front end, it updates the expiry date, but nothing ever happens regarding the post expiring…

    I was hoping you could point me in the right direction?
    Thank you for your time,
    Naomi

    ————

    function setexpirydate( $post_id ) {
    $dates_to = get_post_meta( $post_id, ‘_end-date’, true );
    $dates_to = strtotime($dates_to);

    $opts = array();

    // Schedule/Update Expiration
    $opts[‘expireType’] = $post_id[‘expirationdate_expiretype’];
    $opts[‘id’] = $post_id;

    if ($opts[‘expireType’] == ‘category’ || $opts[‘expireType’] == ‘category-add’ || $opts[‘expireType’] == ‘category-remove’) {
    if (isset($category) && !empty($category)) {
    if (!empty($category)) {
    $opts[‘category’] = $category;
    $opts[‘categoryTaxonomy’] = $_POST[‘taxonomy-heirarchical’];
    }
    }
    }

    update_post_meta($post_id, ‘_expiration-date’, $dates_to);
    // update_post_meta($post_id, ‘_expiration-date-options’, $opts);
    // update_post_meta($post_id, ‘_expiration-date-status’,’saved’);
    //wp_update_post(array(‘ID’ => $post_id, ‘post_status’ => $expire_type));
    do_action(‘postexpiratior_schedule’, $post_id, $dates_to, $opts);

    }
    add_action(‘wpuf_add_post_after_insert’, ‘setexpirydate’);
    add_action( ‘wpuf_edit_post_after_update’, ‘setexpirydate’ );

    The page I need help with: [log in to see the link]

  • The topic ‘Using your custom action hooks’ is closed to new replies.