Firefox PHP

Module for rating posts

Posted by Mensler 
Re: Module for rating posts
August 22, 2006 11:47AM
Of course Clemens. You can put them in the module package. ;)

How to replace -1 and 1 by pos and neg ?
I don't want to change the range. (1 and -1 is perfect)

Thanks
Re: Module for rating posts
August 22, 2006 11:55AM
For my problem ;-)

It works perfectly when I deleted the other Custom Fields, so I assume it's a collision in the fields somewhere?

Here's the other Custom Fields that I have:


mod_rating 255 No
mod_avatar 255 No
locale_name 255 No
mod_killfile 255 No
avatar_url 255 No
my_website 255 No
my_icq 255 No
msn_mess 255 No
my_song 255 No
my_album 255 No
float_to_top 255 No

I didn't set 'mod_rating' manually, but I see that it is there.


Remarkably, I see to have fixed the problem somehow. The update script has worked, and displayed 'Done' when it was finished, and I'm no longer having these issues....hopefully!
Re: Module for rating posts
August 22, 2006 12:16PM
Quote
momo
How to replace -1 and 1 by pos and neg ?
I don't want to change the range. (1 and -1 is perfect)

That's not easy. It requires changing the code of the module.
What I meant was to change the rewrite rule to fit your needs.

--
Clemens Weiß
Webplain.de
Re: Module for rating posts
August 22, 2006 12:19PM
Here is my rewrite rule in common.php

function phorum_custom_get_url ($page, $query_items, $suffix)
{
$PHORUM=$GLOBALS["PHORUM"];
$url = "$PHORUM[http_path]/$page";
if(count($query_items) and ($page!="redirect")) $url.="-".implode("-", $query_items);
$url.=".html";
if(!empty($suffix)) $url.=$suffix;
return $url;
}


But i don't know how to exclude rate page ? :(
Re: Module for rating posts
August 22, 2006 12:20PM
Quote
M@AATW
Remarkably, I see to have fixed the problem somehow. The update script has worked, and displayed 'Done' when it was finished, and I'm no longer having these issues....hopefully!

That's good to hear :-)
But have you added the custom fields manually again after deleting them or did you use a backup?
I ask this because that maybe changed the IDs of the fields and so the data the users entered for the old fields is no longer available. You'd better check this...

--
Clemens Weiß
Webplain.de
Re: Module for rating posts
August 22, 2006 12:27PM
Quote
momo
Here is my rewrite rule in common.php

function phorum_custom_get_url ($page, $query_items, $suffix)
{
$PHORUM=$GLOBALS["PHORUM"];
$url = "$PHORUM[http_path]/$page";
if(count($query_items) and ($page!="redirect")) $url.="-".implode("-", $query_items);
$url.=".html";
if(!empty($suffix)) $url.=$suffix;
return $url;
}

OK, but how is the URL "decoded" again so that Phorum can split the parameters on comma?
That needs a rewrite rule in .htaccess or httpd.conf, doesn't it?

--
Clemens Weiß
Webplain.de
Re: Module for rating posts
August 22, 2006 12:31PM
Yep

RewriteRule ^read-([^/]+)-([^/]+)-([^/]+)-([^/]+).html$ read.php?$1,$2,$3,$4
RewriteRule ^read-([^/]+)-([^/]+)-([^/]+).html$ read.php?$1,$2,$3
RewriteRule ^read-([^/]+)-([^/]+).html$ read.php?$1,$2

So if i have a url like :
read-1-1111.html it's the same as read.php?1,1111
Re: Module for rating posts
August 22, 2006 12:50PM
OK, we're coming closer, that was what I meant :-)

So an URL for rating looks like this, am I right?

read-2-27200-27248-rate=-1.html

Then the first rule should work...
Try this one before the other three rules, it should be more specific:

RewriteRule ^read-([0-9]+)-([0-9]+)-([0-9]+)-(rate=-?[0-9]+)\.html$ read.php?$1,$2,$3,$4

--
Clemens Weiß
Webplain.de
Re: Module for rating posts
August 22, 2006 12:59PM
Cool ! :)

It's running.

Thank you Clemens. ;)
Re: Module for rating posts
August 22, 2006 01:47PM
I uploaded the new version including momo's icons and the option to use them instead of the text links.

--
Clemens Weiß
Webplain.de
Sorry, only registered users may post in this forum.

Click here to login