Korey's Wordpress Plugins Forums Forum Index Korey's Wordpress Plugins Forums
Home of Lazy-K Gallery
 
 FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Korey's Wordpress Plugins Site

Enable per-picture commenting

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Korey's Wordpress Plugins Forums Forum Index -> Installation/Configuration Issues
View previous topic :: View next topic  
Author Message
Monique



Joined: 04 Mar 2007
Posts: 12
Location: The Netherlands

PostPosted: Fri Mar 16, 2007 2:07 am    Post subject: Enable per-picture commenting Reply with quote

Now I only have the option to commenting on the root folder of my gallery. Every other gallery will show the comments of the root folder.

I want to enable commenting on each image/folder individually. You say that I have to edit the comments.php of my theme. I'm using the k2 theme, but I'm not sure what I have to edit. I think it's line 13 which needs to be edit?

My comments.php:
Code:
<?php
   // Do not access this file directly
   if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME'])) { die (__('Please do not load this page directly. Thanks!','k2_domain')); }

   // Password Protection
   if (!empty($post->post_password)) { if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) {
?>

   <p class="nopassword"><?php _e('This post is password protected. Enter the password to view comments.','k2_domain'); ?></p>

<?php return; } } ?>

   <?php if (($comments) or ('open' == $post->comment_status)) : $shownavigation = 'yes'; ?>

   <div class="comments">

      <h4><?php printf(__('%1$s %2$s to “%3$s”','k2_domain'), '<span id="comments">' . get_comments_number() . '</span>', (1 == $post->comment_count) ? __('Response','k2_domain'): __('Responses','k2_domain'), the_title('', '', false)); ?></h4>

      <div class="metalinks">
         <span class="commentsrsslink"><?php comments_rss_link(__('Feed for this Entry','k2_domain')); ?></span>
         <?php if ('open' == $post->ping_status) { ?><span class="trackbacklink"><a href="<?php trackback_url(); ?>" title="<?php _e('Copy this URI to trackback this entry.','k2_domain'); ?>"><?php _e('Trackback Address','k2_domain'); ?></a></span><?php } ?>
      </div>

      <?php /* Seperate comments and pings */
         if ( $post->comment_count > 0 ) {
            $countComments = 0;
            $countPings    = 0;
            
            $k2_comment_list = array();
            $k2_ping_list    = array();

            foreach ($comments as $comment) {
               if ( 'comment' == get_comment_type() ) {
                  $k2_comment_list[++$countComments] = $comment;
               } else {
                  $k2_ping_list[++$countPings] = $comment;
               }
            }
         }
      ?>

   <hr />

      <?php /* Check for comments */ if ( $countComments > 0 ) { ?>
      <ol id="commentlist">

         <?php foreach ($k2_comment_list as $comment_index => $comment) { ?>

         <li id="comment-<?php comment_ID(); ?>" class="<?php k2_comment_class($comment_index); ?>">
            <?php if (function_exists('gravatar')) { ?><a href="http://www.gravatar.com/" title="<?php _e('What is this?','k2_domain'); ?>"><img src="<?php gravatar("X", 32,  get_bloginfo('template_url')."/images/defaultgravatar.jpg"); ?>" class="gravatar" alt="<?php _e('Gravatar Icon','k2_domain'); ?>" /></a><?php } ?>
            <a href="#comment-<?php comment_ID(); ?>" class="counter" title="<?php _e('Permanent Link to this Comment','k2_domain'); ?>"><?php echo $comment_index; ?></a>
            <span class="commentauthor"><?php comment_author_link(); ?></span>

            <small class="comment-meta">
            <?php
               printf('<a href="#comment-%1$s" title="%2$s">%3$s</a>',
                  get_comment_ID(),
                  (function_exists('time_since')?
                     sprintf(__('%s ago.','k2_domain'),
                        time_since(abs(strtotime($comment->comment_date_gmt . " GMT")), time())
                     ):
                     __('Permanent Link to this Comment','k2_domain')
                  ),
                  sprintf(__('%1$s at %2$s','k2_domain'),
                     get_comment_date(__('M jS, Y','k2_domain')),
                     get_comment_time()
                  )
               );
            ?>
            <?php if (function_exists('quoter_comment')) { quoter_comment(); } ?>
            <?php if (function_exists('jal_edit_comment_link')) { jal_edit_comment_link(__('Edit','k2_domain'), '<span class="comment-edit">','</span>', '<em>(Editing)</em>'); } else { edit_comment_link(__('Edit','k2_domain'), '<span class="comment-edit">', '</span>'); } ?>
            </small>
         
            <div class="comment-content">
               <?php comment_text(); ?>
            </div>

            <?php if ('0' == $comment->comment_approved) { ?><p class="alert"><strong><?php _e('Your comment is awaiting moderation.','k2_domain'); ?></strong></p><?php } ?>
         </li>

         <?php } /* End foreach comment */ ?>

      </ol> <!-- END #commentlist -->
      <?php } /* end comment check */ ?>
      
      <?php /* Check for Pings */ if ( $countPings > 0 ) { ?>
      <ol id="pinglist">

         <?php foreach ($k2_ping_list as $ping_index => $comment) { ?>

         <li id="comment-<?php comment_ID(); ?>" class="<?php k2_comment_class($ping_index); ?>">
            <?php if (function_exists('comment_favicon')) { ?><span class="favatar"><?php comment_favicon(); ?></span><?php } ?>
            <a href="#comment-<?php comment_ID() ?>" title="<?php _e('Permanent Link to this Comment','k2_domain'); ?>" class="counter"><?php echo $ping_index; ?></a>
            <span class="commentauthor"><?php comment_author_link(); ?></span>
            <small class="comment-meta">            
            <?php
               printf(__('%1$s on %2$s','k2_domain'),
                  '<span class="pingtype">' . get_k2_ping_type(__('Trackback','k2_domain'), __('Pingback','k2_domain')) . '</span>',
                  sprintf('<a href="#comment-%1$s" title="%2$s">%3$s</a>',
                     get_comment_ID(),   
                     (function_exists('time_since')?
                        sprintf(__('%s ago.','k2_domain'),
                           time_since(abs(strtotime($comment->comment_date_gmt . " GMT")), time())
                        ):
                        __('Permanent Link to this Comment','k2_domain')
                     ),
                     sprintf(__('%1$s at %2$s','k2_domain'),
                        get_comment_date(__('M jS, Y','k2_domain')),
                        get_comment_time()
                     )         
                  )
               );
            ?>            
            <?php if ($user_ID) { edit_comment_link(__('Edit','k2_domain'),'<span class="comment-edit">','</span>'); } ?>
            </small>
         </li>
         <?php } /* end foreach ping */ ?>
      </ol> <!-- END #pinglist -->
      <?php } /* end ping check */ ?>
      
      <?php /* Comments open, but empty */ if ( ($post->comment_count < 1) and ('open' == $post->comment_status) ) { ?>
      <ol id="commentlist">
         <li id="leavecomment">
            <?php _e('No Comments','k2_domain'); ?>
         </li>
      </ol>
      <?php } ?>
      
      <?php /* Comments closed */ if (('open' != $post->comment_status) and is_single()) { ?>
         <div><?php _e('Comments are currently closed.','k2_domain'); ?></div>
      <?php } ?>

   </div> <!-- END .comments 1 -->
      
   <?php endif; ?>
   
   <?php /* Reply Form */ if ('open' == $post->comment_status) { ?>
   <div class="comments">
      <h4 id="respond" class="reply"><?php if (isset($_GET['jal_edit_comments'])) { _e('Edit Your Comment','k2_domain'); } else { _e('Leave a Reply','k2_domain'); } ?></h4>
      
      <?php if (get_option('comment_registration') and !$user_ID) { ?>
      
         <p><?php printf(__('You must <a href="%s">login</a> to post a comment.','k2_domain'), get_option('siteurl') . '/wp-login.php?redirect_to=' . get_permalink()); ?></p>
      
      <?php } else { ?>

         <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">

         <?php
            if ( isset($_GET['jal_edit_comments']) ) {
               $jal_comment = jal_edit_comment_init();

               if (!$jal_comment) {
                  return;
               }
            } elseif ($user_ID) {
         ?>
      
         <p class="comment-login"><?php printf(__('Logged in as %s.','k2_domain'), '<a href="'.get_option('siteurl').'/wp-admin/profile.php">'.$user_identity.'</a>'); ?> <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="<?php _e('Log out of this account','k2_domain'); ?>"><?php _e('Logout','k2_domain'); ?> &raquo;</a></p>
   
      <?php } elseif ('' != $comment_author) { ?>

            <p class="comment-welcomeback"><?php printf(__('Welcome back <strong>%s</strong>','k2_domain'), $comment_author); ?>
            <span id="showinfo">(<a href="javascript:ShowUtils();"><?php _e('Change','k2_domain'); ?></a>)</span>
            <span id="hideinfo">(<a href="javascript:HideUtils();"><?php _e('Close','k2_domain'); ?></a>)</span></p>

      <?php } ?>
         
         <?php if (!$user_ID) { ?>
            <div id="comment-personaldetails">
               <p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" />
               <label for="author"><small><strong><?php _e('Name','k2_domain'); ?></strong> <?php if ($req) { __('(required)','k2_domain'); } ?></small></label></p>

               <p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" />
               <label for="email"><small><strong><?php _e('Mail','k2_domain'); ?></strong> (<?php _e('will not be published','k2_domain'); ?>) <?php if ($req) { __('(required)','k2_domain'); } ?></small></label></p>

               <p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
               <label for="url"><small><strong><?php _e('Website','k2_domain'); ?></strong></small></label></p>
            </div>
         <?php } ?>
            <!--<p><small><?php printf(__('<strong>XHTML:</strong> You can use these tags %s:','k2_domain'), allowed_tags()) ?></small></p>-->
      
            <p><textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4"><?php if (function_exists('jal_edit_comment_link')) { jal_comment_content($jal_comment); }; if (function_exists('quoter_comment_server')) { quoter_comment_server(); } ?></textarea></p>
      
            <?php if (function_exists('show_subscription_checkbox')) { show_subscription_checkbox(); } ?>
            <?php if (function_exists('quoter_page')) { quoter_page(); } ?>

            <p>
               <input name="submit" type="submit" id="submit" tabindex="5" value="<?php _e('Submit','k2_domain'); ?>" />
               <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
            </p>
            
            <div class="clear"></div>

            <?php do_action('comment_form', $post->ID); ?>

         </form>

      <?php } // If registration required and not logged in ?>
      
      <?php if ($shownavigation) { include (TEMPLATEPATH . '/navigation.php'); } ?>
   
   </div> <!-- END .comments #2 -->
   <?php } // comment_status ?>
