How do I add PLN currency to user upgrade system?

The allowed currencies are hard-coded. It is messy to make this change yourself. Ideally the devs should add more currencies.

Try manually editing xf_user_upgrade.cost_currency in the database to change the currency for an existing upgrade. Use phpmyadmin or run a query like this:

Code:
UPDATE xf_user_upgrade
SET cost_currency = 'pln';

The new currency appears to work fine once you change it in the database. But you should do some test payments afterwards to be sure.

Be aware that the currency type will reset when you edit the upgrade in the Admin CP because it hasn't been properly added to the software yet.
 
Perhaps there is a file that I could edit and add PLN there?

library/XenForo/DataWriter/UserUpgrade.php

Rich (BB code):
	protected function _getFields()
	{
		return array(
			'xf_user_upgrade' => array(
				'user_upgrade_id'      => array('type' => self::TYPE_UINT,    'autoIncrement' => true),
				'title'                => array('type' => self::TYPE_STRING,  'required' => true, 'maxLength' => 50,
						'requiredError' => 'please_enter_valid_title'
				),
				'description'          => array('type' => self::TYPE_STRING,  'default' => ''),
				'display_order'        => array('type' => self::TYPE_UINT,    'default' => 0),
				'extra_group_ids'      => array('type' => self::TYPE_UNKNOWN, 'default' => '',
						'verification' => array('$this', '_verifyExtraGroupIds')
				),
				'recurring'            => array('type' => self::TYPE_BOOLEAN, 'default' => 0),
				'cost_amount'          => array('type' => self::TYPE_FLOAT,   'required' => true,
						'verification' => array('$this', '_verifyCostAmount')
				),
				'cost_currency'        => array('type' => self::TYPE_STRING,  'required' => true,
						'allowedValues' => array('usd', 'cad', 'aud', 'gbp', 'eur')
				),
				'length_amount'        => array('type' => self::TYPE_UINT,    'required' => true),
				'length_unit'          => array('type' => self::TYPE_STRING,  'default' => '',
						'allowedValues' => array('day', 'month', 'year', '')
				),
				'disabled_upgrade_ids' => array('type' => self::TYPE_UNKNOWN, 'default' => '',
						'verification' => array('$this', '_verifyDisabledUpgradeIds')
				),
				'can_purchase'         => array('type' => self::TYPE_BOOLEAN, 'default' => 1),
			)
		);
	}

Admin CP -> Development -> Admin Templates -> user_upgrade_edit

Code:
	<xen:controlunit label="{xen:phrase cost}:">
		<xen:textbox name="cost_amount" value="{$upgrade.cost_amount}" size="3" />
		<xen:select name="cost_currency" value="{$upgrade.cost_currency}" inputclass="autoSize">
			<xen:option value="usd">USD</xen:option>
			<xen:option value="cad">CAD</xen:option>
			<xen:option value="aud">AUD</xen:option>
			<xen:option value="gbp">GBP</xen:option>
			<xen:option value="eur">EUR</xen:option>
		</xen:select>
	</xen:controlunit>

Changes to the admin templates and files will be overwritten during an upgrade.
 
Top Bottom