Documentation

AddRatingVote

bool
CRatings::AddRatingVote(
 array Param
);

The method adds vote to a rating. Non-static method.

Method parameters

Parameter Description
Param Array of parameter values. The following values can be used as the keys for this array:
  • ENTITY_TYPE_ID – object of voting. For example: FORUM_TOPIC for forum topics, FORUM_POST for forum posts, BLOG_POST for blog posts, BLOG_COMMENT for blog comments. The list itself is not regulated, any available can be used.
  • ENTITY_ID – voting object ID
  • VALUE – specified rating value
  • USER_ID – user ID
  • USER_IP – user IP-address
All fields are required.

Examples of use

<?
// add negative rating to a topic
$arAddVote = array(
	"ENTITY_TYPE_ID"  =>  "FORUM_TOPIC",
	"ENTITY_ID"       =>  38,
	"VALUE"           =>  -1,
	"USER_ID"         =>  1, 
 	"USER_IP"         =>  '127.0.0.1',
);
CRatings::AddRatingVote($arAddVote);
?>


© «Bitrix24», 2001-2024
Up