Extension talk:AWCmod

From Organic Design wiki
Revision as of 11:28, 16 September 2008 by Nad (talk | contribs) (notes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

New preference tab

  • Add a new preference sheet
  • Store new items as new user-attributes in users existing table

The InitPreferencesForm hook is called at the end of the form constructor and is passed with the PreferencesForm and Request objects

The main form rendering is done from the mainPrefsForm method

  • PreferencesUserInformationPanel( $this, &$userInformationHtml )

Saving new preferences

the savePreferences method calls the SavePreferences hook which passes the PreferencesForm, User and an error message string.

  • It should return false for no error condition.
  • It then calls $wgUser->saveSettings() so its up to that hook to add the prefs to the User object's mOptions array using setOption
  • getOption, getBoolOption, getIntOption, setOption
  • encodeOptions - returns a string of k=v\n from the User::mOptions array
  • decodeOptions - puts the passed options string into the User::mOptions array
  • saveSettings - save the options and other state into the database (runs UserSaveSettings hook after db update)
  • loadDefaults - calls the UserLoadDefaults passing the user object

Reset Preferences

There is also a ResetPreferences hook called with the PreferencesForm and User objects.

User login form

Rather than a redirect to the preferences page, the form of extra prefs would be best supplied in the login form as well.

All add account methods call the addNewAccountInternal method, then call User::saveSettings, and then call the AddNewAccount hook is called with the User object passed.

For form rendering, the mainLoginForm method calls the UserCreateForm hook passing the form template. templates/Userlogin.php defines the UsercreateTemplate which extends QuickTemplate. The form can be adjusted via the template's data['header'] property.