Unable to hide "Comment From Closed" message on pages

Reports about issues that you encounter in Suffusion. This forum is closed with effect from February 2019. Please post future requests on https://github.com/sayontan/suffusion.
Forum rules
This forum is being officially closed with effect from 3rd February 2019. Future support requests can be posted on the GitHub page at https://github.com/sayontan/suffusion/issues.
JamesKrieger
Posts: 1
Joined: 10 Jul 2010, 09:47

Unable to hide "Comment From Closed" message on pages

Post by JamesKrieger » 10 Jul 2010, 09:51

After upgrading to 3.5.6 of Suffusion, I am no longer able to hide the "Comments form Closed" message on pages, even though these were hidden on previous versions. Here is an example:

http://weightology.net/weightologyweekly/?page_id=7

The appropriate options are checked in Suffusion and Wordpress. This problem did not occur until upgrading to version 3.5.6

sayontan
Site Admin
Posts: 10210
Joined: 15 Sep 2009, 16:39
Location: Houston, Texas
Contact:

Re: Unable to hide "Comment From Closed" message on pages

Post by sayontan » 10 Jul 2010, 11:29

Okay - I guess the massive code rewrite did some damage to the comments file. Here is the fix:
1. First upgrade to 3.5.7 (otherwise you will have worse problems to handle)
2. Open comments.php and look for this block:

Code: Select all

       foreach ($options as $value) {
          if (isset($value['id']) && isset($value['std'])) {
             if (!isset($suffusion_options[$value['id']])) {
                $$value['id'] = $value['std'];
             }
             else {
                $$value['id'] = $suffusion_options[$value['id']];
             }
          }
       }
3. Change it to:

Code: Select all

       foreach ($options as $value) {
          if (isset($value['id'])) {
             if (!isset($suffusion_options[$value['id']]) && isset($value['std'])) {
                $$value['id'] = $value['std'];
             }
             else {
                $$value['id'] = $suffusion_options[$value['id']];
             }
          }
       }

liaroms
Posts: 48
Joined: 11 Apr 2010, 04:55

Re: Unable to hide "Comment From Closed" message on pages

Post by liaroms » 19 Jul 2010, 11:17

Hello, and thank for your new versions of this great Theme. I still can't believe how well this theme is and all the option for Free. Well I made my Donation but you know what I mean. I'm still using it on 2 of my sites, and compared to the commercially bought theme for 99 USD it is fantastic. Take a look and let me know if this could be possible with suffusion, and the right plugins?
http://www.bobs-bbq.com


Now to my problem with http://www.liaroms.com. I noticed after upgrade the comment form closed was showing. I searched and found this thread and copied and pasted the change to the file. But now I have a error showing in the Page at the bottom.

"Warning: Invalid argument supplied for foreach() in /home/bobsbb5/public_html/liaroms.com/wp-content/themes/suffusion/comments.php on line 20"

I can't see the error? Here is the contents of my Comment.php file:

Code: Select all

<?php
/**
 * Threaded comments
 *
 * @package Suffusion
 * @subpackage Templates
 */
?>
<div id="comments">
<?php // Do not delete these lines
	if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME'])) {
        die ('Please do not load this page directly. Thanks!');
    }
	if ( post_password_required() ) { ?>
		<p class="nocomments"><?php _e("This post is password protected. Enter the password to view comments.", "suf_theme");?></p>
		</div> <!-- #comments -->
	<?php
		return;
	}
           foreach ($options as $value) {
              if (isset($value['id'])) {
                 if (!isset($suffusion_options[$value['id']]) && isset($value['std'])) {
                    $$value['id'] = $value['std'];
                 }
                 else {
                    $$value['id'] = $suffusion_options[$value['id']];
                 }
              }
           }

// Begin Comments & Trackbacks
if ( have_comments() ) { ?>
<h3 class="comments">
	<?php printf(__('%1$s to &#8220;%2$s&#8221;', "suf_theme"), comments_number(__('No Responses', "suf_theme"), __('One Response', "suf_theme"), __('% Responses', "suf_theme")), get_the_title($post->ID));?>
</h3>
<?php
	suffusion_split_comments();
//	suffusion_comment_navigation(); // Cannot have comment navigation before listing the comments, because at this point we don't know if we are getting all comments or if we are separating out pingbacks and trackbacks
	suffusion_list_comments();
	suffusion_comment_navigation();
	// End Comments
} ?>

<?php if ('open' == $post->comment_status) : ?>

<div id="respond">

<h3 class="respond"><?php comment_form_title( __('Leave a Reply', "suf_theme"), __('Leave a Reply to %s', "suf_theme") ); ?></h3>

