public static function install($existingAddOn)
{
if (XenForo_Application::$versionId < 1040800)
{
// note: this can't be phrased
throw new XenForo_Exception('This add-on requires XenForo 1.4.3 or higher.', true);
}
// Checks if add-on is already present if it is skip creating the Custom User Field
if (!$existingAddOn)
{
$dw = XenForo_DataWriter::create('XenForo_DataWriter_UserField');
//Twitch
$dw->set('field_id', 'twitchUserProfile');
$dw->set('display_group', 'contact');
$dw->set('display_order', 5);
$dw->set('field_type', 'textbox');
$dw->set('required', 0);
$dw->set('show_registration', 0);
$dw->set('user_editable', 'yes');
$dw->set('viewable_profile', '1');
$dw->set('viewable_message', '0');
$dw->set('max_length', 25);
$dw->setExtraData(XenForo_DataWriter_UserField::DATA_TITLE, 'Twitch');
$dw->setExtraData(XenForo_DataWriter_UserField::DATA_DESCRIPTION, 'Enter your Twitch user name here to link to your channel page');
$dw->save();
}
// Deletes Custom User Field when add-on is uninstalled
public static function uninstall()
{
$dw = XenForo_DataWriter::create('XenForo_DataWriter_UserField');
$dw->setExistingData('twitchUserProfile');
$dw->delete();
}
}