[ABD] (Topic &) Post Rating System (with Karma module)

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
notsa
Registered User
Posts: 253
Joined: Sat Jul 28, 2007 7:37 pm

Re: [BETA] Post Rating System

Post by notsa »

ok i converted this to the old mod form at
i have 3 problems after doing what it said. maybe in converting i missed something (or maybe its on you :D .)

ok the first problem was when executing the sql commands i get this error:

Code: Select all

Error

SQL query:

ALTER TABLE phpbb_posts ADD posts_ratings_score TINYINT UNSIGNED NOT NULL ,
ADD posts_ratings_standard_diviation SMALLINT UNSIGNED NOT NULL ,
ADD posts_ratings_shadowed BOOL NOT NULL ,
ADD posts_ratings_penaltized BOOL NOT NULL ,
ADD INDEX ( posts_ratings_voteround_closed, posts_ratings_shadowed ) ;

MySQL said: Documentation
#1072 - Key column 'posts_ratings_voteround_closed' doesn't exist in table 
ok at the top of the viewprofile, the topic page, and the main page of the ucp i see:

Code: Select all

Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of usort(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in D:\localhost\test\includes\functions_posts_ratings.php on line 248

Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in D:\localhost\test\includes\functions_posts_ratings.php on line 723

Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in D:\localhost\test\includes\functions_posts_ratings.php on line 764
And the third when i try to submit a rating (ie i click a start with the blue border on hover) iget this error:

Code: Select all

General Error
SQL ERROR [ mysql4 ]

Field 'standard_diviation' doesn't have a default value [1364]

SQL

INSERT INTO phpbb_posts_ratings_votes (post_id, score, shadow, user_id, time) VALUES (804, 40, 0, '2', 1198863760)

BACKTRACE

FILE: includes/db/mysql.php
LINE: 158
CALL: dbal->sql_error()

FILE: includes/functions_posts_ratings.php
LINE: 581
CALL: dbal_mysql->sql_query()

FILE: posts_ratings.php
LINE: 59
CALL: submit_vote()
I dont know if this helps but i trid to fix the first error by inputing this line in the sql and it allowed it to go through:

Code: Select all

ADD posts_ratings_voteround_closed BOOL NOT NULL,


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

and finnally if it helps here are the converted install files i did:
for the templates:

Code: Select all

##############################################################
## MOD Title: Post Rating System
## MOD Author: ..::Frans::.. < [email protected] > (..::Alfatrion::..) 
##             http://www.infopolitie.nl 
##             http://forum.infopolitie.nl
## MOD Description: The Posts Ratings System allows your user to rate post. 

Features include:
- Posting ratings (Afther a number of days the average rating is calculated and voting is no longer possible)
- Shadow ratings (System determine what users would have voted).
- Karma calculation (User stats)
- Penalty system
- Modpoints for users (For each post user gets points that they need to vote)

## MOD Version: 0.1.0
##
## Installation Level: easy
## Installation Time: 3 minutes
## Files To Edit: 4
##					styles/prosilver/template/viewtopic_body.html
##					styles/prosilver/template/ucp_main_front.html
##					styles/prosilver/template/memberlist_view.html
##					styles/prosilver/theme/stylesheet.css
## Included Files: n/a
##############################################################
## For Security Purposes, Please Check: http://startrekguide.com/forum/viewtopic.php?f=40&t=1802 for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, author will not offer support for MODs not offered
## in our MOD-Database, located at: http://startrekguide.com/forum/viewtopic.php?f=40&t=1802
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
styles/prosilver/theme/stylesheet.css

#-----[ FIND ]------------------------------------------
#
@import url("common.css");
@import url("links.css");
@import url("content.css");
@import url("buttons.css");
@import url("cp.css");
@import url("forms.css");
@import url("tweaks.css");
@import url("colours.css");

#-----[AFTER, ADD ]------------------------------------------
#
@import url("posts_ratings.css");
					
#-----[ OPEN ]------------------------------------------
#
styles/prosilver/template/memberlist_view.html

#-----[ FIND ]------------------------------------------
#
<dt>{L_JOINED}:</dt> <dd>{JOINED}</dd>
<dt>{L_VISITED}:</dt> <dd>{VISITED}</dd>

#-----[AFTER, ADD ]------------------------------------------
#
<!-- IF S_POSTS_RATINGS_KARMA_ENABLED -->
<dt>{L_KARMA}:</td> <dd>{POSTS_RATINGS_KARMA_SCORE}<!-- IF U_USER_ADMIN --> ~ {POSTS_RATINGS_KARMA_O}<!-- ENDIF --></dd>
<!-- ENDIF -->

#-----[ OPEN ]------------------------------------------
#
styles/prosilver/template/ucp_main_front.html

#-----[ FIND ]------------------------------------------
#
<dt>{L_JOINED}:</dt> <dd>{JOINED}</dd>
<dt>{L_VISITED}:</dt> <dd>{LAST_VISIT_YOU}</dd>

#-----[AFTER, ADD ]------------------------------------------
#
<!-- IF S_POSTS_RATINGS_KARMA_ENABLED -->
<dt>{L_KARMA}:</dt> <dd>{POSTS_RATINGS_KARMA_SCORE}</dd>
<!-- ENDIF --><!-- IF S_POSTS_RATINGS_MODPOINTS_ENABLED -->
<dt>{L_MODPOINTS}:</dt> <dd>{POSTS_RATINGS_ODPOINTS}</dd>
<!-- ENDIF -->

					
				
#-----[ OPEN ]------------------------------------------
#
styles/prosilver/template/viewtopic_body.html

#-----[ FIND ]------------------------------------------
#
<!-- IF postrow.U_EDIT --><li class="edit-icon"><a href="{postrow.U_EDIT}" title="{L_EDIT_POST}"><span>{L_EDIT_POST}</span></a><
/li><!-- ENDIF -->
<!-- IF postrow.U_DELETE --><li class="delete-icon"><a href="{postrow.U_DELETE}" title="{L_DELETE_POST}"><span>{L_DELETE_POST}</
span></a></li><!-- ENDIF -->

#-----[AFTER, ADD ]------------------------------------------
#
<!-- IF postrow.S_POSTS_RATINGS_ENABLED -->
<li class="{postrow.POSTS_RATINGS_STAR1}"><!-- IF postrow.S_POSTS_RATINGS_VOTABLE --><a href="{postrow.U_POSTS_RATINGS_STAR1}" title="{L_POSTS_RATINGS_STAR1_EXPLAIN}"><!-- ELSE --><a title="{postrow.POSTS_RATINGS_VOTEROUND_CLOSED_SCORE}"><!-- ENDIF --><span>{L_POSTS_RATINGS_STAR1}</span></a></li>
<li class="{postrow.POSTS_RATINGS_STAR2}"><!-- IF postrow.S_POSTS_RATINGS_VOTABLE --><a href="{postrow.U_POSTS_RATINGS_STAR2}" title="{L_POSTS_RATINGS_STAR2_EXPLAIN}"><!-- ELSE --><a title="{postrow.POSTS_RATINGS_VOTEROUND_CLOSED_SCORE}"><!-- ENDIF --><span>{L_POSTS_RATINGS_STAR2}</span></a></li>
<li class="{postrow.POSTS_RATINGS_STAR3}"><!-- IF postrow.S_POSTS_RATINGS_VOTABLE --><a href="{postrow.U_POSTS_RATINGS_STAR3}" title="{L_POSTS_RATINGS_STAR3_EXPLAIN}"><!-- ELSE --><a title="{postrow.POSTS_RATINGS_VOTEROUND_CLOSED_SCORE}"><!-- ENDIF --><span>{L_POSTS_RATINGS_STAR3}</span></a></li>
<li class="{postrow.POSTS_RATINGS_STAR4}"><!-- IF postrow.S_POSTS_RATINGS_VOTABLE --><a href="{postrow.U_POSTS_RATINGS_STAR4}" title="{L_POSTS_RATINGS_STAR4_EXPLAIN}"><!-- ELSE --><a title="{postrow.POSTS_RATINGS_VOTEROUND_CLOSED_SCORE}"><!-- ENDIF --><span>{L_POSTS_RATINGS_STAR4}</span></a></li>
<li class="{postrow.POSTS_RATINGS_STAR5}"><!-- IF postrow.S_POSTS_RATINGS_VOTABLE --><a href="{postrow.U_POSTS_RATINGS_STAR5}" title="{L_POSTS_RATINGS_STAR5_EXPLAIN}"><!-- ELSE --><a title="{postrow.POSTS_RATINGS_VOTEROUND_CLOSED_SCORE}"><!-- ENDIF --><span>{L_POSTS_RATINGS_STAR5}</span></a></li>
<!-- ENDIF -->
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
For the main install file:

Code: Select all

##############################################################
## MOD Title: Post Rating System
## MOD Author: ..::Frans::.. < [email protected] > (..::Alfatrion::..) 
##             http://www.infopolitie.nl 
##             http://forum.infopolitie.nl
## MOD Description: The Posts Ratings System allows your user to rate post. 

Features include:
- Posting ratings (Afther a number of days the average rating is calculated and voting is no longer possible)
- Shadow ratings (System determine what users would have voted).
- Karma calculation (User stats)
- Penalty system
- Modpoints for users (For each post user gets points that they need to vote)

## MOD Version: 0.1.0
##
## Installation Level: easy
## Installation Time: 3 minutes
## Files To Edit: 4
##			includes/constants.php
##			posting.php
##			viewtopic.php
##			cron.php
## Included Files: 9
			adm/style/acp_posts_ratings.html
			includes/acp/acp_posts_ratings.php
			includes/acp/info/acp_posts_ratings.php
			includes/functions_posts_ratings.php
			language/en/mods/info_acp_posts_ratings.php
			language/en/mods/posts_ratings.php
			posts_ratings.php
			styles/prosilver/template/posts_ratings_body.html
			styles/prosilver/theme/posts_ratings.css
#
##############################################################
## For Security Purposes, Please Check: http://startrekguide.com/forum/viewtopic.php?f=40&t=1802 for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, author will not offer support for MODs not offered
## in our MOD-Database, located at: http://startrekguide.com/forum/viewtopic.php?f=40&t=1802
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ COPY ]------------------------------------------
#
			adm/style/acp_posts_ratings.html
			includes/acp/acp_posts_ratings.php
			includes/acp/info/acp_posts_ratings.php
			includes/functions_posts_ratings.php
			language/en/mods/info_acp_posts_ratings.php
			language/en/mods/posts_ratings.php
			posts_ratings.php
			styles/prosilver/template/posts_ratings_body.html
			styles/prosilver/theme/posts_ratings.css

