Forum Replies Created

Viewing 11 replies - 1 through 11 (of 11 total)
  • TravisR

    (@travisr)

    @dirkgeeroms – check whether you properly implemented the correction to use ‘response.url’ instead of ‘response’.

    Thanks @bentumbler for saving me debug time on this one. I wanted to understand the change before adopting it, so I took a closer look and it seems to me that the problem is that the ssfa-bulk-download-engage- function in management.js:232 does not send a loc_nonce in the POST. However, the ssfa-bulk-action-engage- function in management.js:1139 does include a loc_nonce for the download function. So opted to borrow from that for the following change instead:

    Insert new line at management.js:239 of
    var loc_nonce = $('input#location_nonce_'+$uid).val();
    then add comma at end of management.js:287 and insert new line at management.js:288 of
    loc_nonce : loc_nonce

    This solution also worked for me (when paired with the correction to use response.url on what is now line management.js:302).

    Forum: Plugins
    In reply to: [File Away] Force Reindex

    Rob,
    Having looked at the code, I’m fairly confident that there is no indexing. It is parsing the directories on the fly. I encountered a similar issue, wherein directories that I was deleting were reappearing. It turned out that the problem was that my page included fileup shortcodes for those directories, where the makedir parameter was true.

    Forum: Plugins
    In reply to: [File Away] Upload failures
    Thread Starter TravisR

    (@travisr)

    FYI, the host has helped me resolve this. As I understand it, there was some sort of security filter in place that was being triggered by the content-length header. Thank you for you help.

    Forum: Plugins
    In reply to: [File Away] Upload failures
    Thread Starter TravisR

    (@travisr)

    I am running SSL, but I am not aware of any missing configurations. The site and base URLs in WordPress are https, FORCE_SSL_ADMIN is set in wp-config, the base URL on your plugin is set to https, and there’s an HTTPS redirect in .htaccess. The value of fileaway_mgmt.ajaxurl is showing https. Is there something in particular that you think I might have missed?

    Note that I have since confirmed this issue separate from your plugin (e.g., also in WordPress media uploads), so if I may borrow from George Costanza – it’s not you, it’s me. But if you have any ideas, I’ll take them. The host hasn’t been helpful thus far. Thanks.

    Thread Starter TravisR

    (@travisr)

    New issue created on Github.

    Thread Starter TravisR

    (@travisr)

    Noticed that wpcom_json_api_request_as_blog was filtering out my ‘user_id’ argument. After tweaking the Jetpack code to allow this argument to pass through, I was able to get a successful response from the read/following/mine endpoint, but it was empty. The read/liked endpoint gave me a different 403 response:
    {"error":"authorization_required","message":"An active access token must be used to query information about the current user."}

    I’m beginning to think that the authentication I need for these endpoints isn’t available via the tokens managed by Jetpack?

    Thread Starter TravisR

    (@travisr)

    I followed the Jetpack code a bit and found that wpcom_json_api_request_as_blog calls Jetpack_Client::remote_request without a user_id argument, which causes the request to use the ‘blog token’, via Jetpack_Data::get_access_token. Thinking that this might be the issue with trying to access user-centric REST API endpoints, I added a ‘user_id’ argument – via Jetpack_Options::get_option('master_user') – but unfortunately received the same result. I can verify that there are separate tokens available for the master user and the blog, but neither appear to allow me access to the read/following/mine or read/liked endpoints. Not sure where to look next, so any further tips would be appreciated. Thanks.

    Thread Starter TravisR

    (@travisr)

    Thanks Stefanie! wpcom_json_api_request_as_blog looks like it’s exactly what I wanted, but my first attempt to use it has failed. I built a simple plugin, ran it on my Jetpack connected blog, and received a 403 response:
    {"error":"unauthorized","message":"That API call is not allowed for this account."}

    The calling code is just
    Jetpack_Client::wpcom_json_api_request_as_blog('read/following/mine')
    and the response indicates that the query was properly sent to https://public-api.wordpress.com/rest/v1.1/read/following/mine

    Is the Jetpack authentication constrained to accessing a subset of the full REST API, or have I missed a step, or done something wrong? Thanks.

    Thread Starter TravisR

    (@travisr)

    These are almost exclusively all-day events that are occurring in multiple time zones and are viewed in multiple time zones, so the ideal option is to just show the event according to the event timezone. I did this by adding a filter on amr_events_after_sort that will convert everything to the local time of the WordPress installation. In case anybody is interested, here’s the code:

    function ConvertEventToLocalTime( $events ) {
        $localTZName = get_option('timezone_string');
        // All of our offset operations are in seconds
        $localOffset = get_option('gmt_offset') * 3600;
        // The timezone string can be empty if the timezone was set as a UTC offset,
        // in which case we will derive it from the offset.
        if('' == $localTZName) {
            $localTZName = timezone_name_from_abbr('', $localOffset, date('I'));
            // If we still couldn't obtain the local timezone then don't convert
            if(false === $localTZName) {
                return $events;
            }
        }
    
        $localTZ = new DateTimeZone($localTZName);
        foreach ($events as $event) {
            if (isset ($event['EventDate']) and (is_object ($event['EventDate']))) {
                $dt = $event['EventDate'];
                // Determine the time difference between the event timezone and
                // the local timezone. DateTime->getOffset returns the offset
                // in seconds, whereas the gmt_offset option is in hours.
                $secondsToAdd = $dt->getOffset() - $localOffset;
                $interval = new DateInterval('PT'.abs($secondsToAdd).'S');
                // Change the timezone. This will NOT change the UTC time.
                $dt->SetTimezone($localTZ);
                // Adjust the UTC time so that the relative time is the same.
                $secondsToAdd > 0 ? $dt->add($interval) : $dt->sub($interval);
            }
        }
        return $events;
    }
    add_filter( 'amr_events_after_sort', 'ConvertEventToLocalTime' );

    Thread Starter TravisR

    (@travisr)

    It just occurred to me that this is no different than excluding the [gn_accordion] wrapper. Feel free to ignore this proposal.

Viewing 11 replies - 1 through 11 (of 11 total)