Upgrade script: Rating/voting by user ID/IP

Hi community !

 

I developped an extension that allows user to choose if voting/rating system is based on User IP or User ID. A new select field is added in administration -> basic settings.

I developped this because we use Dolphin in a professionnal network, so every user has the same IP.

 

This upgrade alter some tables in the database. A field is added to include the user ID for table who references votes, and the primary key (based on User IP, object ID and system ID) is dropped on tables who references rates. This development has been tested by our users and I think it could be a very positive upgrade for Dolphin (could be integrated in a further version maybe ?).

 

I link the zip file contained all modified files and installation procedure. I also added in this development the inclusion of two new files in Dolphin :

- a custom javascript file (empty). Allows developpers to add custom javascript code without altering Boonex source code and without backuping/restoring custom code in case of Dolphin updates

- a custom CSS file for the same reasons.

 

Do not hesitate to contact me for any questions, suggestions or bug.

 

Thanks !

voting_rating_sys_upgrade.zip · 30.8K · 334 downloads
Quote · 6 Jun 2016

Nice that you support the community but there is a simpler way already existing

https://github.com/boonex/dolphin.pro/commit/6963c71dba962516a93557f81dd8a92fa2c4f864

http://www.boonex.com/market/posts/paansystems - your resource for Dolphin Pro
Quote · 6 Jun 2016

Ok thanks ! I didn't saw this so it means that IP is only used for non logged users. In my case we allow admin to choose the voting/rating system. I see something missing in your case, you don't use the "user ID" system for rating comment. So it means that for an internal network, if one user rate for a comment, nobody could rate it further.

Quote · 6 Jun 2016

Ok so I modify the BxDolCmtsQuery.php file to add bug fix about rating comment system based on the same logic than your pull request linked. But I cannot push it into your master branch (logon failed).

Quote · 6 Jun 2016

So in BxDolCmtsQuery.php file, do :

Line 162, add this before "if" : 

$sVoterIdentification = isLogged() ? "'" . getLoggedId() . "'" : "INET_ATON('" . getVisitorIP() . "')";

Replace, line 164, the "if" condition by :

$this->query("INSERT IGNORE INTO {$this->_sTableTrack} SET
            `cmt_system_id` = '$iSystemId',
            `cmt_id` = '$iCmtId',
            `cmt_rate` = '$iRate',
            `cmt_rate_author_id` = '$iAuthorId',
            `cmt_rate_author_nip` = $sVoterIdentification,
            `cmt_rate_ts` = $iTimestamp")
Quote · 7 Jun 2016
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.