Viewing 15 replies - 31 through 45 (of 53 total)
  • Plugin Author Stephen Cronin

    (@stephencronin)

    Hi Groupemedia,

    Hmm, there’s no way to move the currency selection at the moment, but it’s been asked for before. I’ll look at how easy it would be to create quickly. If it’s not a quick thing, I could possibly write some JavaScript for you, which would move it to the place you want. That would need to be custom to your site, so I’d need to have a look at your site etc. I’ll let you know which option is best.

    Also, you’re saying it works – but it should still have the caching problem (if you are using a caching plugin). I have the theoretical solution, but it’s not in the released plugin yet. Is that still a problem for you? If it is, let me know and I’ll look at how quickly I can get that fix implemented.

    Cheers,
    Stephen

    Thread Starter groupemedia

    (@groupemedia)

    we offer high availability server on [ link deleted this isn’t the place to share hosting links ] so we decide to simply not using any cache.. has it is for now your plugin work perfectly.. no caching problem. I recommend it to everyone.

    Stil it is a real problem that the currency scroll is added at the end of the page. We should have a tag which let us install the table whereever we want.

    Plugin Author Stephen Cronin

    (@stephencronin)

    Okay, I’ll get you the ability to manually place the tag in the next week or so.

    astrasuite

    (@astrasuite)

    I would like that too, ability to place the currency scroll anywhere we want it. A shortcode would be nice. Just like WorldCurrency, although it is not working anymore, so back to the original, LocalCurrency, which is still great.

    One thing, why not use [ ] instead of <!– –> ?

    Thanks

    Plugin Author Stephen Cronin

    (@stephencronin)

    Hi Astrasuite (and Groupemedia),

    Not far from releasing a workaround using JavaScript.

    The plugin uses HTML comments (<!– –>) instead of WordPress shortcodes ([]) purely because it was written before shortcodes were added to WordPress. In some way I prefer HTML comments because when you disable the plugin, they are invisible to the user, while shortcodes will show in your content. But oh well, it’s best to use the standard…

    As part of trying to add the currency scroll anywhere you like, I started to implement shortcodes. But I ran into problems because shortcodes work on the single shortcode in question, while the plugin currently filters all the HTML comments on the one page.

    I’ve pretty much decided I need to rewrite/re-architect the whole plugin to cater for caching plugins and to add shortcodes..

    That will take a while obviously, so in the meantime I’ll give you some JavaScript to drop in your functions.php to move the currency select to anywhere you add a div with a certain id.

    Should be ready tomorrow or Monday.

    Plugin Author Stephen Cronin

    (@stephencronin)

    Okay, here is a workaround using JavaScript. You need to put the following HTML wherever you want the select box to show up:

    <div id="lc-selection"></div>

    You then need to drop the following code in functions.php (make a back up of it first!):

    function lc_move_select() {
    ?>
    	<script type="text/javascript">
    		var lcSelectForm = '';
    		var lcSelectTarget = '';
    		var lcAllForms = document.getElementsByTagName('form');
    		for (var i=0; i<lcAllForms.length; i++) {
    			if (lcAllForms[i].id.indexOf('lc_change')==0) {
    				// move it.
    				lcSelectForm = lcAllForms[i];
    				lcSelectTarget = document.getElementById('lc-selection');
    				lcSelectTarget.innerHTML = lcSelectForm.innerHTML;
    			}
    		}
    		lcSelectForm.parentNode.removeChild(lcSelectForm);
    	</script>
    <?php
    }
    add_action( 'wp_footer', 'lc_move_select' );

    That should move the select box to where you want it to go. Note that the select box may flash up at the bottom of the post before it disappears and then reappears in the desired location. Not sure if I can do anything about that, but let me know if it’s a problem and I’ll see.

    I’ll come up with a more permanent solution when I rewrite the plugin, but that could be a few months away depending on a whole heap of other factors.

    Cheers,
    Stephen

    astrasuite

    (@astrasuite)

    Sorry, I didn’t see your post earlier, and I forgot to check the “Notify me of follow-up posts ..”

    Anyway, thanks ! I have included that code in our functions.php, used the div line where I wanted, and it works !

    However, it doesn’t work for USD and GBP, I don’t know. I tried others at random and they work.

    Please check here with this post, for example. Maybe it’s different at your end ? Or something to do with Yahoo Finance ?

    https://www.astrasuite.com/astrablog/argento-audio-flow-rca-interconnects-1m/

    Also, I get these messages from our server’s error log, several of them, so I assume people are visiting the posts wwe have that has Local currency :

    [01-Mar-2014 05:32:38 UTC] PHP Fatal error: Call to undefined function get_from_yahoo() in /home7/esoundsc/public_html/astrablog/wp-content/plugins/localcurrency/getexchangerate.php on line 44

    Thanks
    Joe

    Thread Starter groupemedia

    (@groupemedia)

    I will try that and let you know. thanks!

    astrasuite

    (@astrasuite)

    Next day …

    Never mind about the server error log, the same message no longer appears, at least for now.

    USD is also working this time, which is unusual, but GBP and CAD for example still not working.

    Thanks !

    Plugin Author Stephen Cronin

    (@stephencronin)

    Hi Groupemedia, great, let me know how it goes…

    Plugin Author Stephen Cronin

    (@stephencronin)

    Hi Astrasuite,

    I’m not sure what’s going on. I can see that it’s coming back with an empty result from the server for GBP, where as AUD is returning an exchange rate. That suggests that something is wrong with the function talking to Yahoo finance.

    The other complication is that I can see in your source code that W3 Total Cache is minifying the CSS file. That won’t be causing the problem, but if W3 Total Cache is running there will probably be issues of one sort or another.

    This particular issue may be cause if W3TC has cached the database calls and just happened to cache a bad call to Yahoo where no result was returned. Clearing the cache may fix this problem – it’s worth a try, so can you please give that a go and let me know what happens.

    The other, bigger, problem is that the current version of Local Currency won’t work with caching plugins, including W3TC. When I visit the page you linked to, it shows me USD, when in fact I’m in Australia. That’s because the person who visited the page when W3TC cached it would have been in the US, and it cached that the USD is what should be shown.

    I am working on a version that will work with caching plugins, but it requires a complete rewrite so will take some time.

    Cheers,
    Stephen.

    astrasuite

    (@astrasuite)

    Hi, Stephen,

    Thanks for looking. Well, I disabled W3TC for the post I gave as an example, cleared all caches, refreshed, still the same (I can disable plugins per post using Plugin Organizer). As admin, I don’t need to clear cache really, as I set up W3TC not to cache for admin.

    https://www.astrasuite.com/astrablog/argento-audio-flow-rca-interconnects-1m/

    It shows me my local currency correctly. Can you check the link above if you are getting AUD, since I already disabled W3TC in above post ?

    Anyway, if the cache was giving a problem regarding location, I’m fine with it because there is the currency selector now. It’s just that it is missing some conversions like GBP or CAD. If it still doesn’t work, visitors can still select USD or EUR, which still can help at least. So better than nothing.

    Below is a post I have using WordCurrency. It was working so well, but one of the latest WordPress version upgrades screwed it up I think. Now it returns zero for any currency, and developer has disappeared. Anyway, it still has W3TC active, does it return AUD for you ?

    https://www.astrasuite.com/astrablog/oracle-cd-1000-transport/

    Thanks again

    astrasuite

    (@astrasuite)

    Sorry, still showing :

    /home7/esoundsc/public_html/astrablog/wp-content/plugins/localcurrency/error_log:
    [02-Mar-2014 15:29:47 UTC] PHP Fatal error: Call to undefined function get_from_yahoo() in /home7/esoundsc/public_html/astrablog/wp-content/plugins/localcurrency/getexchangerate.php on line 44
    [02-Mar-2014 15:29:57 UTC] PHP Fatal error: Call to undefined function get_from_yahoo() in /home7/esoundsc/public_html/astrablog/wp-content/plugins/localcurrency/getexchangerate.php on line 44
    [02-Mar-2014 15:45:52 UTC] PHP Fatal error: Call to undefined function get_from_yahoo() in /home7/esoundsc/public_html/astrablog/wp-content/plugins/localcurrency/getexchangerate.php on line 44
    [02-Mar-2014 16:57:36 UTC] PHP Fatal error: Call to undefined function get_from_yahoo() in /home7/esoundsc/public_html/astrablog/wp-content/plugins/localcurrency/getexchangerate.php on line 44
    [02-Mar-2014 18:13:59 UTC] PHP Fatal error: Call to undefined function get_from_yahoo() in /home7/esoundsc/public_html/astrablog/wp-content/plugins/localcurrency/getexchangerate.php on line 44
    [02-Mar-2014 19:05:52 UTC] PHP Fatal error: Call to undefined function get_from_yahoo() in /home7/esoundsc/public_html/astrablog/wp-content/plugins/localcurrency/getexchangerate.php on line 44

    etc.

    Plugin Author Stephen Cronin

    (@stephencronin)

    Hi Astrasuite,

    The getexchangerate.php file isn’t called when the page is created by WordPress. It’s called via Ajax after the page is loaded, so it runs independently on the server. It then manually loads WordPress, so that it can access the get_from_yahoo function and the options from the plugin.

    At a guess, I’d say it may not be loading WordPress properly. Have you moved the wp-content/plugins folder or the wp-content folder, etc to a different location (you’d know if you had)? Do you know of any other reason a script might be blocked on the server?

    When I just tried it now, it’s detecting that I’m in Australia, but when it contacts the server via Ajax, no exchange rates are returned (for anything, even the ones that worked yesterday). In fact it’s returning a 500 Internal Server Error. Maybe that’s because the server can’t find the get_from_yahoo function, but I’m not 100% sure.

    We could add echo commands at various points throughout the getexchangerate.php file to see where it’s getting up to and whether it’s been able to load WordPress etc. That would then be returned in the Ajax request and I could see it and troubleshoot further. I’d have to give that a bit more thought to work out what to echo and when. Let me know know if you’d like to do this.

    Another note: The plugin is quite old and although it works (for most people!), there are some areas where it doesn’t use modern best practice techniques for WordPress. One of these is the Ajax request. These days there is an actual Ajax API for WordPress, which didn’t exist when I wrote the plugin. I’m going to move to that when I rewrite the plugin and that might help with this problem, but once again that’s going to take some time, so it probably doesn’t help.

    Another thing I can look into is what WorldCurrency is doing as it doesn’t seem to return an error message. It was based on an earlier version of LocalCurrency, but the author made some changes to the way it worked and I also subsequently changed the way LocalCurrency works. I’m not sure how much difference there is now. It’ll take a couple of days but I’ll see if I can see any differences which may be relevant to this problem.

    Cheers,
    Stephen

    astrasuite

    (@astrasuite)

    Hi, Stephen, no problem, anything to help …

    I understand about the age of the program …

    Yes, I am now accessing the same pages in my office computer, and I don’t get any exchange rates returned.

    I never moved the plugins folder …

    Looking at WorldCurrency would be a good idea I guess. Author did mention that LocalCurrency was his inspiration. Everything is fine, except it is not returning anything now except zero.

    In its setting, I also have checked this, otherwise, I have problems with it.

    jQuery no conflict:

    Uses “jQuery” instead of “$” for calling jQuery functions. Usefull also if you have a noconflict version of jQuery included by other themes/plugins

    Thanks
    Joe

Viewing 15 replies - 31 through 45 (of 53 total)
  • The topic ‘Plugin won't work’ is closed to new replies.