Title: eVersatile's Replies | WordPress.org

---

# eVersatile

  [  ](https://wordpress.org/support/users/eversatile/)

 *   [Profile](https://wordpress.org/support/users/eversatile/)
 *   [Topics Started](https://wordpress.org/support/users/eversatile/topics/)
 *   [Replies Created](https://wordpress.org/support/users/eversatile/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/eversatile/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/eversatile/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/eversatile/engagements/)
 *   [Favorites](https://wordpress.org/support/users/eversatile/favorites/)

 Search replies:

## Forum Replies Created

Viewing 15 replies - 1 through 15 (of 21 total)

1 [2](https://wordpress.org/support/users/eversatile/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/eversatile/replies/page/2/?output_format=md)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Advanced Order Export For WooCommerce] Add Custom Field](https://wordpress.org/support/topic/add-custom-field-9/)
 *  Thread Starter [eVersatile](https://wordpress.org/support/users/eversatile/)
 * (@eversatile)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/add-custom-field-9/#post-9031963)
 * Excellent.
    That code snippet did accomplish the task. Thank you for your help,
   and enjoy your day.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Advanced Order Export For WooCommerce] Add Custom Field](https://wordpress.org/support/topic/add-custom-field-9/)
 *  Thread Starter [eVersatile](https://wordpress.org/support/users/eversatile/)
 * (@eversatile)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/add-custom-field-9/#post-9031893)
 * I’ve tried modifying the sample codes, but I don’t think it’s quite what I’m 
   looking for…
    I have opened a ticket ‘#38’ in the HelpDesk and attached 2 images,
   showing asample of what I’d like to export. It’s basically another the id of 
   the field would be ‘order_fee_ine_items’ with class ‘fee’.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Beautiful taxonomy filters] Arrange Filters](https://wordpress.org/support/topic/arrange-filters/)
 *  Thread Starter [eVersatile](https://wordpress.org/support/users/eversatile/)
 * (@eversatile)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/arrange-filters/#post-9003561)
 * Thank you. That did work.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Beautiful taxonomy filters] Arrange Filters](https://wordpress.org/support/topic/arrange-filters/)
 *  Thread Starter [eVersatile](https://wordpress.org/support/users/eversatile/)
 * (@eversatile)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/arrange-filters/#post-8996586)
 * I’ve looked through the documents and tried your suggestion but still can not
   get it to work like I’m wanting.
    Here is a link to the page in question. [https://bookpressed.com/pro_con/](https://bookpressed.com/pro_con/)
   nder the ‘Levels’ filter, I wold like to change the order to ‘Beginner, Intermediate,
   Advanced’.
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Timer on Posts](https://wordpress.org/support/topic/timer-on-posts/)
 *  Thread Starter [eVersatile](https://wordpress.org/support/users/eversatile/)
 * (@eversatile)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/timer-on-posts/#post-8876215)
 * I believe you are most likely correct, but I am having trouble on figuring out
   how to fix it.
    I added `<?php if(!isset($_SESSION)){ session_start(); echo session_id();}?
   >` to check for the session ID when I reload the page. The session ID changes
   every time I reload. How can I keep the session going? Along with a new session
   created when a new post is created? I imagine the best way to go would be to 
   create one session for each post and keep it on there for 30 days….
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Timer on Posts](https://wordpress.org/support/topic/timer-on-posts/)
 *  Thread Starter [eVersatile](https://wordpress.org/support/users/eversatile/)
 * (@eversatile)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/timer-on-posts/#post-8875163)
 * I have put together the following code, though it is resetting everytime I reload
   the page.
    Do you know how I could prevent the timer from resetting?
 *     ```
       <?php
       session_start();
       $timestamp = time();
       $diff = 86400;
   
       $hld_diff = $diff;
       if(isset($_SESSION['ts'])) {
       	$slice = ($timestamp - $_SESSION['ts']);	
       	$diff = $diff - $slice;
       }
   
       if(!isset($_SESSION['ts']) || $diff > $hld_diff || $diff < 0) {
       	$diff = $hld_diff;
       	$_SESSION['ts'] = $timestamp;
       }
   
       $diff; //$diff holds seconds less than 3600 (1 hour);
   
       $hours = floor($diff / 3600) . ' : ';
       $diff = $diff % 3600;
       $minutes = floor($diff / 60) . ' : ';
       $diff = $diff % 60;
       $seconds = $diff;
   
       ?>
       <div id="strclock">Clock Here!</div>
       <script type="text/javascript">
        var hour = <?php echo floor($hours); ?>;
        var min = <?php echo floor($minutes); ?>;
        var sec = <?php echo floor($seconds); ?>
   
       function countdown() {
        if(sec <= 0 && min > 0) {
         sec = 59;
         min -= 1;
        }
        else if(min <= 0 && sec <= 0) {
         min = 0;
         sec = 0;
        }
        else {
         sec -= 1;
        }
   
        if(min <= 0 && hour > 0) {
         min = 59;
         hour -= 1;
        }
   
        var pat = /^[0-9]{1}$/;
        sec = (pat.test(sec) == true) ? '0'+sec : sec;
        min = (pat.test(min) == true) ? '0'+min : min;
        hour = (pat.test(hour) == true) ? '0'+hour : hour;
   
        document.getElementById('strclock').innerHTML = hour+":"+min+":"+sec;
        setTimeout("countdown()",1000);
        }
        countdown();
       </script>
       ```
   
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Timer on Posts](https://wordpress.org/support/topic/timer-on-posts/)
 *  Thread Starter [eVersatile](https://wordpress.org/support/users/eversatile/)
 * (@eversatile)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/timer-on-posts/#post-8866233)
 * Thank you for the information.
    The timer does not have to be 100% accurate. 
   Just a ‘post before this date’. I have already created an event to change the
   post from draft to ‘pending’ if they do not ‘publish’ by the end of that date.
   Though, I have not figured out a way to start a visual timer once the post is
   saved as a draft.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Change Status after Comments](https://wordpress.org/support/topic/change-status-after-comments/)
 *  Thread Starter [eVersatile](https://wordpress.org/support/users/eversatile/)
 * (@eversatile)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/change-status-after-comments/#post-8398523)
 * I got it to work using this snippet
 *     ```
       add_action( 'comment_post', 'wpse_make_private_after_3_comments', 10, 2 );
   
       function wpse_make_private_after_3_comments( $comment_ID, $comment_approved ) {
           $comment = get_comment( $comment_ID );
           $post_ID = $comment->comment_post_ID;
           $comments = wp_count_comments( $post_ID );
   
           // You could also access approved, moderated, spam or trashed comments
           // from the return object of wp_count_comments().
   
           $comment_count = $comments->total_comments;
   
           // If we only have 1 or 2 comments, we'll bail early
           if ( $comment_count < 3 ) {
               return;
           }
   
           $post_data = array(
               'ID' => $post_ID,
               'post_status' => 'private'
           );
   
           wp_update_post( $post_data );
   
           // You might want to add a wp_redirect() here to 
           // so people don't automatically see a 404 page 
           // when the comment saving is complete since the page will be private.
       }
       ```
   
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Change Status after Comments](https://wordpress.org/support/topic/change-status-after-comments/)
 *  Thread Starter [eVersatile](https://wordpress.org/support/users/eversatile/)
 * (@eversatile)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/change-status-after-comments/#post-8384374)
 * I am still working on this..
    Now I have this code
 *     ```
       add_action( 'comment_post', 'wpse_make_private_after_3_comments', 10, 2 );
   
       function wpse_make_private_after_3_comments( $comment_ID, $comment_approved ) {
           $comment = get_comment( $comment_ID );
           $post_ID = $comment['comment_post_ID'];
           $comment_count = wp_count_comments( $post_ID );
   
           // If we only have 1 or 2 comments, we'll bail early
           if ( $comment_count < 3 ) {
               return;
           }
   
           $post_data = array(
               'ID' => $post_ID,
               'post_status' => 'private'
           );
   
           wp_update_post( $post_data );
   
           // You might want to add a wp_redirect() here to 
           // so people don't automatically see a 404 page 
           // when the comment saving is complete since the page will be private.
       }
       ```
   
 * but after submitting a comment I get this error ‘Fatal error: Cannot use object
   of type WP_Comment as array’
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Change Status after Comments](https://wordpress.org/support/topic/change-status-after-comments/)
 *  Thread Starter [eVersatile](https://wordpress.org/support/users/eversatile/)
 * (@eversatile)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/change-status-after-comments/#post-8331192)
 * I have kind of figured something out but it’s not working like I want it to.
   
   Added completely new code to functions.php
 *     ```
       global $post;
       $args = array( 'post_id' => $post->ID );
       $comment = get_comments( $args );
       if ( 3 <= count( $comment ) ){
             $post = array( 'ID' => '1015', 'post_status' => 'private' );
       wp_update_post($post);
       } else {
       //blank
       }
       ```
   
 * What that should do, as far as I know, is change the status to private after 
   post 1015 receives 3 comments. What it is doing, is changing post 1015, even 
   without comments.
    Why is it not picking up if it has 3 comments or any at all
   and changing it anyways? Also, I would actually like for it to work with all 
   posts, I used 1015 as a test.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Change Status after Comments](https://wordpress.org/support/topic/change-status-after-comments/)
 *  Thread Starter [eVersatile](https://wordpress.org/support/users/eversatile/)
 * (@eversatile)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/change-status-after-comments/#post-8309779)
 * Ok. I get what you are saying and it really does help but it does not solve the
   problem. I don’t have a code to change the status, that is what I really need
   help with. I don’t know what to use to change the status.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Change Status after Comments](https://wordpress.org/support/topic/change-status-after-comments/)
 *  Thread Starter [eVersatile](https://wordpress.org/support/users/eversatile/)
 * (@eversatile)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/change-status-after-comments/#post-8309183)
 * I have tried using that filter different ways and it never worked. There’s nothing
   in wp_insert_comment that’ll change the status of the post….. could you elaborate
   a little?
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Change Status after Comments](https://wordpress.org/support/topic/change-status-after-comments/)
 *  Thread Starter [eVersatile](https://wordpress.org/support/users/eversatile/)
 * (@eversatile)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/change-status-after-comments/#post-8308971)
 * I have tried using that codex to accomplish what I am trying to do but have not
   come up with a solution yet.
    I have also tried using the information at [THIS LINK](http://wordpress.stackexchange.com/questions/20729/easiest-way-to-make-post-private-by-default)
   Though, I am starting to think I may be able to accomplish this using a existing
   code I have made on the site. The current code is
 *     ```
       global $post,$current_user;
       $args = array( 'post_id' => $post->ID );
       $comment = get_comments( $args );
         get_currentuserinfo();
         if ($post->post_author == $current_user->ID && 3 <= count( $comment ) ){
           echo do_shortcode( '[button]' );
       } elseif ( 3 <= count( $comment ) ) {
       //blank
       } else {
           comment_form();
       }
       ```
   
 * Would I be able to hook into something under ‘elseif’ to change the post to private?
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Change Status after Comments](https://wordpress.org/support/topic/change-status-after-comments/)
 *  Thread Starter [eVersatile](https://wordpress.org/support/users/eversatile/)
 * (@eversatile)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/change-status-after-comments/#post-8307277)
 * I have actually created a custom status called ‘archive’ it kind of works like‘
   draft’. Though after further testing, I now know this is not going to work for
   me.
    I would actually like to change it to a ‘private’ post after it receives
   a comment.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Multiple if statements issue](https://wordpress.org/support/topic/multiple-if-statements-issue/)
 *  Thread Starter [eVersatile](https://wordpress.org/support/users/eversatile/)
 * (@eversatile)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/multiple-if-statements-issue/#post-8304694)
 * After a ton of playing around with the code, I have found the solution.
 *     ```
       global $post,$current_user;
       $args = array( 'post_id' => $post->ID );
       $comment = get_comments( $args );
         get_currentuserinfo();
         if ($post->post_author == $current_user->ID ) {
           echo do_shortcode( '[button]' );
       } elseif ( 3 <= count( $comment ) ) {
       // blank
       } else {
           comment_form();
       }
       ```
   

Viewing 15 replies - 1 through 15 (of 21 total)

1 [2](https://wordpress.org/support/users/eversatile/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/eversatile/replies/page/2/?output_format=md)