RateThis module

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
lampsie
Forum Members
Forum Members
Posts: 38
Joined: Fri Nov 17, 2006 9:25 am

RateThis module

Post by lampsie »

Hi there,

Having a slight logic problem with this module...I have two News categories set up (General and Tips) in my CMSMS 1.0.4

Problem: When user submits a rating, the system registers the vote for the entire category, as opposed to just the particular article.

I have tried amending the pageID module to use the news article title (and converting it to VARCHAR in DB) but without success.

Any hints/tips that might help? Or maybe any alternative modules?

Thanks,
Lampsie
scooper
Forum Members
Forum Members
Posts: 242
Joined: Fri Dec 09, 2005 12:36 pm
Location: Marlow, UK

Re: RateThis module

Post by scooper »

Hmmm -  you're right in that it use pages rather than news items, but I think you could probably hack it about to use articleID rather than the pageID. And you're probably on the right track.

In fact a very quick bit of proof of concept hacking seems to show it can be done. I've just changed the default action to see if there's an articleID being passed and use that instead of the pageID...

So - in action.default.php

I changed the line

$rtPageId=$gCms->variables['content_id'];

on about line 10 to

if (isset($_POST['rtPageId'])){
$rtPageId=$_POST['rtPageId'];
}else{

if (isset($_GET['cntnt01articleid'])){
$rtPageId=$_GET['cntnt01articleid'];
}else{
$rtPageId=$gCms->variables['content_id'];
}
}

and then I added a hidden field into the form that keeps hold of that ID when it's posted.

echo('');

at about line 148.

You'll also need to stop the admin interface trying to look up the page names as well (because often there won't be one of course). I just commented out line 103 in action.defaultadmin

//$content =& $node->getContent();


Obviously this is just a really ropey hack (there must be a better way of checking for an article ID than that $_GET for a start) and is going to cause all kinds of confusion if you want to rate pages as well as news items. But you should be able to get it to do what you want.

Cheers.

s.
Post Reply

Return to “Developers Discussion”