• Resolved ziegel

    (@ziegel)


    Hi @jasongreen ,

    Apparently the date presented on a specific form details is different than the one presented on the table of lines of all submissions.

    While the date on the forms submissions table is correct and uses the offset for region as defined on server, the specific date on a specific form submission report shown a date at default UTC time without the offset.

    Possibly there is a usage of two different $dates on contact-form-submissions / Admin.php file.

    On line 336 there is a usage of: ” $date = date_i18n($datef, strtotime($post->post_date)); ?>”

    /**
    * Output for the actions metabox
    */
    public function actions_meta_box($post)
    {
    $datef = __(‘M j, Y @ H:i’);
    $date = date_i18n($datef, strtotime($post->post_date)); ?>
    <div id=”minor-publishing”>

    <div id=”misc-publishing-actions”>
    <div class=”misc-pub-section curtime misc-pub-curtime”>
    <span id=”timestamp”><?php _e(‘Submitted’, ‘contact-form-submissions’); ?> : <b><?php echo $date; ?></b></span>
    </div>
    </div>
    <div class=”clear”></div>
    </div>
    <?php

    }

    While on Line 356 usage of “wpcf7s_posted_values”

    /**
    * Get the posted data for a form
    *
    * @param integer $post_id the form post ID
    *
    * @return array the form values
    */
    public function get_mail_posted_fields($post_id = 0)
    {
    $posted = array();
    $post_meta = get_post_meta($post_id);
    $posted = array_intersect_key(
    $post_meta,
    array_flip(array_filter(array_keys($post_meta), function ($key) {
    return preg_match(‘/^wpcf7s_posted-/’, $key);
    }))
    );

    $posted = apply_filters(‘wpcf7s_posted_values’, $posted);

    return $posted;
    }

    Also possible, there is a failure in retrieving date_default_timezone_set as set one “wp-settings.php”.

    • This topic was modified 4 years, 4 months ago by ziegel.
    • This topic was modified 4 years, 4 months ago by ziegel.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ziegel

    (@ziegel)

    I found a manual temporary fix, which is manipulating a function in the plugin files.

    I still did not find why would the plugin file get the time stamp without the adjustment on server, which is reflected correctly also on CF7 itself.

    The fix is:

    /**
    * Output for the actions metabox
    */
    public function actions_meta_box($post)
    {
    $datef = __(‘M j, Y @ H:i’);
    $date = date_i18n($datef, strtotime( ‘$post->post_date’ . ‘+3’ )); ?>
    <div id=”minor-publishing”>

    <div id=”misc-publishing-actions”>
    <div class=”misc-pub-section curtime misc-pub-curtime”>
    <span id=”timestamp”><?php _e(‘Submitted’, ‘contact-form-submissions’); ?> : <b><?php echo $date; ?></b></span>
    </div>
    </div>
    <div class=”clear”></div>
    </div>
    <?php

    }

    Thread Starter ziegel

    (@ziegel)

    Ok..

    This fixed it for the specific need:
    $date = date_i18n($datef, strtotime($post->_date)); ?>

    HOWEVER
    I think additional places on my code (mPDF PDF generation?) are fetching wrong time, before time zone adjustment, from the CF7 plugin generated data.

    Note
    Problem seems to be in “$post->post_date” of CF7.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘CF7 Specific Form Submission Report uses wrong $date time’ is closed to new replies.