You are here:  » Changing role of review/rating

Support Forum



Changing role of review/rating

Submitted by oliver on Fri, 2008-01-04 11:48 in

Hi David

I was wondering if you could suggest how I may be able to change the role of the review/rating form so that only I (or a colleague) can publish via it.

I was thinking that with the kind of products I'm dealing with, people will be finding my site with a view to buying them and therefore won't be in a position to review them. But it would be useful if I was able to write reviews and post them for selected products.

I guess it would involve hiding the form somehow but making the post function still to the specific page. I hope that's clear.
Thanks
Oliver
p.s. Happy New Year!

Submitted by support on Fri, 2008-01-04 12:58

Hi Oliver,

HNY to you too!

I think the easiest way to do this is to simply hide the form by default and only display it if there is a secret "cookie" present, which you can set with another quick script and only give the URL to your staff.

To hide the form, look in html/ratings.php for the following code....

  <form method='post' name='f'>
  .... rest of review form HTML ....
  </form>

...and wrap that section in a little PHP, as follows:

  <?php if ($_COOKIE["editor"]): ?>
  <form method='post' name='f'>
  .... rest of review form HTML ....
  </form>
  <?php endif; ?>

This will mean that the form is only displayed if a cookie called "editor" is present. Now, to make a "login" script that will set that cookie, do something like this:

editorLogin.php

<?php
  $expire 
mktime(0,0,0,1,1,2010);
  
setcookie("editor","1",$expire,"/");
  
header("Location: /");
?>

Hope this helps!
Cheers,
David.

Submitted by oliver on Fri, 2008-01-04 14:35

Thanks David

Great solution, it works perfectly.

Cheers
Oliver