Merge "(bug 18195) Allow changing preferences via API"
[lhc/web/wiklou.git] / includes / api / ApiQueryUserInfo.php
index cbb35ae..057dd15 100644 (file)
@@ -102,6 +102,12 @@ class ApiQueryUserInfo extends ApiQueryBase {
                        $vals['options'] = $user->getOptions();
                }
 
+               if ( isset( $this->prop['optionstoken'] ) &&
+                       is_null( $this->getMain()->getRequest()->getVal( 'callback' ) )
+               ) {
+                       $vals['optionstoken'] = $user->getEditToken( '', $this->getMain()->getRequest() );
+               }
+
                if ( isset( $this->prop['preferencestoken'] ) &&
                        is_null( $this->getMain()->getRequest()->getVal( 'callback' ) )
                ) {
@@ -197,6 +203,7 @@ class ApiQueryUserInfo extends ApiQueryBase {
                                        'rights',
                                        'changeablegroups',
                                        'options',
+                                       'optionstoken',
                                        'preferencestoken',
                                        'editcount',
                                        'ratelimits',
@@ -220,6 +227,7 @@ class ApiQueryUserInfo extends ApiQueryBase {
                                '  rights           - Lists all the rights the current user has',
                                '  changeablegroups - Lists the groups the current user can add to and remove from',
                                '  options          - Lists all preferences the current user has set',
+                               '  optionstoken     - Get a token to change current user\'s preferences',
                                '  preferencestoken - Get a token to change current user\'s preferences',
                                '  editcount        - Adds the current user\'s edit count',
                                '  ratelimits       - Lists all rate limits applying to the current user',