Changeset 1222 for branches/1.2


Ignore:
Timestamp:
02/23/10 12:08:52 (3 years ago)
Author:
nick_ramsay
Message:

[Branch 1.2] Comments 1.5 - shows messages for moderated comments: "Awaiting approval", "Exceeded Daily Limit", etc.

Location:
branches/1.2/content/plugins/comments
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/content/plugins/comments/comments.php

    r1200 r1222  
    33 * name: Comments 
    44 * description: Enables logged-in users to comment on posts 
    5  * version: 1.4 
     5 * version: 1.5 
    66 * folder: comments 
    77 * class: Comments 
     
    158158        $h->comment->thisForm = $h->comment->formStatus($h, 'select'); // returns 'open' or 'closed' 
    159159 
    160         if (   ($h->pageName == 'comments')  
     160        if (   ($h->pageType == 'post')  
    161161            && ($h->comment->thisForm == 'open') 
    162162            && ($h->comment->allForms == 'checked')) { 
     
    202202                        if ($can_comment == 'mod') { $safe = true; $h->comment->status = 'pending'; } 
    203203                         
     204                        $result = array(); // holds results from addComment function 
     205                         
    204206                        // Okay, safe to add the comment... 
    205207                        if ($safe) { 
    206208                            // A user can unsubscribe by submitting an empty comment, so... 
    207209                            if ($h->comment->content != '') { 
    208                                 $h->comment->addComment($h); 
     210                                $result = $h->comment->addComment($h); 
    209211             
    210212                                // notify chosen mods of new comment by email if enabled and UserFunctions file exists 
     
    223225                                //comment empty so just check subscribe box: 
    224226                                $h->comment->updateSubscribe($h, $h->comment->postId); 
     227                                $h->messages[$h->lang['comment_moderation_unsubscribed']] = 'green'; 
    225228                            } 
     229                        } 
     230                         
     231                        if ($result['exceeded_daily_limit']) { 
     232                            $h->messages[$h->lang['comment_moderation_exceeded_daily_limit']] = 'green'; 
     233                        } elseif ($result['exceeded_url_limit']) { 
     234                            $h->messages[$h->lang['comment_moderation_exceeded_url_limit']] = 'green'; 
     235                        } elseif ($result['not_enough_comments']) { 
     236                            $h->messages[$h->lang['comment_moderation_not_enough_comments']] = 'green'; 
    226237                        } 
    227238                    } 
     
    238249                    } 
    239250                    
     251                    if ($h->comment->status == 'pending') { 
     252                        return false; 
     253                    } 
     254                     
    240255                    header("Location: " . $h->url(array('page'=>$h->comment->postId)));    // Go to the post 
    241256                    die(); 
  • branches/1.2/content/plugins/comments/languages/comments_language.php

    r1152 r1222  
    5353$lang['comments_form_delete'] = "Delete this and responses"; 
    5454$lang['comments_form_moderation_on'] = "<b>Note</b>: <span style='color: red;'>All comments are moderated</span>."; 
     55 
     56/* Comment Submission */ 
     57$lang['comment_moderation_unsubscribed'] = "You have unsubscribed from this thread."; 
     58$lang['comment_moderation_exceeded_daily_limit'] = "You've exceeded the daily comment limit. This and any further comments will need approval."; 
     59$lang['comment_moderation_exceeded_url_limit'] = "You used too many URLs so your comment will need approval."; 
     60$lang['comment_moderation_not_enough_comments'] = "Your comment is awaiting approval."; 
    5561 
    5662/* All Comments */ 
  • branches/1.2/content/plugins/comments/readme.txt

    r1187 r1222  
    55Description 
    66----------- 
    7 Enable your registered users to comment on each post. Supports avatars (e.g. Gravatar plugin), replies, unlimited nesting, editing, HTML tags (chosen by the Admin) and comment subscription.  
     7Enable your registered users to comment on each post. Supports avatars (e.g. Gravatar plugin), replies, unlimited nesting, editing, HTML tags (chosen by the Admin), pagination and comment subscription.  
    88 
    99Instructions 
     
    1515Changelog 
    1616--------- 
     17v.1.5 2009/02/23 - Nick - Shows messages for moderated comments: "Awaiting approval", "Exceeded Daily Limit", etc. 
    1718v.1.4 2009/02/09 - Nick - Option to hide comments after X down votes, plus pagination code changes 
    1819v.1.3 2009/01/17 - Nick - Added option for avatar size 
  • branches/1.2/content/plugins/comments/templates/comment_form.php

    r885 r1222  
    3535<?php } // JavaScript changes this form! See comments.js ?> 
    3636 
    37     <form name='comment_form' action='<?php echo BASEURL; ?>index.php?page=comments' method='post'> 
     37    <form name='comment_form' action='<?php echo $h->url(array('page' => $h->post->id)); ?>' method='post'> 
    3838        <textarea name="comment_content" id="comment_content_<?php echo $h->comment->id; ?>" rows="6" cols="50"></textarea><br /> 
    3939        <div class="comment_instructions"><?php echo $h->lang['comments_form_allowable_tags']; ?><?php echo htmlentities($h->comment->allowableTags); ?></div> 
Note: See TracChangeset for help on using the changeset viewer.