Author Topic: Allow to write more that 1 review for an item / per user :)  (Read 852 times)

dynxx

  • Beginner
  • *
  • Posts: 5
Allow to write more that 1 review for an item / per user :)
« on: March 18, 2010, 14:59:42 pm »
Hello!

You've been very helpful - that's why I decided to ask you one more thing :D
Can it be done? Can one write more that 1 review to the same item? How to unlock that option / or pass the checking process.. I went through all the forums and couldn't find any answers..

Cheers :)

dynxx

  • Beginner
  • *
  • Posts: 5
Re: Allow to write more that 1 review for an item / per user :)
« Reply #1 on: March 24, 2010, 08:49:45 am »
Okay - I'm using Vm for something other than a shop. Only 7 people uses that website - and I really need multi-comments :) What I did for now - I enabled the possibility to write 2 comments per account. I'm not a "programmer" - but I did some backwards-engineering :) So.. I created extra 7 accounts like in this example:
- user Dan has 2 accounts - only logs in his base account
- his Usernames are: Dan  and  Dan_
- Dan userID = 65 Dan_ userID =72
Every sinlge "cloned account" userID is equal to original userID+7.

After that I modified ps_reviews.php :

I took that part:
if ($commented==false) {
$comment= nl2br(htmlspecialchars(vmGet($d, 'comment' )));
$published = VM_REVIEWS_AUTOPUBLISH ? 'Y' : 'N';
$time = time() + $mosConfig_offset*60*60;
$fields = array('product_id' => $d['product_id'],
'userid' => $userid,
'comment' => $comment,
'user_rating' => vmRequest::getInt('user_rating'),
'published' => $published,
'time'  => $time
$db->buildQuery('INSERT', '#__{vm}_product_reviews', $fields );
$db->query();
$this->process_vote( $d );
$vmLogger->info($VM_LANG->_('PHPSHOP_REVIEW_THANKYOU',false));
         }
else {
$vmLogger->info( $VM_LANG->_('PHPSHOP_REVIEW_ALREADYDONE',false) );
}
}

And modified the else section as follows:
else {
$comment= nl2br(htmlspecialchars(vmGet($d, 'comment' )));
$published = VM_REVIEWS_AUTOPUBLISH ? 'Y' : 'N';
$time = time() + $mosConfig_offset*60*60;
$fields = array('product_id' => $d['product_id'],
'userid' => $userid+7,
'comment' => $comment,
'user_rating' => vmRequest::getInt('user_rating'),
'published' => $published,
'time'  => $time
$db->buildQuery('INSERT', '#__{vm}_product_reviews', $fields );
$db->query();
$this->process_vote( $d );
$vmLogger->info($VM_LANG->_('PHPSHOP_REVIEW_THANKYOU',false));
}

So now it checks if the review from that user has been posted before - and if so instead of a message ('you've already etc.. Thank you') it posts that review under the cloned account.
I forced VM to display the review form all the time.
I do understand this code - but in a limited way - no experience in PHP.
What I need is to create some more cloned-accounts to make up to 5 reviews per item possible..

Maybe some of you could help me to use my method. I have no clue for now how to create a loop of some sort or a bunch of "if" conditions to check if userID wrote a review - than if userID+7 wrote a review and so on.. userID+21 didn't - so post a review on his account :)

Thanks in advance for your replies! :)