Forum Replies Created

Viewing 15 replies - 1 through 15 (of 24 total)
  • The error is caused by the plugin’s Jwt_Auth_Public->validate_token() function not receiving any data from the “WP_REST_Request $request’ param. There is a disconnect between WordPress 6.1 and the plugin.

    In our custom code integrating this plugin we created a temporary work-around where we are recreating the request object and filling it with header and request data before sending it to the Jwt_Auth_Public->validate_token() method.

    Sample code for out pre-populated request object looks like this. Use with caution and adapt for your needs.

    $request   = new WP_REST_Request( '<your request method', '<your request path>');
    $request->set_headers( getallheaders() );
    $request->set_query_params($_REQUEST);
    
    $jwt = new Jwt_Auth_Public();
    $result = $jwt->validate_token($request);

    Plugin creator: please let us know if/when you can issue a permanent fix for this.

    • This reply was modified 1 year, 8 months ago by projectmiso.

    Did anyone find a resolution to this? We looked into changing our code to see if we can send requests differently but still getting the error “invalid token sent”

    args=”{\”body\”:{\”token\”:\”***\”},\”sslverify\”:false}” response=”{\”headers\”:{},\”body\”:\”Invalid token sent\”,\”response\”:{\”code\”:400,\”message\”:\”Bad Request\”},\”cookies\”:[],\”filename\”:null,\”http_response\”:{\”data\”:null,\”headers\”:null,\”status\”:null}}” response_code=400

    Thread Starter projectmiso

    (@projectmiso)

    We were able to isolate and fix the issue. This may not help anyone else since the issue is very specific to the setup of a few of our clients’ but not others. I am posting the cause and solution here anyway for posterity.

    Cause
    We have custom themes for most of our clients. The custom theme’s functions.php file contains core WordPress related code, while a series of include files (included from the functions.php), provide custom functionality in various areas. We share/reuse some of these custom files for certain clients where they have some common customization features.

    It turns out, in one of these include files, we had a few empty lines before the PHP start/opening tag. And this was the cause of the issue. The offending file has been like that for multiple years and we never had this issue before.

    The issue was detected/reported after we upgraded to WP 6.0 and performed QA. But we have a feeling that it started before that but went undetected.

    Solution
    Once we deleted the empty lines before the PHP opening tag, the error was fixed.

    Hope this helps someone.

    Thread Starter projectmiso

    (@projectmiso)

    Thanks for reaching out. Yes, the error started (or first detected) by our clients after upgrading to WP 6.0 and it occurs in Grid View only.

    We have other clients who are not experiencing this, who are also in V6.0. We are yet run the second round of bug tracking.

    for clients with the issues, we are running PHP 7.4.30, Apache 2.4.41 on Ubuntu 20.04.1. But we have other clients on the same setup without this issue. So, I am assuming it may not have anything to do with the platform versions.

    I will have our team compare between clients’ sites and do some local testing on Dev and try to figure out the source. I will update this post if/once we do.

    Thread Starter projectmiso

    (@projectmiso)

    Thank you for the recommendation. That was in fact one of the first things we tried. Unfortunately, there are no entries in the debug.log for this error/action. The only entries relating to the deletion action were some generic PHP notices regarding HyberDB (for DB load balancing) seen for other actions/page loads as well.

    [13-Jul-2022 19:07:04 UTC] PHP Notice: compact(): Undefined variable: read in /wp-content/db.php on line 765
    [13-Jul-2022 19:07:04 UTC] PHP Notice: compact(): Undefined variable: write in /wp-content/db.php on line 765

    Thread Starter projectmiso

    (@projectmiso)

    I should have researched some more. The checkbox “Force From Name Replacement” was responsible for the override to not work. Once unchecked, the override (WP hooks) are now working.

    Here is a basic example code if anyone is interested.

    add_filter( 'wp_mail_from', 'my_mail_from' );
    function my_mail_from( $email ) {
        return "[email protected]";
    }
    add_filter( 'wp_mail_from_name', 'my_mail_from_name' );
    function my_mail_from_name( $name ) {
        return "Your Preferred Name";
    }
    Thread Starter projectmiso

    (@projectmiso)

    That makes sense. Thank you for looking into this.

    Miah

    Thread Starter projectmiso

    (@projectmiso)

    Andy,

    Thank you for remembering this and working on it. You are amazing.

    I just tested it and it does the border on the right side, as you mentioned. I also noticed the following behaviors:

    – It keeps the category background and text color, over the featured event colors set by WordPress (parent plugin) default styling.
    – If no categories (with style) is assigned, the event does not show the Featured right border from your plugin, instead falls back on the WordPress (parent plugin) styles.

    Here is my question:
    Q. In absence of a category (with styles) assigned to an event, is there a way to set default featured event colors (background and text) through your plugin, in addition to the border, that would override the WordPress (parent plugin) defaults for featured events?
    Q. Is there a way to set whether Featured event styles set from your plugin can override the parent plugin default or the category styles or both?

    Miah

    Thread Starter projectmiso

    (@projectmiso)

    Andy,

    First, thank you for being open to this. It is a very good question as I can argue in favor of both equally. Some of our clients would want to show that an event is a Featured event and want that style to override the category styles. While other clients don’t care for the featured events to look different from its categories.

    I am not sure if you’d be happy by what I’d recommend, as it may affect the work you have to put in. Here are my recommendations.

    1. Add the option to set colors for featured events just like a category

    2. Overrides:
    2.a. There would be a dropdown, radio button or other selection control that will allow users to choose whether they want category styles to override featured styles or vice versa, OR
    2.b. Next the the Featured event style controls, you add a checkbox (or other UI control) to have it override category style. Have a label telling the user that if it is no selected/checked, category styles will take precedence if/when a category is present.

    I am also concerned about the additional styles (beyond just the title text and background colors) the Events Calendar plugin applies to featured events. You can take a look at month or list view to see what I am referring to. They also keep changing this style. Over the last one year, we have had to override their style about 4 times because of changes they released.

    Well, let me know your thoughts.

    Miah

    Thread Starter projectmiso

    (@projectmiso)

    I know, the featured events are not a category – as I mentioned in my original request. There is an option to mark an event as Featured from the admin Edit page.

    Once you do this, the category colors often either conflicts with the Featured Event style set by the main calendar plugin or is overridden. So, often times, the text color and the background color of the event title would be the same color or some other issue like that.

    If there was an option to set featured events with their own style through your plugin, that style could override any category styles, that way, we could ensure that the Featured style is set in a manner that does not mess up the display when there is also a category style.

    I have a screenshot here where there is a category with a dark red/maroon background and white text. But when one of them (on the 19th) is a featured event, the text color and background color becomes the same.
    https://clients.projectmiso.net/hcny/ScreenShot3.png

    Thank you,
    Miah

    projectmiso

    (@projectmiso)

    I hear you. I am somewhat familiar with searching and replacing WP DB content and the massive load and possibility of faults it may encounter.

    Do you think it is possible to add an option (setting) to allow clients to hide the second option (Replace name and Update Links) and only show the Just Replace option?

    In that case, we don’t have to keep explaining this to non-technical users.

    projectmiso

    (@projectmiso)

    Not sure if this thread is being watched still. I have had the same issue with two of my client’s websites. The Just Replace option works fine but Replace Name and Update Link does not actually replace the links.

    Both client sites have dev, staging and production environments. Production (live site) is never copied from staging or dev. Changes are simply re-done on production. Production, however, is copied with some interval to staging and dev. So, content on production should not have to factor in migration issues.

    Staging and dev go through a full database re-pointing of the domain after each migration by searching/replacing all text entries.

    We have 3.1.1 version of the plugin. When we use the Replace Name and Update Link, it does not seem to replace any of the links.

    Please let me know what other info I can provide to help detect the issue.

    Thread Starter projectmiso

    (@projectmiso)

    I will make sure to leave a review. We were very supportive and responsive to support queries.

    Thank you again.
    Miah

    Thread Starter projectmiso

    (@projectmiso)

    I see it working ??

    You did it. Appreciate the wonderful work you’re doing.

    Thanks,
    Miah

    Thread Starter projectmiso

    (@projectmiso)

    Andy,

    I just downloaded, installed and tested the 4.6.4.5. It looks like it is still getting overridden.

    https://snag.gy/snXrdV.jpg

    https://staging.olyclub.com/health-fitness/fitness-classes/

    Try the ones with green background. Those are supposed to be white letters.

    Miah

Viewing 15 replies - 1 through 15 (of 24 total)