Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1084553

    Omid
    Participant

    Hi,

    When I open Cornerstone I see these alerts :

    Notice: Trying to get property of non-object in /home/foo/public_html/wp-includes/comment-template.php on line 28

    Notice: Trying to get property of non-object in /home/foo/public_html/wp-includes/comment-template.php on line 46

    Notice: Trying to get property of non-object in /home/foo/public_html/wp-includes/comment-template.php on line 97

    Notice: Trying to get property of non-object in /home/foo/public_html/wp-includes/comment-template.php on line 97

    Notice: Trying to get property of non-object in /home/foo/public_html/wp-includes/comment-template.php on line 296

    Notice: Trying to get property of non-object in /home/foo/public_html/wp-includes/comment-template.php on line 296

    Notice: Trying to get property of non-object in /home/foo/public_html/wp-includes/comment-template.php on line 309

    and when I publish new posts, all of those alerts there are in published posts but I do not see them in previous (old) published posts.

    Could you please guide me to remove them?

    P.S : debug-mode is on but I do not prefer to turn it off 😉

    Thank you in advance.
    Omid

    #1084554

    Omid
    Participant
    This reply has been marked as private.
    #1084781

    Christian
    Moderator

    Hey Omid,

    We’re sorry but we could not help in this case. Please turn off debugging as that is also recommended for live sites.

    Thanks.

    #1086295

    Omid
    Participant

    Hi,

    I can not turn off debug mode now because I am testing some other plugins. Please kindly help me with that.

    Kind Regards
    Omid

    #1086470

    Darshana
    Moderator

    Hi there,

    PHP notices you can ignore using your method. However to avoid these notices, make sure that you’re running PHP version v5.6 or above as WordPress recommends it.

    You can ask your hosting provider to update it for you.

    Thanks!

    #1087169

    Omid
    Participant

    Hi Darshana,

    The version is 5.6 already. Any other idea?

    Kind Regards

    #1087511

    Jade
    Moderator

    Hi Omid,

    As much as we want to help you on this, unfortunately it goes beyond the support we can offer because as you can see in the warning messages it is from the core file of WordPress. Thanks for understanding.

    #1088125

    Omid
    Participant

    Hi Jade,

    I found this issue is related to my child-theme because when I switch from x-child theme to X theme, those alerts disappear.

    This is wp-comments.php content :

    <?php
    
    // =============================================================================
    // VIEWS/ICON/WP-COMMENTS.PHP
    // -----------------------------------------------------------------------------
    // The area of the page that contains both current comments and the comment
    // form. The actual display of comments is handled by a callback to
    // x_comment().
    // =============================================================================
    
    ?>
    
    <?php
    
    //
    // 1. If the current post is protected by a password and the visitor has not
    //    yet entered the password, we will return early without loading the
    //    comments.
    //
    
    if ( post_password_required() )
      return; // 1
    
    ?>
    
    <div id="comments" class="x-comments-area">
    
      <?php if ( have_comments() ) : ?>
       <?php
    //The author of current post
    $author_ID = get_the_author_meta("ID");
    //The current post ID
    $p_ID = get_the_ID();
      ?>
    
        <h2 class="h-comments-title"><span><?php _e( 'Comments' , '__x__' ); ?> <small><?php 
        //Number of guest comments
        echo ztjalali_persian_num(number_format_i18n(count(get_comments(array('post_id' => $p_ID,'author__not_in' => array($author_ID))))));
         ?></small></span></h2>
        <ol class="x-comments-list">
          <?php
          wp_list_comments( array(
            'callback' => 'x_icon_comment',
            'style'    => 'ol'
          ) );
          ?>
        </ol>
    
        <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
        <nav id="comment-nav-below" class="navigation" role="navigation">
          <h1 class="visually-hidden"><?php _e( 'Comment navigation', '__x__' ); ?></h1>
          <div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', '__x__' ) ); ?></div>
          <div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', '__x__' ) ); ?></div>
        </nav>
        <?php endif; ?>
    
        <?php if ( ! comments_open() && get_comments_number() ) : ?>
        <p class="nocomments"><?php _e( 'Comments are closed.' , '__x__' ); ?></p>
        <?php endif; ?>
    
      <?php endif; ?>
    
      <?php
      ob_start(); cs_print_smilies(); $cs_print_smilies = ob_get_clean();
      comment_form( array(
        'comment_notes_before' => '',
        'comment_notes_after'  => '',
        'id_submit'            => 'entry-comment-submit',
        'label_submit'         => __( 'Submit' , '__x__' ),
        'title_reply'          => __( '<span>Leave a Comment</span>' , '__x__' ),
        'fields'               => array(
          'author' =>
            '<p class="comment-form-author">' .
             
              '<input id="author" name="author" type="text" value="' . get_comment_author()  . '" placeholder="' . __( 'Name *', '__x__' ) . ' ' . '" size="30"/>' .
            '</p>',
          'email'  =>
            '<p class="comment-form-email">' .
              
              '<input id="email" name="email" type="email" aria-required="true" aria-invalid="false" value="' .get_comment_author_email() . '" placeholder="' . __( 'Email *', '__x__' ) . ' ' . '" size="30"/>' .
            '</p>',
          'url'    =>
            '<p class="comment-form-url">' .
              
              '<input id="url" name="url" type="text" value="' . get_comment_author_url() . '" placeholder="' . __( 'URL', '__x__' ) . '" size="30" />' .
            '</p>'
        ),
        'comment_field' => '<p class="comment-form-comment">' .
                             '</br>'.
                              $cs_print_smilies .
                             '<textarea id="comment" name="comment" cols="45" rows="4" placeholder="' . _x( 'Comment *', 'noun', '__x__' ) . '" aria-required="true"></textarea>' .
                           '</p>'
    
      ) );
      ?>
    
    </div>

    Is there any conflict or bad coding within it?

    Thanks in advance,
    Omid

    #1088404

    Paul R
    Moderator

    Hi Omid,

    Regretfully, this particular customization request is outside the scope of our support as this is not related to an issue with the theme and instead has to do with your customization of it. As such, you will need to investigate this particular issue on your own or seek help from a developer should you not feel comfortable making these changes yourself. If you have any further questions about the theme, we are more than happy to provide you with assistance on these inquiries.

    Thank you for your understanding.

    #1088902

    Omid
    Participant

    Hi Paul,

    I encountered with some errors after upgrading to 4.5.2.Of course I used your kind assistance to solve them :
    https://community.theme.co/forums/topic/missing-some-variables-and-indexes-after-upgrade-to-4-5-2/

    Today I found still there are some problems with wp-comments.php and that is why I need your help because most of customizations of that file is provided by your team over last year.

    Kind Regards
    Omid

    #1089541

    Rue Nel
    Moderator

    Hello Omid,

    Thanks for the updates! Can you confirm that you are using this content in your custom template?

    <?php
    
    // =============================================================================
    // VIEWS/ICON/WP-COMMENTS.PHP
    // -----------------------------------------------------------------------------
    // The area of the page that contains both current comments and the comment
    // form. The actual display of comments is handled by a callback to
    // x_comment().
    // =============================================================================
    
    ?>
    
    <?php
    
    //
    // 1. If the current post is protected by a password and the visitor has not
    //    yet entered the password, we will return early without loading the
    //    comments.
    //
    
    if ( post_password_required() )
      return; // 1
    
    ?>
    
    <div id="comments" class="x-comments-area">
    
      <?php if ( have_comments() ) : ?>
    
        <h2 class="h-comments-title"><span><?php _e( 'Comments' , '__x__' ); ?> <small><?php echo number_format_i18n( get_comments_number() ); ?></small></span></h2>
        <ol class="x-comments-list">
          <?php
          wp_list_comments( array(
            'callback' => 'x_icon_comment',
            'style'    => 'ol'
          ) );
          ?>
        </ol>
    
        <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
        <nav id="comment-nav-below" class="navigation" role="navigation">
          <h1 class="visually-hidden"><?php _e( 'Comment navigation', '__x__' ); ?></h1>
          <div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', '__x__' ) ); ?></div>
          <div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', '__x__' ) ); ?></div>
        </nav>
        <?php endif; ?>
    
        <?php if ( ! comments_open() && get_comments_number() ) : ?>
        <p class="nocomments"><?php _e( 'Comments are closed.' , '__x__' ); ?></p>
        <?php endif; ?>
    
      <?php endif; ?>
    
      <?php
      comment_form( array(
        'comment_notes_after' => '',
        'id_submit'           => 'entry-comment-submit',
        'label_submit'        => __( 'Submit' , '__x__' )
      ) );
      ?>
    
    </div>

    This doesn’t display any PHP notices in our testing server. We always do debugging before release any updates.

    #1089574

    Omid
    Participant

    Hey Rue Nel,

    No, I am using ETHOS view sample instead because I needed some customization based on this thread:

    https://community.theme.co/forums/topic/adding-custom-function-above-comment-textarea/

    and I did not have any problem with it before upgrading to 4.5.2 .

    Thanks!

    #1089685

    Rue Nel
    Moderator

    Hello There,

    Could please post the contents of your template file? We want to inspect the code. Just an addition, all those messages are simply PHP notices. This doesn’t have any major impact on the performance of your site. You can get rid of this by disabling the WP_DEBUG mode? You can do this by opening wp-config.php and adding
    define( 'WP_DEBUG' , false ); just above /* That's all, stop editing! Happy blogging. */ For example:

    define('WP_DEBUG', false);
    
    /* That's all, stop editing! Happy blogging. */

    When you revisit the page, you should no longer see the PHP notices.

    Hope this helps.

    #1089731

    Omid
    Participant

    Thanks Rue Nel,

    I am working on some other plugins so I need to keep enable debug mode for a while and with the current status I can’t post new content because those errors will be visible in comment area of new posts.

    What do you mean with the contents of template? If your purpose is wp-comments.php, I have placed it here.

    Regards

    #1089755

    Rue Nel
    Moderator

    Hello There,

    I have checked the code in the template file. I couldn’t tell which line is causing to display the PHP notices. All I know is that these are just PHP notices. And that it will not affect anything from your site. For the meantime, if you could disable the debug mode, then you will see that it will still works. I am sure that these notices will disappear if you revert back to the original code in X.

    As this is all custom development, regretfully we won’t be able to assist further. Taking all of this into consideration, these types of updates are out of the scope of our support as their involvement is simply too great and we are a very small team. While we would love to be able to assist all of our users with every customization request, the simple reality is that we cannot cater to every inquiry. Additionally, we will not be able to support any issues that might arise from modifications made to this area on your own.

    Thank you for your understanding.