githubEdit

Hooks

Through the hooks file, you can add some options that are not available in the script "out of the box."

To do this, place the necessary hooks in the file wp-content/plugins/premiumhook/premiumhook.php.

Insert the hooks after the lines indicated below on new lines (after the red line in the screenshot):

<?php
}

![Screenshot](../../.gitbook/assets/image (22)_eng.png)

Then, in the "Plugins" section, activate the "Premium Exchanger hooks" plugin.

![Screenshot](../../.gitbook/assets/image (1365)_eng.png)

Available Hooks:

chevron-rightBanners in the Affiliate Programhashtag

The affiliate program includes promotional materials.

By default, these are text materials and banners of various sizes.

There is a filter that allows you to change their names and quantity:

add_filter('pp_banners','my_pp_banners', 1000);
function my_pp_banners($banners){
	
	$banners = array(
		'text'=> __('Text materials','pn'),
		'banner1'=> __('Banners','pn').'(468 x 60)',
		'banner2'=> __('Banners','pn').'(200 x 200)',
		'banner3'=> __('Banners','pn').'(120 x 600)',
		'banner4'=> __('Banners','pn').'(100 x 100)',
		'banner5'=> __('Banners','pn').'(88 x 31)',
		'banner6'=> __('Banners','pn').'(336 x 280)',
		'banner7'=> __('Banners','pn').'(250 x 250)',
		'banner8'=> __('Banners','pn').'(240 x 400)',
		'banner9'=> __('Banners','pn').'(234 x 60)',
		'banner10'=> __('Banners','pn').'(120 x 90)',
		'banner11'=> __('Banners','pn').'(120 x 60)',
		'banner12'=> __('Banners','pn').'(120 x 240)',
		'banner13'=> __('Banners','pn').'(125 x 125)',
		'banner14'=> __('Banners','pn').'(300 x 600)',
		'banner15'=> __('Banners','pn').'(300 x 250)',
		'banner16'=> __('Banners','pn').'(80 x 150)',
		'banner17'=> __('Banners','pn').'(728 x 90)',
		'banner18'=> __('Banners','pn').'(160 x 600)',
		'banner19'=> __('Banners','pn').'(80 x 15)',
	);	
	
	return $banners;
}

If you want to keep only the 468 x 60 banner, simply remove all other lines from the previous hook:

add_filter('pp_banners','my_pp_banners', 1000);
function my_pp_banners($banners){
	
	$banners = array(
		'text'=> __('Text materials','pn'),
		'banner1'=> __('Banners','pn').'(468 x 60)',
	);	
	
	return $banners;
}

If you want to add your own size, add a line similarly. For example, if we want to add a 215 x 19 banner:

add_filter('pp_banners','my_pp_banners', 1000);
function my_pp_banners($banners){
	
	$banners = array(
		'text'=> __('Text materials','pn'),
		'banner1'=> __('Banners','pn').'(468 x 60)',
		'banner21519'=> __('Banners','pn').'(215 x 19)',
	);	
	
	return $banners;
}
chevron-rightTriggering the Course Parser When Importing Exchange Directions from a Filehashtag
add_action('premium_action_export_direction','myparser_premium_action_export_direction', 9);
function myparser_premium_action_export_direction(){
	if(function_exists('new_parser_upload_data')){
		new_parser_upload_data();
	}
}
chevron-rightUsing a Proxy When There Are Issues with Parsers 2.0hashtag

In quotes for the fields "ip", "port", "login", "password", specify your proxy details.

chevron-rightExchange Description in the Main Page Widgethashtag

The main page widget does not include an exchange description. If you need to add it, simply use the hook:

chevron-rightDetermining the IP Addresshashtag

The function pn_real_ip is responsible for determining the IP address. The purpose of this function is to return one real IP address. If, for some reason, you are not satisfied with the function's operation, you can use the filter:

chevron-rightMain Currency of the Sitehashtag

To calculate discounts, total amounts, and more, all sums are converted into a specific currency type. By default, the script considers USD as the main currency, but this value can be changed:

  1. Create the necessary currency code, for example, WMZ.

  2. Write a filter:

Now the internal currency of our site is WMZ.

Note that the exchange of internal currency will be conducted through double exchange (via USD).

chevron-rightDisabling the Security Check Iconhashtag
chevron-rightDisplaying the Exchange Rate in the "Applications" Section with Discount Considerationhashtag

In some situations, the calculation of the exchange rate may be incorrect

chevron-rightDisplaying the Total Payment Amount in the Applicationhashtag
chevron-rightDefault Text Translationhashtag

If you are using multilingual support, multiple text options are set in multilingual fields (for each language). When the required version is not available, the script substitutes the first possible one (corresponding to the admin panel language).

If you believe this is incorrect, you can set an error template using the filter:

chevron-rightShow the "Rate" Column in Table No. 5 by Defaulthashtag

By default, Table No. 5 on the main exchange page displays reserves for exchange directions instead of rates. If you want the rate to be displayed when the page is opened, set this hook:

![Screenshot](../../.gitbook/assets/image (388)_eng.png)

chevron-rightWhen There Are Issues with Applications from Mobile Deviceshashtag
chevron-rightProxy for Bestchange Parserhashtag

Bestchange Parser (Deprecated)

Before installing hooks, make sure to update the script itself according to the instructionsarrow-up-right!

The hook works on module version 2.6.1/2.7.1 and above (using your own proxy):

Bestchange API Parser

The hook works on module version 2.6.2/2.7.2 and above (using your own proxy):

The hook works on module version 2.6.2/2.7.2 and above (ability to change the BC domain (mirror) in the module's general settings): ![Screenshot](../../.gitbook/assets/image (28)_eng.png)

chevron-rightAllows Using Only 1 Character for Currency Codehashtag
chevron-rightAllows Using Only 2 Characters for XML Currency Code for Export XML File with Rateshashtag
chevron-rightHiding the "Select All Applications" Checkbox in the Admin Panelhashtag
chevron-rightHiding Exchange Directions on the Site Based on a Specified Schedule for the XML Filehashtag

The direction will remain active but will display a 404 error when accessed via a direct link on the site and will be hidden in the exchange direction selection table in the admin panel.

chevron-rightYour Custom Site Headerhashtag

By default, the title for any topic based on Premium Exchanger is formatted as [title] — [description], where:

[title] — the name of the site [description] — the description

If SEO plugins are not being used, this title can be modified using a hook.

For example, if you want to remove the title, you can use the following hook:

chevron-rightAffiliate program "tail"hashtag

By default, the "tail" of the affiliate program is set to the value "rid". The link looks like this: https://your_domain/?rid=[id]

To change this value to your own, you can use the filter:

This way, the "tail" will be the word "skidka".

chevron-rightURL for multilingual iconshashtag

Premium Exchanger uses a unified framework called Premium. The script that was activated earlier is responsible for the core functions, including multilingual support. If we want to add additional languages, we need to upload multilingual icons to all plugins, which can be inconvenient. For this purpose, we can use a special filter that specifies which plugin to source the flags from.

For example, if we want the flags to always come from premiumbox, we can write our own filter:

Last updated