#-----[ SQL ]------------------------------------------
#
INSERT INTO `phpbb_styles_imageset_data` ( `image_id` , `image_name` , `image_filename` , `image_lang` , `image_height` , `image_width` , `imageset_id` )
VALUES
(NULL , 'posts_ratings_star_v_0', 'posts_ratings_star_v_00.gif', '', '20', '17', '1'),
(NULL , 'posts_ratings_star_v_1', 'posts_ratings_star_v_01.gif', '', '20', '17', '1'),
(NULL , 'posts_ratings_star_v_2', 'posts_ratings_star_v_02.gif', '', '20', '17', '1'),
(NULL , 'posts_ratings_star_v_3', 'posts_ratings_star_v_03.gif', '', '20', '17', '1'),
(NULL , 'posts_ratings_star_v_4', 'posts_ratings_star_v_04.gif', '', '20', '17', '1'),
(NULL , 'posts_ratings_star_v_5', 'posts_ratings_star_v_05.gif', '', '20', '17', '1'),
(NULL , 'posts_ratings_star_v_6', 'posts_ratings_star_v_06.gif', '', '20', '17', '1'),
(NULL , 'posts_ratings_star_v_7', 'posts_ratings_star_v_07.gif', '', '20', '17', '1'),
(NULL , 'posts_ratings_star_v_8', 'posts_ratings_star_v_08.gif', '', '20', '17', '1'),
(NULL , 'posts_ratings_star_v_9', 'posts_ratings_star_v_09.gif', '', '20', '17', '1'),
(NULL , 'posts_ratings_star_v_10', 'posts_ratings_star_v_10.gif', '', '20', '17', '1'),
(NULL , 'posts_ratings_star_uv_0', 'posts_ratings_star_uv_00.gif', '', '20', '17', '1'),
(NULL , 'posts_ratings_star_uv_1', 'posts_ratings_star_uv_01.gif', '', '20', '17', '1'),
(NULL , 'posts_ratings_star_uv_2', 'posts_ratings_star_uv_02.gif', '', '20', '17', '1'),
(NULL , 'posts_ratings_star_uv_3', 'posts_ratings_star_uv_03.gif', '', '20', '17', '1'),
(NULL , 'posts_ratings_star_uv_4', 'posts_ratings_star_uv_04.gif', '', '20', '17', '1'),
(NULL , 'posts_ratings_star_uv_5', 'posts_ratings_star_uv_05.gif', '', '20', '17', '1'),
(NULL , 'posts_ratings_star_uv_6', 'posts_ratings_star_uv_06.gif', '', '20', '17', '1'),
(NULL , 'posts_ratings_star_uv_7', 'posts_ratings_star_uv_07.gif', '', '20', '17', '1'),
(NULL , 'posts_ratings_star_uv_8', 'posts_ratings_star_uv_08.gif', '', '20', '17', '1'),
(NULL , 'posts_ratings_star_uv_9', 'posts_ratings_star_uv_09.gif', '', '20', '17', '1'),
(NULL , 'posts_ratings_star_uv_10', 'posts_ratings_star_uv_10.gif', '', '20', '17', '1');

