dashed-slug.net › Forums › Full Node Multi Coin Adapter extension support › ERROR when activating second coin adapter
- This topic has 5 replies, 2 voices, and was last updated 5 years, 11 months ago by alexg.
-
AuthorPosts
-
January 1, 2019 at 4:09 pm #5432alexgKeymaster
It was running fine when I was only having 1 adapter but when I created the second adapter (php file) and tried activating it, it gave me the following error:
Fatal error: Cannot redeclare wallets_multiadapter_coins_filter() (previously declared in /var/www/html/wp-content/plugins/coin1.php:12) in /var/www/html/wp-content/plugins/coin2.php on line 12
January 1, 2019 at 4:12 pm #5433alexgKeymasterHello,
Yes, this makes sense. You have declared two functions with the same name. When adding the second adapter, either rename your second
wallets_multiadapter_coins_filter
function to something else, or simply add both coins using the same function.with regards
January 2, 2019 at 2:01 pm #5441alexgKeymasterI see. Could you please provide an example on how I could add both coins using the same function? do I just simply copy & paste the code below the first adapter?
January 3, 2019 at 8:28 am #5453alexgKeymasterSure, here’s an example. I have omitted most of the rows for clarity, hopefully you get the idea:
function wallets_multiadapter_coins_filter( $coins ) { $coins['ABC'] = array( // Coin symbol 'symbol' => 'ABC', // Coin name 'name' => 'ABC coin', // several rows omitted here // URL to an 64x64 icon for the coin. Or leave empty to pull the icon from 'assets/sprites/SYMBOL.png'. 'icon url' => 'http://www.example.com/abc-coin-icon-64x64.png', ); $coins['XYZ'] = array( // Coin symbol 'symbol' => 'XYZ', // Coin name 'name' => 'XYZ coin', // several rows omitted here // URL to an 64x64 icon for the coin. Or leave empty to pull the icon from 'assets/sprites/SYMBOL.png'. 'icon url' => 'http://www.example.com/xyz-coin-icon-64x64.png', ); return $coins; } add_filter( 'wallets_multiadapter_coins', 'wallets_multiadapter_coins_filter' );
January 13, 2019 at 9:58 am #5566alexgKeymasterI am sorry… I still don’t get it :-/
January 14, 2019 at 10:10 am #5570alexgKeymasterHello,
In the example above, the only thing that’s missing is the plugin headers (you can use the ones from https://gist.github.com/alex-georgiou/11e19523697d4c1a84c83874690466c3) and some rows that you need to add with the data for each of your two coins. Other than that, there is nothing else missing.
What is your question?
-
AuthorPosts
- You must be logged in to reply to this topic.