I want to extend the user profile with a rank (a decimal ranging from 500 - 2500), which needs to be updated on a regular basis (10 times per minute) for several users. (it is for http://achtungdiekurve.net/ ) I already implemented it with a seperate table, containing a rank field and implemented a table to show the rankings (http://achtungdiekurve.net/ranks ).

However, I want to use views to create this table. But I cant seem to alter the entity type user in such a way, that it shows Rank in the views forms. How to do this? My current code:

function achtung_entity_property_info_alter(&$info) {

  $info["user"]["properties"]["rank"] = array(
    "label" => t("Rank"),
    "description" => t("The rank of the user"),
    "type" => "decimal",
    "getter callback" => "achtung_get_entity_callback",
    "computed" => true,
    "entity views field" => true,
    "query callback" => "entity_property_query",
  watchdog("ACHTUNG entity info alter", "<pre>".print_r($info, true)."</pre>");
  return $info;

function achtung_get_entity_callback($account, $options, $name, $entity_type) {
  watchdog("ACHTUNG entity info callback", "<pre>".print_r($account, true)."</pre>");
  return 2;

2 Answers 2


Although I haven't had a chance to play with it myself just yet, assuming everything else is implemented correctly, it seems as though using EntityFieldQuery Views Backend as your Views backend should make your new Rank field visible to Views.


AFAIK, the default Views backend does not support Entity properties. Instead, it support fields from the Field API and known entity properties such as nid. In order to use your custom property as a Views field, you need to either use EntityFieldQuery Views Backend (as suggested by David Watson) or provide an implementation of hook_views_data() to expose your table and column to Views.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.