CREATE TABLE phpbb_posts_ratings_votes (
user_id MEDIUMINT UNSIGNED NOT NULL,
post_id MEDIUMINT UNSIGNED NOT NULL,
score TINYINT UNSIGNED NOT NULL DEFAULT '30',
standard_diviation SMALLINT UNSIGNED NOT NULL,
shadow BOOL NOT NULL DEFAULT '0',
time INT UNSIGNED NOT NULL,
PRIMARY KEY (user_id, post_id),
INDEX (post_id)
) TYPE = MYISAM CHARACTER SET utf8 COLLATE utf8_bin;

CREATE TABLE phpbb_posts_ratings_votes_chi (
user1_id MEDIUMINT UNSIGNED NOT NULL ,
user2_id MEDIUMINT UNSIGNED NOT NULL ,
time INT UNSIGNED NOT NULL ,
chi TINYINT UNSIGNED NOT NULL ,
diff TINYINT NOT NULL ,
num TINYINT UNSIGNED NOT NULL ,
PRIMARY KEY (user1_id, user2_id),
INDEX (time , num)
) TYPE = MYISAM CHARACTER SET utf8 COLLATE utf8_bin;

CREATE TABLE phpbb_posts_ratings_penalty (
user_id MEDIUMINT UNSIGNED NOT NULL ,
poster_id MEDIUMINT UNSIGNED NOT NULL ,
penalty TINYINT UNSIGNED NOT NULL,
PRIMARY KEY (user_id, poster_id)
) TYPE = MYISAM CHARACTER SET utf8 COLLATE utf8_bin;

