Learn R Programming

WikipediR (version 1.7.1)

user_information: Retrieve user information

Description

Retrieves information about a user, or set of users, from the MediaWiki API, including registration date, gender and editcount.

Usage

user_information(
  language = NULL,
  project = NULL,
  domain = NULL,
  user_names,
  properties = c("blockinfo", "groups", "implicitgroups", "rights", "editcount",
    "registration", "emailable", "gender"),
  clean_response = FALSE,
  ...
)

Arguments

language

The language code of the project you wish to query, if appropriate.

project

The project you wish to query ("wikiquote"), if appropriate. Should be provided in conjunction with language.

domain

as an alternative to a language and project combination, you can also provide a domain ("rationalwiki.org") to the URL constructor, allowing for the querying of non-Wikimedia MediaWiki instances.

user_names

The username(s) of the users you want information on - this should be provided as a vector. There is a hard limit of 50 distinct users per query, set by MediaWiki's API; in the event that you go over this, a warning will be issued and the query will only be performed for the first 50 names in the vector.

properties

The user properties you're interested in. Applicable properties are "blockinfo" (details about the user's block, if they are currently blocked), "groups" (the user groups the user is a member of), "implicitgroups" (groups they are a member of through inheritance, as a result of membership in other groups), "rights" (what permissions their group membership grants them), "editcount" (how many non-deleted edits they have), "registration" (the date when they registered), "emailable" (whether they are contactable through Special:EmailUser) and "gender" (their provided gender).

clean_response

whether to do some basic sanitising of the resulting data structure. Set to FALSE by default.

...

further arguments to pass to httr's GET.

Warnings

There are a few caveats with the data provided by user_information, mostly stemming from historical inconsistencies and peculiarities in MediaWiki.

groups and implicitgroups gives you the user's permissions and group membership on the project you are querying, not their membership on all projects - while you can find out if "Ironholds" is not a sysop on, say, enwiki, that doesn't mean they aren't a sysop elsewhere - there is no universal, API-accessible user groups listing.

As an extension of the lack of centrality in Wikimedia's infrastructure, registration tells you the date their account was created on the wiki you are querying. If they initially registered on that wiki, this is accurate - if they registered on a different wiki, this instead reflects the date and time that they first visited the wiki you're querying while logged-in. For users registered before 2006, when registration logging was introduced, the registration value represents not when they first registered, but when their first edit was, since that was used as an estimator for existing accounts when the field was first populated.

See Also

user_contributions for retrieving recent contributions made by a particular user.

Examples

Run this code
if (FALSE) {
#Retrieving information from a Wikimedia project
user_info <- user_information("en", "wikipedia", user_names = "David Gerard",
                             properties = "registration")

#Non-Wikimedia projects
user_info <- user_information(domain = "rationalwiki.org", user_names = "David Gerard",
                             properties = "registration")
}

Run the code above in your browser using DataLab