atomicadam
Forum Replies Created
-
Forum: Plugins
In reply to: [Force Login] Authenticate via javascript fetch for REST APIThanks Kevin. I think with your plugin and an .htpasswd file at the server level, one can put in a basic authentication gateway for a detached front end. But I think for more secure connections one needs to use the API OAuth, which seems fine for user apps, but for just delivering content to a detached front end I’m thinking of just making an Express server that connects directly to the WordPress MySQL server to read data.
Forum: Plugins
In reply to: [Force Login] Authenticate via javascript fetch for REST APIactually this only works due to being logged into the WP admin so the fetch is sending along the cookies to authenticate. logging in to WP w/ only browser JS from another domain does not seem possible.
Forum: Plugins
In reply to: [Force Login] Authenticate via javascript fetch for REST APII was able to resolve this – though I’m not sure I’m 100% happy with always returning 200 on a OPTIONS request (the redirect to readme.html will return a 200 in the OPTIONS preflight request). But here is the fetch request and .htaccess setup that works with Force Login turned on.
fetch(endpoint, { headers: new Headers({ 'Authorization': 'Basic ' + Buffer.from('user:pass').toString('base64'), 'Content-Type': 'application/json; charset=utf-8' }), credentials: 'include', mode: 'cors', method: 'GET', redirect: 'follow' }) .then(res => res.json()) .then(json => console.log(json))
and
<IfModule mod_headers.c> Header unset Access-Control-Allow-Origin Header always set Access-Control-Allow-Origin "https://localhost:3000" Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, PUT, DELETE" Header always set Access-Control-Allow-Headers "Origin,Content-Type,Accept,Authorization,X-Requested-With" Header unset Access-Control-Allow-Credentials Header always set Access-Control-Allow-Credentials true </IfModule> <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_METHOD} OPTIONS RewriteRule ^(.*)$ readme.html [QSA,L] </IfModule> <LimitExcept OPTIONS> AuthType Basic AuthName "API Service" AuthUserFile .htpasswd Require valid-user </LimitExcept>
I have not tried this with pretty URL rewrites – yet – so the endpoint looks like: https://api.site.com/?rest_route=/wp/v2/pages/2/
- This reply was modified 6 years, 1 month ago by atomicadam.
- This reply was modified 6 years, 1 month ago by atomicadam.
- This reply was modified 6 years, 1 month ago by atomicadam.
Forum: Plugins
In reply to: [Force Login] Authenticate via javascript fetch for REST APIMost likely this is just server setup. If I can get it working I’ll post.
Forum: Plugins
In reply to: [Force Login] Authenticate via javascript fetch for REST APIHi Kevin – Thanks for writing the plugin.
Yes, the fetch request works fine when the plugin is turned off.
Also the same request via curl works fine. So this is most likely a CORS issues and am just hoping you might have tried this yourself.
The fetch request looks something like this
fetch(endpoint, { headers: new Headers { 'Authenticate': 'Basic user:password' }, redirect: 'follow' }) .then(res => res.json()) .then(json => console.log(json));
Looking at the fetch documentation, I am now seeing I didn’t set a mode key value, I will try that. Will also follow up with more specific error messages.
- This reply was modified 6 years, 1 month ago by atomicadam.
Forum: Plugins
In reply to: [WooCommerce] Shipping Address not visible when total is $0Having the same issue. it is NOT working fine with Woo 2.5.3 and WP 4.4.2. What should I be looking into that could possibly be causing this.
Thanks,
I ended up with this solution. script enqueued 9999, though I think the real magic is the readystatechange check.
(function($) { document.onreadystatechange = function () { if (document.readyState === 'complete') { for (var i in CKEDITOR.instances) { CKEDITOR.instances[i].on('focus', function(e) { var target = $('#'+e.sender.name); $(target).trigger('click'); }); } } } })(jQuery);
I’ve tweaked the progression.js in my own fork to work better with GF and to use the whole #field_x element instead of the input. That way if a user click on a title, description, or input, the progression.js is triggered. With the code above, e.sender.name gets the ID i’m looking for, and I just trigger a click which triggers progression.js to do its thing.
Thanks for the help.
Hi ovann86 –
Thanks for the feedback. Yes, we are not using the 100% bar for that same reason.
Progression.js seems to work well and is simple. I have a fork of it that works better with GF. (https://github.com/adamplabarge/progression.js) It seems that it is no longer being developed by the author, thus forking and changing to suite your needs is best.
Thanks for the code example and letting me know what you are binding to. I’ll try this out later today or tomorrow.
Thanks,
Hi ovann86 –
Yes. Basically, we are using Progression JS (https://jquerycards.com/forms/date-time/progression-js/) to add tool tips to GF fields. Since the CKE input box is in an iframe, the progression.js code click capture does not appear to see the click. Or, since the CKE code takes a bit to load or instantiate, the normal $(document).ready() hook is firing before the CKE iframe has loaded, and I can’t seem to be able to capture click events inside the iframe.
(honestly, not sure how to best proceed. I don’t often work w/ iframes or least the ones we do work with are from other domains, so we don’t have control over content, clicks, etc, and didn’t have a lot of time to research and try out stuff, yesterday. would be happy for any suggestion) – thanks.
I’ll give the code a shot, this might be what I’m looking for. I scanned over the CKE docs, but didn’t see anything like this. Did I miss something?
Thanks jamesbAtPK for the update. I have not looked into this for a while, but I see there is an update for the plugin, of which we have not updated, due to the customizing of the plugin.
I’d love to say that I want to look into this sometime soon, but between Gravity Forms & WPML upgrade issues of late, I honestly would rather just shoot myself than ever use these plugins again.
jamesbAtPK, if you want to see what I customized, I can send you the code, just LMK.
Forum: Plugins
In reply to: [WP Google Search] set browser back button to go back on results paginationAwesome Peter,
Thanks.
Forum: Plugins
In reply to: [WP Google Search] set browser back button to go back on results paginationanswered my own question, but unfortunately requires to hack the plugin.
in wp-google-search.php line 157
$content .= ‘<div class=”gcse-‘ . $gcse_code . ‘” data-enableHistory=”true” data-linktarget=”_self”></div>’;add data-enableHistory.
You guys should allow for the shortcode to accept arguments that could just output some of the custom search API options found here: https://developers.google.com/custom-search/docs/element?hl=en
Wouldn’t be that hard to do and would make the plugin just that much more usable.
Forum: Fixing WordPress
In reply to: Nav Bar Menu Static Placement & Hover Actions Messed UpSame thing is happening to me.
Samuel Wood’s add_action to insert css trick seems to resolve it at least one site. I tried to change the Chrome settings, and no luck.
Thanks
I had to hack the plugin to get it to work ??
Basically, the plugin seemed to over ride any gform_pre_render hook for the checkboxes. I’ve not looked into it for a while, nor undated the plugin since it has been customized ?? but might have time to dig back in and address this issue again.
ok, so i got it to work by integrating my function into the class and adding actions to my the gform_pre_render after your in the class
add_filter( 'gform_pre_render_' . $form_id, array(__CLASS__, 'gform_pre_render') ); add_filter( 'gform_pre_render_' . $form_id, array(__CLASS__, 'acf_to_gf_populate_checkbox_static') ); add_filter( 'gform_pre_submission_filter_' . $form_id, array(__CLASS__, 'acf_to_gf_populate_checkbox_static') );