CREATE TABLE phpbb_posts_ratings_modpoints (
time INT UNSIGNED NOT NULL ,
user_id MEDIUMINT UNSIGNED NOT NULL ,
points TINYINT UNSIGNED NOT NULL ,
PRIMARY KEY ( time , user_id )
) TYPE = MYISAM CHARACTER SET utf8 COLLATE utf8_bin;

ALTER TABLE phpbb_posts
ADD posts_ratings_score TINYINT UNSIGNED NOT NULL,
ADD posts_ratings_standard_diviation SMALLINT UNSIGNED NOT NULL,
ADD posts_ratings_voteround_closed BOOL NOT NULL,
ADD posts_ratings_shadowed BOOL NOT NULL,
ADD posts_ratings_penaltized BOOL NOT NULL,
ADD INDEX (posts_ratings_voteround_closed, posts_ratings_shadowed);

#-----[ OPEN ]------------------------------------------
#
includes/constants.php

#-----[ FIND ]------------------------------------------
#
// Additional tables

#-----[AFTER, ADD ]------------------------------------------
#
define('POSTS_RATINGS_VOTES_TABLE', $table_prefix . 'posts_ratings_votes');
define('POSTS_RATINGS_VOTES_CHI_TABLE', $table_prefix . 'posts_ratings_votes_chi');
define('POSTS_RATINGS_PENALTY_TABLE', $table_prefix . 'posts_ratings_penalty');
define('POSTS_RATINGS_MODPOINTS_TABLE', $table_prefix . 'posts_ratings_modpoints');
					