<?php if ( get_option('comment_registration') && !$user_ID ) { ?>
<p><a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>"><?php _e("You must be logged in to post a comment.", "suf_theme");?></a></p>
<?php }
else { ?>

<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
<?php
if ( $user_ID ) {
	$logged_in_url = "<a href=\"".get_option('siteurl')."/wp-admin/profile.php\">".$user_identity."</a>";
	?>

<!--<p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Log out of this account">Log out &raquo;</a></p>-->
<p><?php printf(__('Logged in as %s. ', 'suf_theme'), $logged_in_url); ?>
<a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Log out of this account"><?php _e("Log out","suf_theme");?> &raquo;</a></p>
<?php
}
	else {
		$label_style = $suf_comment_label_styles == "plain" ? "" : " fancy ";
?>

	<p>
	<label for="author" class="<?php echo $label_style; ?>"><?php _e('Name', "suf_theme"); ?></label>
	<input type="text" name="author" id="author" class="textarea" value="<?php echo $comment_author; ?>" size="28" tabindex="1" />
	<?php if ($req) _e('(required)', "suf_theme"); ?>
	</p>

	<p>
	<label for="email" class="<?php echo $label_style; ?>"><?php _e('E-mail', "suf_theme"); ?></label>
	<input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="28" tabindex="2" class="textarea" />
	<?php if ($req) _e('(required)', "suf_theme"); ?>
	</p>

	<p>
	<label for="url" class="<?php echo $label_style; ?>"><?php _e('<acronym title="Uniform Resource Identifier">URI</acronym>', "suf_theme"); ?></label>
	<input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="28" tabindex="3" class="textarea" />
	</p>

	<?php } ?>

	<p>
	<label for="comment" class="textarea <?php if (isset($label_style)) echo $label_style; ?>"><?php _e('Your Comment', "suf_theme"); ?></label>
	<textarea name="comment" id="comment" cols="60" rows="10" tabindex="4" class="textarea"></textarea>
	</p>

<div class="cancel-comment-reply">
	<small><?php cancel_comment_reply_link(); ?></small>
</div>

	<?php comment_id_fields(); ?>
	<?php do_action('comment_form', $post->ID); ?>
	<p>
	<input name="submit" id="submit" type="submit" tabindex="5" value="<?php _e('Submit Comment', "suf_theme"); ?>" class="Cbutton" />
	</p>
</form>
<?php } ?>
</div>
<?php else : // Comments are closed
    $message_disabled = false;
    if (is_page() && $suf_comments_disabled) {
        $disabled_pages = explode(',', $suf_comments_disabled);
        if (is_array($disabled_pages) && count($disabled_pages) > 0 && in_array($post->ID, $disabled_pages)) {
            $message_disabled = true;
        }
    }
    else if (is_singular() && !is_page() && $suf_comments_disabled_msg_for_posts == 'hide'){
        $message_disabled = true;
    }
		if (!$message_disabled) {
?>
<p><?php _e('Sorry, the comment form is closed at this time.', "suf_theme"); ?></p>
<?php
		}
?>
<?php endif; ?>
</div>
I have another problem but for sake of search I will post in a separate Topic

sayontan
Site Admin
Posts: 10210
Joined: 15 Sep 2009, 16:39
Location: Houston, Texas
Contact:

Re: Unable to hide "Comment From Closed" message on pages

Post by sayontan » 19 Jul 2010, 11:35

You copied wrong - you deleted more code than was necessary. Put this line before your "foreach":

Code: Select all

	global $options, $suffusion_options, $post;

liaroms
Posts: 48
Joined: 11 Apr 2010, 04:55

Re: Unable to hide "Comment From Closed" message on pages

Post by liaroms » 19 Jul 2010, 11:57

Duh Me, Thank You for the quick response. It works now.

studentpenet
Posts: 32
Joined: 13 Feb 2010, 04:00
Contact:

Re: Unable to hide "Comment From Closed" message on pages

Post by studentpenet » 19 Jul 2010, 14:00

i had the same problem on my site and i solved it ! Thanks !!! Best wp theme ever ! sayontan you deserve a place in the hall of fame ! Excellent support and great theme ! I can't praise enough the services you provide !

HelpfulThinking
Posts: 13
Joined: 22 Jul 2010, 10:16

Re: Unable to hide "Comment From Closed" message on pages

Post by HelpfulThinking » 23 Jul 2010, 06:35

Hey, I edited my comments.php and pasted the code you said in.

My page comes up with:

Code: Select all

foreach ($options as $value) { if (isset($value['id']) && isset($value['std'])) { if (!isset($suffusion_options[$value['id']])) { $$value['id'] = $value['std']; } else { $$value['id'] = $suffusion_options[$value['id']]; } } }

Sorry, the comment form is closed at this time.
I don't know what I have done wrong here :?

e.g: http://helpfulthinking.co.uk/about

sayontan
Site Admin
Posts: 10210
Joined: 15 Sep 2009, 16:39
Location: Houston, Texas
Contact:

Re: Unable to hide "Comment From Closed" message on pages

Post by sayontan » 23 Jul 2010, 06:37

Are you sure you did the right thing? You had to replace the original code, not add new code.

HelpfulThinking
Posts: 13
Joined: 22 Jul 2010, 10:16

Re: Unable to hide "Comment From Closed" message on pages

Post by HelpfulThinking » 23 Jul 2010, 06:55

I pasted over the old code with the new code.

I'm not sure what I done wrong at all :?

Can you paste up a full version of the comments.php so I can fix my mistake? lol

liaroms
Posts: 48
Joined: 11 Apr 2010, 04:55

Re: Unable to hide "Comment From Closed" message on pages

Post by liaroms » 23 Jul 2010, 07:04

You did backup your original file didn't you?

I made a mistake above as you can see. Be careful and make sure you don't overwrite or take out something more than what is in the boxes.

Locked