Drupal's User Vote Module

This page provides the most up-to-date documentation on Drupal's User Vote module.

Installation
Configuration
Access Control
Viewing User Ratings
Voting
API
Removal

Installation

To install User Vote, please follow these steps:

  1. Install and enable the Voting API module (if this hasn't been done already). Please see the Voting API documentation for information on how to do this.
  2. Unpack the downloaded file and place it in your site's modules directory.
  3. Point your browser at the administer -> modules section of your Drupal site to enable User Vote.

Configuration

There are currently no configuration controls for this module, but this will soon change as development continues. Feel free to submit patches if you wish to contribute.

Access Control

To manage the access control settings for User Vote, go to administer -> access control. The module specific settings are in the "uservote module" section. At this time, the only option available is "view user ratings". Users with this permission will be able to view the "Ratings" section on user pages (i.e. http://<site name>/user/<user ID>).

Viewing User Ratings

To view ratings for a particular user, go to the user page for that user (i.e. http://<site name>/user/<user ID>). The "Ratings" section will only appear if the current user has the proper permsissions and at least one vote has been cast for the user.

Within the ratings section, there are currently two fields: the number of votes and the user's rating, a percentage. Support for multiple axes is lacking, and therefore only a single axis, the rating, is available (and subject to interpretation). Multiple axes support will be added soon.

Voting

At present, there is no user interface for voting. There will most likely be one at some point in the future. In order for a vote to be cast, one must call the API function uservote_set_user_rating().

Rationale: I was working on a project that required the rating of users whenever some of their content was rated. I've accomplished this by calling the above function from within another voting module, Node Review. A user interface was not necessary.

API

uservote_set_user_rating($user, $vote)
Rate a user.
  • $user: The user ID (an integer) of the user being rated.
  • $vote: The vote being cast. Currently, this is an integer representing a percentage, 0 to 100.
uservote_get_user_results($user)
Gets a user's voting results from the cache/database.
  • $user: The user ID (an integer) of the user we're looking for.
  • Returns: The results of the vote. (These are standard Voting API results. Please see the Voting API documentation for more information, or take a look at how these are used withing User Vote.)

Removal

To purge this module's data from the database, it is necessary to delete the Voting API rows with content type "user". A more targeted approach may be necessary as it can't be guaranteed that other modules don't make use of this.