#-----[ OPEN ]------------------------------------------
#
posting.php

#-----[ FIND ]------------------------------------------
#
/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/message_parser.' . $phpEx);

#-----[AFTER, ADD ]------------------------------------------
#
// POSTS_RATINGS
include($phpbb_root_path . 'includes/functions_posts_ratings.' . $phpEx);

#-----[ FIND ]------------------------------------------
#
$redirect_url = submit_post($mode, $post_data['post_subject'], $post_data['username'], $post_data['topic_type'], $poll, $data, $update_message);

#-----[BEFORE, ADD ]------------------------------------------
#
// POSTS_RATINGS
posts_ratings_new_posts($mode);

#-----[ FIND ]------------------------------------------
#
$next_post_id = delete_post($forum_id, $topic_id, $post_id, $data);

#-----[BEFORE, ADD ]------------------------------------------
#
// POSTS_RATINGS
posts_ratings_delete_post($post_id, $data);

#-----[ OPEN ]------------------------------------------
#
viewtopic.php

#-----[ FIND ]------------------------------------------
#
/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);

#-----[AFTER, ADD ]------------------------------------------
#
// POSTS_RATINGS
include($phpbb_root_path . 'includes/functions_posts_ratings.' . $phpEx);


#-----[ FIND ]------------------------------------------
#
// Output the posts
$first_unread = $post_unread = false;

						
#-----[BEFORE, ADD ]------------------------------------------
#
// POSTS_RATINGS
$user->setup('mods/posts_ratings');
$posts_ratings_data =& posts_ratings_fetch_votes($post_list, $rowset);


#-----[ FIND ]------------------------------------------
#
// Dump vars into template
$template->assign_block_vars('postrow', $postrow);

						
#-----[BEFORE, ADD ]------------------------------------------
#
// POSTS_RATINGS
$postrow = array_merge($postrow, posts_ratings_display_rating($row, $posts_ratings_data, $forum_id));

#-----[ OPEN ]------------------------------------------
#
cron.php

