Info object/Userinfo

From Apibot
Revision as of 17:05, 20 July 2014 by Grigor Gatchev (talk | contribs) (userification)
Jump to: navigation, search

The MediaWiki API Userinfo request provides information about the MediaWiki account that the bot is using. The Apibot Info object (a property of the Mains object) typically requests it, and will consider it to be one of the types of info it provides - the "user" info.

In principle, all of this info can be retrieved through the infotype_element ( "info", $element ) function, where $element is the info element key in the site info array. (Often the info element will be array on its own, sometimes with yet more subarrays in it.) However, retrieving this info through special functions might be more convenient (and might make the bot and bot scripts PHP code more readable). A list of the implemented user info functions follows.

Common

  • user_info() - the entire user info structure
  • user_info_isset() - true if the user info is available, false if it is not
  • user_element ( $key ) - the user info element with this key
  • user_element_isset ( $key ) - true if this user info element is present, false if it is not
  • user_element_subs_count ( $key ) - the count of the subelements in the user info element (which presumably is an array) with this key
  • user_element_arraykeys ( $key ) - an array with the keys of the subelements in the user info element (which presumably is an array) with this key
  • user_sub ( $key, $subkey ) - the subelement with this subkey in the user info element (must be an array) with this key
  • user_sub_isset ( $key, $subkey ) - true if this user info subelement is present, false if it is not
  • user_sub_in_element ( $key, $subkey ) - true if this subelement is present in this user info element, false if it is not

Specific

  • user_id() - the user ID
  • user_name() - the user name
  • user_groups() - the user groups
  • user_implicitgroups() - the user implicit groups
  • user_rights() - the user rights
  • user_changeablegroups() - the user changeable groups
  • user_options() - the user options
  • user_preferencestoken() - the user preferences token
  • user_editcount() - the user editcount
  • user_ratelimits() - the user rate limits for different actions
  • user_email() - the user email
  • user_registrationdate() - the user registration date
  • user_acceptlang() - the languages the user accepts
  • user_group_in_groups ( $group ) - true if this group is among the user groups, false if it is not
  • user_group_in_implicitgroups ( $group ) - true if this group is among the user implicit groups, false if it is not
  • user_right_in_rights ( $group ) - true if this right is among the user rights, false if it is not
  • user_changeablegroups_add() - the user changeable groups that s/he can add
  • user_changeablegroups_remove() - the user changeable groups that s/he can remove
  • user_changeablegroups_add_self() - the user changeable groups that s/he can add to her/himself
  • user_changeablegroups_remove_self() - the user changeable groups that s/he can remove from her/himself
  • user_group_in_changeablegroups_add ( $group ) - true if this group is among the user changeable groups that s/he can add, false if it is not
  • user_group_in_changeablegroups_remove ( $group ) - true if this group is among the user changeable groups that s/he can remove, false if it is not
  • user_group_in_changeablegroups_add_self ( $group ) - true if this group is among the user changeable groups that s/he can add to her/himself, false if it is not
  • user_group_in_changeablegroups_remove_self ( $group ) - true if this group is among the user changeable groups that s/he can remove from her/himself, false if it is not
  • user_option ( $name ) - the user option with this name
  • user_ratelimits_by_action ( $action ) - the user ratelimits for this action
  • user_ratelimits_by_action_group ( $action, $group ) - the user ratelimits for this action and group
  • user_ratelimits_hits_by_action_group ( $action, $group ) - the user ratelimits for hits for this action and group
  • user_ratelimits_seconds_by_action_group ( $action, $group ) - the user ratelimits for seconds for this action and group
  • user_acceptlang_count() - the count of the languages the user accepts
  • user_acceptlang_names() - the names of the languages the user accepts
  • user_acceptlang_by_name ( $name ) - the language with this name the user accepts

See also