Download

YATCP 0.6.5 Download YATCP 0.6.5

Questions, Bugs, Enhancements? Mail me: yatcp@organisiert.net

Features

  • Tested from WP 2.0.10, up to 2.5
  • Out of the Box threaded comments
  • Works without Javascript
  • Customizable through CSS or own templates
  • Completely internationalized for easy translation
  • Limiting of nesting depth
  • GPL v2 licensed

Template Functions

Most of the functions have already been mentioned on the Customization pages. Nevertheless this page provides an complete overview over the functions introduced by YATCP, showing their parameters and explaining what they do. All these functions are located in the template_functions.php file.

yatcp_add_comment_parent
  • Parameter: $comment_id - The ID of the comment given. The comment with this ID is altered by this function.
  • Description: Reads the Parameter comment_parent from the POST and updates the Post with ID $comment_id, so that the Column comment_parent contains that value. When replying directly to the post, the parameter should be '0'. For safety reasons the parameter Value is cehcked with is_numeric.
  • This function is added to the comment_post action hook.
yatcp_show_comment_parents
  • Parameter: $post_id - The ID of the Post to search comments for.
  • Description: Recursively searches comments made on the post with the given Post-ID. These Comments are put in a HTML <select > and displayed in the comment form to allow the selection of the comment to answer to. The option "Post" (with value '0') is always put on top of the list and by that selected automatically, when the form ist shown.
  • This function is added to the comment_form action hook.
yatcp_print_comment_option
  • Parameter: $prefix - Text used to indent the Text in the option Element. (Default: '').
  • Parameter: $number_prefix - Text used to prefix the counter of Elements on the same level (Default: '').
  • Parameter: $parent - The comment being parent to the comments to search. (Default: null).
  • Description: Recursively searches Comments made on the Comment given by $parent. When $parent is null, comments made on the post are searched. The found comments details are put into HTML <option> elements, where the value attribute is set to the ID of the currently processed comment.
  • This function is used by yatcp_show_comment_parents
yatcp_comments_template
  • Parameter: $file - The Name of the File that displays the outer Frame for the comments. (Default: /yatcp_comments.php).
  • Description: The main workhorse function, which replaces the standard comments_template(). This function includes the main Template, that shows the outer surroundings which, in turn, includes the comments list that handles the nesting of the comments. When yatcp_comments.php is found in your Template Directory (or any other file named like the $file parameter. This File will be included instead of the YATCP provided. See Customization with Templates for Details.
  • yatcp_comments_template calls the comments_template Filter Hook.
yatcp_show_comments
  • Parameter: $parent - The Comment to seach children for. When comments on the Post should be searched should be null. (Default: null).
  • Parameter: $comment_depth - The current depth in the Comment Tree. This is used to decide whether comments should still be shown nested or flat. On the first call null is passed, which causes an initialization to 0. On every subsequent Call the comment_depth is increased by one. As this is a global Variable the Templates need to take care of resetting the old value of comment_depth after the recursive call into this function!(Default: null).
  • Description: The second workhorse function in YATCP. This finds Comments replying to $parent and stores them into an associative Array $cmts using $parent->comment_ID as key. Which template file is included then is decided based on a comparison of the current comment dept (stored in the variable comment_depth) to the definition of YATCP_MAX_COMMENT_DEPTH. As long as it is smaller or equal single-comment.php is included to display these comments. In the other case single-comment-nonest.php is used. When no single-comment.php (or single-comment-nonest.php) File is found in the Template Directory, the one provided by YATCP is used. See Customization with Templates for Details.
  • yatcp_show_comments also calls the comments_template Filter Hook (with it's template File).
yatcp_find_comments
  • Parameter: $parent - The Comment to seach children for. When comments on the Post should be searched should be null. (Default: null).
  • Parameter: $considerTBExclusion If true, comments that are Trackbacks/Pingsbacks are excluded, when YATCP_EXCLUDE_TRACKBACKS is true. As this function is called under different circumstances that setting has to be ignored sometimes, which is done by setting this parameter. (Default: false).
  • Description: This function actually does the Database searching for comments related to the given parent. If parent is null, '0' is substituted. The function uses the same mechanisms for searching comments, as the Wordpress original, so logged in users can see their own comments even if they are not approved yet. Depending on the setting of YATCP_EXCLUDE_TRACKBACKS comments bein trackbacks or pingbacks are explicitely excluded.
  • yatcp_find_comments is used by yatcp_show_comments
yatcp_get_url
  • Description: This function creates a Link pointing to the comment_parent Anchor of the currently shown page. It is used to create the Links behind the "Reply". There were issues with relative Adressing, so the complete URL is built by this function using several Variables provided by PHP.
yatcp_print_comment_type
  • Parameter: $comment The Comment to print the actual comment Type for
  • Description: Echoes the Type of the Comment (similar to the comment_type() Template Tag). Based on the comment_type Poperty of the given Comment either "Comment", "Trackback" or "Pingback" is printed.