#-----[ FIND ]------------------------------------------
#
define('IN_PHPBB', true);
define('IN_CRON', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

#-----[AFTER, ADD ]------------------------------------------
#
// POSTS_RATINGS
include($phpbb_root_path . 'includes/functions_posts_ratings.' . $phpEx);

#-----[ FIND ]------------------------------------------
#
// Unloading cache and closing db after having done the dirty work.

#-----[BEFORE, ADD ]------------------------------------------
#
// POSTS_RATINGS
posts_ratings_cron();
					
				
#-----[ OPEN ]------------------------------------------
#
memberlist.php

#-----[ FIND ]------------------------------------------
#
/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

#-----[AFTER, ADD ]------------------------------------------
#
// POSTS_RATINGS
include($phpbb_root_path . 'includes/functions_posts_ratings.' . $phpEx);

#-----[ FIND ]------------------------------------------
#
// a_user admins and founder are able to view inactive users and bots to be able to manage them more easily
// Normal users are able to see at least users having only changed their profile
 settings but not yet reactivated.

#-----[BEFORE, ADD ]------------------------------------------
#
// POSTS_RATINGS
$template->assign_vars(posts_ratings_profile($user_id));
                                  
#-----[ OPEN ]------------------------------------------
#
ucp.php

#-----[ FIND ]------------------------------------------
#
/**     
* @ignore
*/      
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require($phpbb_root_path . 'common.' . $phpEx);
require($phpbb_root_path . 'includes/functions_user.' . $phpEx);
require($phpbb_root_path . 'includes/functions_module.' . $phpEx);

#-----[AFTER, ADD ]------------------------------------------
#
// POSTS_RATINGS
include($phpbb_root_path . 'includes/functions_posts_ratings.' . $phpEx);

#-----[ FIND ]------------------------------------------
#
// Only registered users can go beyond this point
if (!$user->data['is_registered'])
{
	if ($user->data['is_bot'])
	{
		redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
	}

	login_box('', $user->lang['LOGIN_EXPLAIN_UCP']);
}

#-----[AFTER, ADD ]------------------------------------------
#
// POSTS_RATINGS
$template->assign_vars(posts_ratings_profile($user->data['user_id']));
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Almost forgot lol :D , Great mod i love that it has the acp module :) , but could you please give some more info on what those acp options mean, eg:

Code: Select all

Ignored permillage of votes (on the edges):
Karma configuration
Interval:
Amount of intervals:
Shadow configuration
The chance the shadow vote is correct: 
Shadow algorithm intervall:
Minium votes casted per user requirement:
Penalty configuration
Penalty permillage (of votes):
Minimum ammount of votes required:
Examined period:
Percentage when voting is disabled overall:
Percentage when voting is disabled per user:
Modpoints configuration
Amount of modpoints recieved for each new post:
Period the modpoints stay valid:
Base modpoints on karma?:


note: what are the modpoints for :oops:
User avatar
iyeru42
Registered User
Posts: 1120
Joined: Wed Feb 01, 2006 7:22 pm
Location: Madison, WI

Re: [BETA] Post Rating System

Post by iyeru42 »

Did you install this modification before doing that alter table? What MySQL Version do you have? Also, what php version do you have?
My Website | My MOD Requests | Foreign Key Docs (some topics are not requests)
"It's easy to rebel, but it's hard to be recognized."
notsa
Registered User
Posts: 253
Joined: Sat Jul 28, 2007 7:37 pm

Re: [BETA] Post Rating System

Post by notsa »

what do you mean if i did the alter table before i installed the modification?
Do you mean if i edited the files before i executed the sql commands, if so the answer is no, i did made the sql commands first then did the file edits.

Php version: 5.2.0
Mysql version: 5.0.27
User avatar
iyeru42
Registered User
Posts: 1120
Joined: Wed Feb 01, 2006 7:22 pm
Location: Madison, WI

Re: [BETA] Post Rating System

Post by iyeru42 »

The first SQL error you got (from the ALTER TABLE you did) was because the table you tried to ALTER didn't exist, meaning you didn't install the modification properly. Secondly, use the latest stable MySQL 4.
My Website | My MOD Requests | Foreign Key Docs (some topics are not requests)
"It's easy to rebel, but it's hard to be recognized."
User avatar
Alfatrion
Registered User
Posts: 166
Joined: Sat Feb 17, 2007 3:06 am

Re: [BETA] Post Rating System

Post by Alfatrion »

@notsa:

Tanks for testing this mod. Please report the version number of PRS that you are using. I saw you used 0.1.0 and the code is now at version is 0.2.1.

Please change, in the lastest download this has changed from
ADD INDEX ( posts_ratings_voteround_closed, posts_ratings_shadowed );
into
ADD INDEX ( posts_ratings_score, posts_ratings_shadowed );

