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
}_eng.png)
Then, in the "Plugins" section, activate the "Premium Exchanger hooks" plugin.
_eng.png)
Available Hooks:
Banners in the Affiliate Program
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;
}Dropdown List for Application Status in the "Applications" Section
add_filter('change_bids_filter_list', 'my_change_bids_filter_list');
function my_change_bids_filter_list($lists) {
if (isset($lists['status']['bidstatus'])) {
$stats = list_bid_status();
$statused = array('0'=> '--' . __('All','pn') . '--');
if (is_array($stats)) {
foreach ($stats as $k => $v) {
$statused[$k] = $v;
}
}
$lists['status']['bidstatus'] = array(
'title' => __('Status of order','pn'),
'name' => 'bidstatus',
'options' => $statused,
'view' => 'select',
'work' => 'options',
);
}
return $lists;
}Before: _eng.png) After: _eng.png)
Triggering the Course Parser When Importing Exchange Directions from a File
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();
}
}Using a Proxy When There Are Issues with Parsers 2.0
In quotes for the fields "ip", "port", "login", "password", specify your proxy details.
Exchange Description in the Main Page Widget
The main page widget does not include an exchange description. If you need to add it, simply use the hook:
Determining the IP Address
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:
Main Currency of the Site
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:
Create the necessary currency code, for example, WMZ.
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).
Displaying the Exchange Rate in the "Applications" Section with Discount Consideration
In some situations, the calculation of the exchange rate may be incorrect
Default Text Translation
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:
Show the "Rate" Column in Table No. 5 by Default
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:
_eng.png)
Proxy for Bestchange Parser
Bestchange Parser (Deprecated)
Before installing hooks, make sure to update the script itself according to the instructions!
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): _eng.png)
Hiding Exchange Directions on the Site Based on a Specified Schedule for the XML File
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.
Your Custom Site Header
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:
Custom redirect link after login
After logging in, the script automatically redirects the user to their personal account page. If you need to change the redirect link, you can use the following hook:
Affiliate program "tail"
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".
URL for multilingual icons
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