User login

Grokking Voting API for Community Managed Taxonomy

I hope this will also be useful to people trying to use votingapi to rate arbitrary content, such as the promised fish.

From votingapi_add_vote (which should not be called directly, but is used by )

One thing which is incorrect in the module's in-code documentation is this:

@param $value_type
* An int representing the value_type shared by the aggregated votes.

In fact, value_type is a string, a 20 character varchar. So there's no need to try to look up what integer the standard types map to-- just use the name:

* 'percent' -- 'Value' is a number from 0-100. The API will cache an average for all votes.
* 'points' -- 'Value' is a positive or negative int. The API will cache the sum of all votes.
* 'option' -- 'Value' is an int representing a specific option. The API will cache a vote-count for each option.

On my end I need to make sure that I don't insert duplicate values into my cmt_term_node etc. tables, but instead hand it off to votingapi to count another vote with the same content_id (vapi_id on my end).

I hope this will also be useful to people trying to use votingapi to rate arbitrary content, such as the promised fish.

From votingapi_add_vote (which should not be called directly, but is used by )

One thing which is incorrect in the module's in-code documentation is this:

@param $value_type
* An int representing the value_type shared by the aggregated votes.

In fact, value_type is a string, a 20 character varchar. So there's no need to try to look up what integer the standard types map to-- just use the name:

* 'percent' -- 'Value' is a number from 0-100. The API will cache an average for all votes.
* 'points' -- 'Value' is a positive or negative int. The API will cache the sum of all votes.
* 'option' -- 'Value' is an int representing a specific option. The API will cache a vote-count for each option.

On my end I need to make sure that I don't insert duplicate values into my cmt_term_node etc. tables, but instead hand it off to votingapi to count another vote with the same content_id (vapi_id on my end).

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.