Code: Select all

Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of usort(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in D:\localhost\test\includes\functions_posts_ratings.php on line 248 (and 723 and 764)
What version of PHP do you have?
And the third when i try to submit a rating (ie i click a start with the blue border on hover) iget this error:
Please let me know if this still exists in 0.2.x.

Code: Select all

General Error
SQL ERROR [ mysql4 ]

Field 'standard_diviation' doesn't have a default value [1364]
The table needs to have a default of '0'. I've insert a default value in the SQL query that create that table to fix this.
I dont know if this helps but i trid to fix the first error by inputing this line in the sql and it allowed it to go through:

Code: Select all

ADD posts_ratings_voteround_closed BOOL NOT NULL,
The index is just for making SQL queries faster. It still works without, just a little slower.
and finnally if it helps here are the converted install files i did:
At a later date (like for a RC release) I may provide a old style mod document and subsilver template files. For now only prosilver and modx are provided. The code just changes to much.
Almost forgot lol :D , Great mod i love that it has the acp module :) , but could you please give some more info on what those acp options mean, eg:
Yes I will put this question and the answer in the FAQ section here and at the demo board.
Last edited by Alfatrion on Fri Dec 28, 2007 10:01 pm, edited 2 times in total.
My abandoned (for own reference). mod: Post Rating System (website | screenshots | demo | support)
User avatar
Alfatrion
Registered User
Posts: 166
Joined: Sat Feb 17, 2007 3:06 am

Re: [BETA] Post Rating System

Post by Alfatrion »

iyeru42 wrote:The first SQL error you got (from the ALTER TABLE you did) was because the table you tried to ALTER didn't exist, meaning you didn't install the modification properly..
Or that there was a bug in the modification :!: I first used a boolean to indicate a post was closed and later needed to keep the rating stored. This meant I didn't need to boolean anymore. A score 0 means open for voting and anything above means closed for voting.
My abandoned (for own reference). mod: Post Rating System (website | screenshots | demo | support)
User avatar
iyeru42
Registered User
Posts: 1120
Joined: Wed Feb 01, 2006 7:22 pm
Location: Madison, WI

Re: [BETA] Post Rating System

Post by iyeru42 »

Alfatrion wrote:
iyeru42 wrote:The first SQL error you got (from the ALTER TABLE you did) was because the table you tried to ALTER didn't exist, meaning you didn't install the modification properly..
Or that there was a bug in the modification :!: I first used a boolean to indicate a post was closed and later needed to keep the rating stored. This meant I didn't need to boolean anymore. A score 0 means open for voting and anything above means closed for voting.
Don't close a topic's voting when it has one or more vote, always keep it open (Like in vBull.) Then, put a group permission setting that allows the group to turn off voting for a thread. (Need to edit first post.) A voting system is much more complicated than this, but it's good work so far.
My Website | My MOD Requests | Foreign Key Docs (some topics are not requests)
"It's easy to rebel, but it's hard to be recognized."
User avatar
Alfatrion
Registered User
Posts: 166
Joined: Sat Feb 17, 2007 3:06 am

Re: [BETA] Post Rating System

Post by Alfatrion »

I'm not in this to copy the features of other boards. Just like phpBB isn't exactly like vBull, my voting system isn't exactly like the voting system in vBull. I'm making my own decisions independently from what others have done.

I want a system that stimulates everyone to vote independently. I don't want people voting based on the current rating. Thus while being able to vote the users can not see the rating. This means it in the nature of this system that post get closed after sometime. At some point one want to know the rating of a post.

I'm relying heavy statistics and i need independent votes for that. The shadow module checks if a set of votes and another set of votes are Chi-square distributed to determine if a there is a vote from a other users that may be used to intelligently guess what a users would have votes.
Last edited by Alfatrion on Fri Dec 28, 2007 11:53 pm, edited 1 time in total.
My abandoned (for own reference). mod: Post Rating System (website | screenshots | demo | support)
User avatar
iyeru42
Registered User
Posts: 1120
Joined: Wed Feb 01, 2006 7:22 pm
Location: Madison, WI

Re: [BETA] Post Rating System

Post by iyeru42 »

