Quarantine area for comments plug in

By JeffC - August 19, 2014

I plan to buy the comments plugin but before I do I wondered if it had the facility for all comments to go into a quarantine area so that the website owner can read them before they go live. If this function is not part of the existing plug in please could you provide a cost for some custom consulting

Thanks

Jeff

By gregThomas - August 19, 2014

Hey Jeff,

Unfortunately this is not part of the current plugin, but it would be very easy to add. You'd need to add a hidden check box field to the _wsc_comments section, then add the following at line 161 of the websiteComments.php plugin:

  // add comment
  mysqlStrictMode(false); // disable Mysql strict errors for when a field isn't defined below (can be caused when fields are added later)
  $newCommentNum = mysql_insert('_wsc_comments', array(
    'createdDate='     => 'NOW()',
    'createdByUserNum' => $CURRENT_USER['num'],
    'comment'          => trim($_REQUEST['wsc_comment']),
    'tableOrTag'       => $_REQUEST['_wsc_tableOrTag'],
    'recordNum'        => $_REQUEST['_wsc_recordNum'],
    'hidden'            => '1',
  ));

Then when a comment is added, the site administrator would just need to uncheck the hidden field to get the comment to display. Site administrators are e-mailed when a new comment is added to a site by default.

If you'd set up the website comments plugin on your site, it would not take us long at all to integrate this feature. You can send an e-mail to consulting@interactivetools.com, and we give you a price for adding it.

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By JeffC - August 28, 2014

Thanks Greg. I have purchased the plugin and your solution worked a charm.

Please could you help with another problem I have had setting up the plugin. I think I have misunderstood the instructions!

I have added the following code to my product page:

<!-- DISPLAY COMMENTS -->
<?php

  wsc_comments(array(
    'tableOrTag' => 'die_adapters',    // Section these comments are associated with, such as: "articles", "blog", "about_us".
    'recordNum'  => $record['num'],            // Record num these comments are associated with, such as: $record['num'] or 1
    'themeName'  => 'custom',                 // HTML theme to display comments with, from /plugins/websiteComments/themes
    'pageName'   => $record['name'],           // Page name displayed in comment notification emails, such as: $record['title'] or "Custom Text"
    'pageUrl'    => realurl($record['_link']), // Page URL displayed in comment notification emails, such as realurl($record['_link'])
  ));

?>
<!-- /DISPLAY COMMENTS -->

I have also added the following code to the head of my file. I assume this needs to be changed - and you have included it as a sample only - but after hours of head-scratching i can't work out what exampleRecords, exampleMetaData etc should be changed to.

// load records
  list($exampleRecords, $exampleMetaData) = getRecords(array(
    'tableName'   => '_wsc_example_records',
    'where'       => whereRecordNumberInUrl(1), // If no record number in url just load first record
    'limit'       => '1',
  ));
  $record = @$exampleRecords[0]; // get first record
  if (!$record) { dieWith404("Record not found!"); }  // show error message if no matching record is found
 

Jeff

By gregThomas - August 28, 2014

Hi Jeff,

Are you making the comments appear on a detail page for a particular record? So if you're using a getRecords function to retrieve a detail record for your page, the _wsc_example_records would be an example of the code loading that record.

So the idea is that comments are linked to a particular record you've created in one of your sections, and the comments will only be displayed for that particular record.

If you're not loading the details of a particular record on the page, you wouldn't need anything like the _wsc_example_records getRecords function, you could just modify the comments code to have unique values.

Hopefully that helps.

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com