• Resolved stvace

    (@stvace)


    Dear Jeremy,

    I hope you are well.

    I’ve currently got someone working on the issue I emailed you about recently; although, a snag has been hit.

    Basically, the person has created the following code:

    Code Modified , Index.php Line 103


    $ip_address = $_SERVER[‘REMOTE_ADDR’];
    $url = “https://ip-api.com/json/” . $ip_address;
    $response = wp_remote_get( $url );
    $response_body = wp_remote_retrieve_body( $response );
    $location = json_decode( $response_body );

    if(isset($location->timezone)){
    $date = new DateTime();
    $timezone = new DateTimeZone($location->timezone);
    $date->setTimezone($timezone);
    $curday = $date->format(‘z’);
    }else{
    $curday=current_time(‘z’);
    }

    Having tested this, I can confirm that when using a VPN, it does change the relevant quote for different places (e.g., I’ve switched to Perth, Australia, and the day/quote changes as expected).

    However, weirdly, I’ve found that at about 7/8 PM local time (my computer is currently set to UTC Atlantic Time (Canada) -4 (although, I’m not in Canada) the quote changes to the next day/date (this should, I would expect, change after midnight local time). E.g., it’s the 6th February. At 7/8 PM the quote will change to 8th February, but the local time/date will still be 7/8PM on 6th February.

    This occurs when using different PCs that have no VPN, and also having tried on cellular telephones (Android, iPhone), using the cellular network (meaning it is not the local router at fault).

    The WordPress Server is set to GMT (UTC+0).

    So, the person helping is currently perplexed (as am I) as to what’s causing the Issue.

    I’m wondering if you are able to shed some light on a possible cause (you know the plugin better than anyone), so that I can feed this back to the person assisting, please?

    Thank you for any pointers you might be able to offer as to the issue.

    • This topic was modified 1 year, 9 months ago by stvace.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Me

    (@cyberws)

    I am not surprised. This is not an easy to implement function. I know it sounds easy but unfortunately there are many pitfalls.

    From my research in the past one really has to use Javascript and then pass that into the script. That solution seems to be the more accurate route to getting the client’s date as it should be pulled from the device itself.

    However that also means one must carefully sanitize the input to avoid SQL injection and other attack vectors.

    At this time I do not have the exact path otherwise I would have just added the function myself. Still Javascript feeding that information into the plugin is the real key for stable and predictable results.

    Cheers,

    Jeremy

    Thread Starter stvace

    (@stvace)

    Hello Jeremy,

    Thanks for the response – much appreciated.

    I will feed back your comments to the person who is lending me their assistance, and see what they can make of it.

    Hopefully, it can be resolved. At any rate, I’ve given it a try – regardless of what happens!

    Sincerely,

    S A

    Thread Starter stvace

    (@stvace)

    Dear Jeremy,

    The work I’m having done on your plugin is nearing completion. I don’t have the full details yet, but can confirm that a certain change does now draw the information from my device and displays the quote accordingly. One way I tested this was by deliberately changing my system date; The quote on my website altered acordingly.

    There’s a minor issue to resolve (at least I hope it’s minor), related to the Short Code (I now must use a different Short Code line than what you supplied).

    At any rate, I’m wondering if, when it’s completed, you want to take a look at the files? If so, can you indicate where I can send them to you? Otherwise, if not, I guess I will happily use it myself lol.

    All the best.

    Plugin Author Me

    (@cyberws)

    Hello,

    Sounds good. You may send them to support (AT) cyberws [DOT] com

    Thank you and hope all is well.

    Cheers,

    Jeremy

    Thread Starter stvace

    (@stvace)

    Dear Jeremy,

    Thanks for the reply and contact address.

    When it’s all finished, I will email you the plugin ‘.zip’ file to the address indicated.

    Cheers for now.

    Thread Starter stvace

    (@stvace)

    Hi Jeremy,

    I just dropped you an email at the address you mentioned.

    Thanks.

    S A

    Plugin Author Me

    (@cyberws)

    I got the email and will take a look. Thank you.

    Thread Starter stvace

    (@stvace)

    OK, I sent you a final file, so I will now close this thread.

    Thank again for your support.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Development of Plugin (Part 2)’ is closed to new replies.