So you vote, and no one else can vote? Hardly worthy of a download.
My Website | My MOD Requests | Foreign Key Docs (some topics are not requests)
"It's easy to rebel, but it's hard to be recognized."
User avatar
Alfatrion
Registered User
Posts: 166
Joined: Sat Feb 17, 2007 3:06 am

Re: [BETA] Post Rating System

Post by Alfatrion »

You're putting words in my mouth. You keep making statements about this mod that make no sense at all. I have no need for you to constantly writing negative comments about my mod. Don't bash others, just stay away if you don't like something.
My abandoned (for own reference). mod: Post Rating System (website | screenshots | demo | support)
User avatar
iyeru42
Registered User
Posts: 1120
Joined: Wed Feb 01, 2006 7:22 pm
Location: Madison, WI

Re: [BETA] Post Rating System

Post by iyeru42 »

Alfatrion wrote:You're putting words in my mouth. You keep making statements about this mod that make no sense at all. I have no need for you to constantly writing negative comments about my mod. Don't bash others, just stay away if you don't like something.
Are there other rating systems?
My Website | My MOD Requests | Foreign Key Docs (some topics are not requests)
"It's easy to rebel, but it's hard to be recognized."
User avatar
Alfatrion
Registered User
Posts: 166
Joined: Sat Feb 17, 2007 3:06 am

Re: [BETA] Post Rating System

Post by Alfatrion »

You could just try this one out, see how it plays out. You may find that you are pleasantly surprised. At this moment the mod contains about 2500 lines of code. The engine, the main part, what makes it tick, has bin written and needs some test with a larger set of data. If you don't like it then you could always switch to vBull.

Its not done. At this moment I'm making various pages show the rating and karma values. I also have idea's for forum based configurations and a interface for moderators.
My abandoned (for own reference). mod: Post Rating System (website | screenshots | demo | support)
notsa
Registered User
Posts: 253
Joined: Sat Jul 28, 2007 7:37 pm

Re: [BETA] Post Rating System

Post by notsa »

could you please take a look at these lines in the install:

Code: Select all

<find><![CDATA[$template->assign_block_vars('topicrow',]]></find>
						<action type="replace-with">$topicrow = </action>
						<find><![CDATA[)
);]]></find>
						<action type="replace-with"><![CDATA[,
		);

// POSTS_RATINGS
$topicrow = array_merge($topicrow, posts_ratings_display_rating_forum($row, $posts_ratings_display_rating_forum, $topic_id));

$template->assign_block_vars('topicrow', $topicrow);
]]></action>
There are two instances of ")
);" in the viewfourm.php. which should i replace?
User avatar
Alfatrion
Registered User
Posts: 166
Joined: Sat Feb 17, 2007 3:06 am

Re: [BETA] Post Rating System

Post by Alfatrion »

Normaly I would answer the first one you find after the previous search. But in this case please replace those two find & action with this:

Code: Select all

                                                <find><![CDATA[ 'S_TOPIC_TYPE_SWITCH'   => ($s_type_switch == $s_type_switch_test) ? -1 : $s_type_switch_test)
                );
]]></find>^M
                                                <action type="after-add"><![CDATA[// POSTS_RATINGS
$template->alter_block_array('topicrow',
        posts_ratings_display_rating_forum($row, $posts_ratings_data, $topic_id),
        array('TOPIC_ID' => $topic_id),
        'change'
);
]]></action>^M
I replace this because I fear the old stuff breaks other mods.
My abandoned (for own reference). mod: Post Rating System (website | screenshots | demo | support)
User avatar
^[GS]^
Registered User
Posts: 274
Joined: Sun Aug 06, 2006 10:59 pm
Location: Argentina

Re: [BETA] Post Rating System

Post by ^[GS]^ »

When I try to enter any topic, jump this error:

Code: Select all

Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of usort(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in d:\appserv\www\includes\functions_posts_ratings.php on line 262

Parse error: parse error, expecting `')'' in d:\appserv\www\gsz08\includes\functions_posts_ratings.php on line 503
Any ideas?

Return to “[3.0.x] Abandoned MODs”