Back to top
View user's profile Send private message
Korey
Site Admin


Joined: 13 Oct 2006
Posts: 143
Location: United States

PostPosted: Mon Mar 19, 2007 7:37 pm    Post subject: Reply with quote

Monique-

Add the code right before this line:

Code:
<?php if (($comments) or ('open' == $post->comment_status)) : $shownavigation = 'yes'; ?>


Here's the code you need to add.

Code:
<?php if (function_exists('lzk_filter_comments')) {$comments = lzk_filter_comments($comments);} ?>



Let me know if that doesn't work properly and I'll take a second look.
_________________
Korey - Developer of Lazy-K Gallery
Back to top
View user's profile Send private message Visit poster's website
Monique



Joined: 04 Mar 2007
Posts: 12
Location: The Netherlands

PostPosted: Tue Mar 20, 2007 9:15 pm    Post subject: Reply with quote

Thnx for your reply!

I added the code and now it's possible to place comment per subgallery or picture, thnx!!
BUT when I open a subgallery or picture, there's an error on the page:
Code:
Warning: Invalid argument supplied for foreach() in /home/httpd/vhosts/muijzert.com/subdomains/stijn/httpdocs/wp-content/themes/k2/comments.php on line 33

Line 33 is this line:
Code:
foreach ($comments as $comment) {

Can u help me remove this error?
Back to top
View user's profile Send private message
Korey
Site Admin


Joined: 13 Oct 2006
Posts: 143
Location: United States

PostPosted: Wed Mar 21, 2007 8:58 am    Post subject: Reply with quote

Monique-

Thanks for being so thorough and providing the info I need - that makes things much easier for me! I'm going to send you an email. Can you please send me your comments.php file as an attachment? The "private message" on this forum doesn't allow attachments. I'll make some changes and send it back. It would also be helpful if you could send me your URL so I could take a look. I have a feeling all we need is an if statement.

Thanks,
_________________
Korey - Developer of Lazy-K Gallery
Back to top
View user's profile Send private message Visit poster's website
Korey
Site Admin


Joined: 13 Oct 2006
Posts: 143
Location: United States

PostPosted: Wed Mar 21, 2007 8:32 pm    Post subject: Reply with quote

Monique-

I received your file - thanks! I tried using your comments.php on my test site, but I think I'd need your whole theme to test effectively. So, here's a quick educated guess as to what change you'd need to make. You mentioned in the earlier post that the error was on line 34. Let's try this to begin: add the following line right BEFORE that "foreach" statement on line 34.

Code:
if ($comments)


If that doesn't work I'll dig a little deeper.

Thanks,
_________________
Korey - Developer of Lazy-K Gallery
Back to top
View user's profile Send private message Visit poster's website
Monique



Joined: 04 Mar 2007
Posts: 12
Location: The Netherlands

PostPosted: Sat Mar 24, 2007 9:40 pm    Post subject: Reply with quote

Sorry for my delayed reaction...
I've added the code, but unfortunately that didn't solve the problem.

The strang thing is, that the error disappears when someones placed an reaction.

On this moment my site is down, well not really, but is not visible for the rest of the world. Wink
I found out that my url returned in the results of google. And because this site is about our (still unborn) baby, I was not happy about it. Wink
Back to top
View user's profile Send private message
Korey
Site Admin


Joined: 13 Oct 2006
Posts: 143
Location: United States

PostPosted: Sun Mar 25, 2007 9:41 pm    Post subject: Reply with quote

So you're saying that when someone leaves the first comment, the problem goes away. Are you talking about the "Invalid argument supplied for foreach()" error? When I tried to visit your page at the URL you sent me via email, I didn't get a response from the server, so I never did get to see what exactly is happening.

Sorry that Google blew your cover - I didn't link to it from anywhere. It make me wonder if Google scans GMail for links and adds those to the index... BTW congratulations!
_________________
Korey - Developer of Lazy-K Gallery
Back to top
View user's profile Send private message Visit poster's website
Monique



Joined: 04 Mar 2007
Posts: 12
Location: The Netherlands

PostPosted: Mon Mar 26, 2007 12:46 am    Post subject: Reply with quote

Oh no, I'm not blaming you for the Google-thing. Wordpress did it...I had forgotten to put the pings off. Then I my url was on the Technorati site and automatically also on Google.
I renamed the subdomain, that's why you didn't get a response. But the url is online again!

So if you still want to look at the problem?

Yes the error about the 'Invalid argument supplied for foreach() in' disappears when someone leaves the first comment.
You can see that I left a couple of test messages.

Edit: I know there's an error on the first page. I will call my host tomorrow for this.
Back to top
View user's profile Send private message
Korey
Site Admin


Joined: 13 Oct 2006
Posts: 143
Location: United States

PostPosted: Mon Mar 26, 2007 7:32 am    Post subject: Reply with quote

Monique-

I just visited your site but couldn't find anywhere where the error was occurring, even with zero comments. The only place I found with a photo but no comments was the root, though. Can you tell me where I can see the error?

Thanks,
_________________
Korey - Developer of Lazy-K Gallery
Back to top
View user's profile Send private message Visit poster's website
Monique



Joined: 04 Mar 2007
Posts: 12
Location: The Netherlands

PostPosted: Mon Mar 26, 2007 9:05 am    Post subject: Reply with quote

I've seen your post and approved it.

I'm really really sorry.....but the error is indeed gone... Shocked Embarassed
Since when? I dunno. Before I renamed my subdomain, it was really there.

Well thanx anyway, for ALL your help! Laughing
Back to top
View user's profile Send private message
Korey
Site Admin


Joined: 13 Oct 2006
Posts: 143
Location: United States

PostPosted: Tue Mar 27, 2007 9:34 am    Post subject: Reply with quote

No problem. I've seen weird stuff like that before. Sometimes I wonder if the Wordpress caching system throws things off. Any at rate, best of luck!
_________________
Korey - Developer of Lazy-K Gallery
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Korey's Wordpress Plugins Forums Forum Index -> Installation/Configuration Issues All times are GMT + 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP