This is the README for the comment module.

TABLE OF CONTENTS
-----------------

1. REQUIREMENTS
2. FRESH INSTALL
3. UPGRADING
4. MODULE INTERFACE

1. REQUIREMENTS
---------------

- phpWebSite version 0.8.0, 0.8.1(recommended).

2. FRESH INSTALL
----------------

To install a fresh copy of the comment module, run the web-based
install of phpWebSite version 0.8.1 or later.


3. UPGRADING
------------

- Make a backup copy of your code-base for phpWebSite and a backup
  or dump of the data in your database.

- Run the web-based install of phpWebSite version 0.8.0 or later,
  and choose upgrade.  Take heed of the warning!

- Once you PROCEED choose the version of phpWebSite you are upgrading
  from (0.8.0 or 0.8.1 recommended) and the comment module is automatically
  upgraded.


2. MODULE INTERFACE
-------------------

Parent Module - Refers to the module that is useing the comment module.
PK - Refers to Primary Key.

First it is important to know that a unique identifier is created from
the parent module's name(which you will assign) and the primary key of
the instance of the parent module that is using the comment module.

For instance, The poll module uses "poll" as it's name and the $pid 
as the primary key. When an instance of the comments is created it's
unique identifier would be "poll.$pid". Once a module name is chosen it 
must be kept the same through out these functions!

**VERY IMPORTANT**
Around all of the interface functions you must have:

if($result=mysql_query("SELECT * FROM ".$tableprefix."mod_comments_data");
{
	#function call go here 
}
	
If you don't and the comments module is not installed then errors will result.
 
**VERY IMPORTANT**
Recommend using poll and article as the module names for each respective 
parent module.  If you choose to use different names then you will have 
to change these names in comments_install.php PRIOR TO INSTALLING COMMENTS!.

All interface functions are contained in comment_interface.php.

Below is a brief description and the recommended way to use the functions in your
module.

################################################################################
#  Params:  $module - The name of the module of that is using the comment.     #
# 	    $id - The unique identifer of the instance of the module.	       #
#  									       #	
#  Description: Delete the data of the Comment for "$module.$id".	       #
################################################################################
function delete_comment_mid($module,$id)
This deletes the all comments stored in mod_comments_data for $module.$id.  It should be 
used where an instance of the parent module is being deleted.

i.e. Look at poll/poll.php function poll_delete line 399.  If a poll is 
deleted and it had comments enabled then the comment data is deleted.

################################################################################
#  Params:  $module - The parent module name that will be using comments.      #
# 	    $id - The unique identifier, usually the primary key from the      #
#		  database, that will be used to associate the comment         #
#                 with the parent module's instance.			       #
#									       #	
#  Description: Creates a navigaton bar if a record exists for the module      #
#		and if the comments are enabled for that module.  It           #
#               orders the comments and calls display_comments().  Displays    #
#  		$content, a global var used to store the data to be displayed. #
################################################################################   
function nav_bar($module, $id) 
Put this function where you want the comments to be displayed.

i.e. Look at poll/index.php&op=results line 106.  

Simply have $module = the name you chose for the parent module and the id = the 
PK of the parent module and it will display any comments if the instance of the 
parent module has comments enabled.

################################################################################
#  Params:  $module - The name of the module that is using the comment.	       #
# 	    $id - The unique identifer of the instance of the module.	       #
#  									       #	
#  Description: Returns the total number of comments  for "$module.$id".       #
################################################################################
function comment_total($module, $id)
Returns the total number of comments for $module.$id.

i.e. Look at poll_functionons.php function poll_show line 59
     & ./index.php line 70


################################################################################
#  Params:  $module - The name of the module that is using Comments.	       #
# 	    $max_id - The max unique identifer of the instance of the module.  #
#  									       #	
#  Description: Deletes all the data of the Comment for "$module".             #
################################################################################
function delete_all_comments_module($module, $max_id)
$max_id is the max PK of the parent module. It will delete all data 
associtated with the $module.

i.e. Look at poll/poll.php function poll_delete all line 79

################################################################################
#  Params:  $module - The parent module name that will be using comments.      #
# 	    $id - The unique identifier, usually the primary key from the      #
#		  database, that will be used to associate the comment         #
#                 with the parent module's instance.			       #
# 	    $comments - Form variable for enabling/disabling the comment.      #
#		        1 = yes, 0 = no					       #
#	    $postanon - Form variable for allowing users to post anonymous     #
#			comments. 1= yes, 0 = no			       #
#  									       #	
#  Description: It creates a new comment if one does not.                      #
#               Sets the enable and anonymous settings in the database.        #
################################################################################	
function enable_comments($module, $id, $comments, $postanon)

It creates a new comment if one does not.  Sets the enable and anonymous settings
in the database. This function is used when an instance of the comment is to be 
saved or the settings for enable/anonymous are to be changed. 

look at mod/poll/index.php line 84:

look at admin/news.php line 277, 472, 680:

################################################################################
#  Params:  $module - The parent module name that will be using comments.      #
# 	    $id - The unique identifier, usually the primary key from the      #
#		  database, that will be used to associate the comment         #
#                 with the parent module's instance.			       #
# 	    $comments - Form variable for enabling/disabling the comment.      #
#		        1 = yes, 0 = no					       #
#	    $postanon - Form variable for allowing users to post anonymous     #
#			comments. 1= yes, 0 = no			       #
#  									       #	
#  Description: Returns a string that contains 2 yes/no radio button sets for  #
#		enabling/disabling the comment and the anonymous option.       #
################################################################################
function comments_menu($module, $id, $comments, $postanon)
This function is used to display the menu.
If $comments and $postanon == 3 then the enable/anonymous settings will be pulled
out of mod_comments_data.  If the settings are not available the radio buttons are
set to no.

look at poll.php 136

look at news.php line 103:

