I want to know all the fields of the object returned by user_load().

I can analyze it while the site is running with var_dump(), but I want to see the fields without running Drupal, say by opening any (.module) files.

In general, how can I see the object fields of standard objects?


The full answer is: There's no single piece of code which can answer your question. Since PHP has weak and dynamic typing, any piece of code can access the global $user object and can remove/add something to the the object (whether this is always a good idea is an other question).

As a Java (which statically and strong typed) veteran this was the biggest difference to cope with.

BTW: Use dpm which comes with krumo support instead of var_dump this makes the output much more readable. An other aproach is to get familiar with a debugger (Xdebug or Zend).

| improve this answer | |

Take a look in your "users" table; the function returns all the columns of that table.

| improve this answer | |
  • 1
    I support this answer, although as pointed out by BetaRide, more data may be added, for example, by the profile module which is there just for that purpose. – Alexis Wilke Dec 21 '11 at 7:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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