Jump to content

psy

Members
  • Posts

    620
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by psy

  1. Thanks @rick tried so many variations starting to get in brain-blip mode. Removed entirely the quotes around page_size and still same error. Edited original post
  2. Hi, me again - queen of the ProcessWire API Wrapper. Why re-invent the wheel when there are so many great, well-supported apps out there that don't impact on the core of PW? Almost see PW as a portal. Latest endeavour is a PW module for Eventbrite v3 API https://www.eventbrite.com/developer/v3/ The EB webhooks are a easy-peasy-lemon-squeezy. Love it! Can do any of the API GET calls providing they don't include any parameters, eg: $eb = $modules('EventbriteAPI')->login(); $ebUser = $eb->client->get('/users/me/'); $ebUserId = $ebUser['id']; // /users/:id/owned_events/ $result = $eb->get("/users/$ebUserId/owned_events"); Problem I'm having is with using parameters in the actual API, eg: $eb = $modules('EventbriteAPI')->login(); $ebUser = $eb->client->get('/users/me/'); $ebUserId = $ebUser['id']; $ebPath = "/users/$ebUserId"; $token = $sanitizer->text($eb->access_code); $pageSize = $sanitizer->int(5); $expand = array(); $result = $eb->client->get( $ebPath . "/events?&token=" . $eb->access_code . "&page_size=" . $pageSize ); Every time I use a parameter, I get the EB error message for the last one, in the example below, the paging limit: "There are errors with your arguments: page_size - Enter a whole number." Even stranger is if I manually create the URL, eg https://www.eventbriteapi.com/v3/users/2425020999999/events?&token=WNU7SPIEUUUIXXXXXX&page_size=5 in the EB API test environment, I get the correct result. Fairly certain it's an EB issue but wanting to double check I've got everything right and the PW API isn't doing anything too clever with the $_GET vars. Any help/suggestions most welcome. Thanks psy
  3. Was your question answered? Long shot that this job is still open... have been playing with Eventbrite API and webhooks to do what you're after
  4. psy

    PayWhirlAPI

    Example use: get a list of the logged-in user's subscriptions: <?php namespace ProcessWire; use PayWhirl; $payWhirl = $modules->get('PayWhirlAPI')->login(); $data = array('keyword' => $user->email); $userSubs = $payWhirl->getSubscriptions($payWhirl->getCustomers($data)[0]->id);
  5. @prestoav, @noelboss I also wanted a PayWhirl API for ProcessWire so just went ahead a built one. It's basic - simply a PW wrapper for the PayWhirl API but should be OK. Biggest gotcha I discovered was that at present, you need a paid PayWhirl account - not the freebie one. You could ask PayWhirl to grant access to your free account for development purposes... Will let you know their answer to my request for same.
  6. Seems I needed this at the same time as other ProcessWire devs. Timely! This module is simply a ProcessWire module wrapper for the PayWhirl API and being the initial release, may have a few unforeseen hiccoughs. Please be gentle with me when reporting any problems. As with all API's make certain your ducks are all lined up with the vendor first, in this case PayWhirl -https://app.paywhirl.com/ Download the module from GitHub at https://github.com/clipmagic/PayWhirlAPI Download the module from ProcessWire modules at http://modules.processwire.com/modules/pay-whirl-api/
  7. @Robin S You nailed it! Thank you. Don't recall changing any template permissions but must have done at some stage. They were certainly all set to the defaults. No matter, problem solved. Cheers, psy
  8. @BitPoet yes, really curious. Nothing in init.php and very little, let alone anything I would suspect would cause an issue in ready.php. I made an autoloaded module of custom functions rather than _func.php and will check it thoroughly, but again doubt it. It mostly comprises mark-up output. Will try your suggestions and report back - but not right now, it's 10pm on Friday night here and just a bit over it. Thanks for your ideas.
  9. @BitPoet tried the double quotes... tried everything I could think of including trying with only one tab open in FF and definitely logged out. Use Chrome for dev.
  10. @BitPoet, yep tried that (proven with var_dump($page->url); die ... in _init.ph contains the current page url or id or whatever... even tried: $url = $page->url; I've read the docs at https://processwire.com/api/ref/session/ and looked at core/Session.php - I can't see anything either. It's got me stumped! What's weirdest is if I type in the page path, eg '/rants/' - it all works
  11. @BitPoet thanks for the suggestion. I have $config->useFunctionsAPI = true; in my config.php and even after trying your suggestion, it failed. There is no problem with the $session redirecting to the login page with either coding version. The problem appears to be that somewhere, $session tries & fails to evaluate $page->httpUrl, or $page->id, or $page->path, or $page->anything If it helps, I'm using: PW version: 3.0.88 PHP version: 7.0
  12. I've used this code on another site (same web host) and it all works fine. When a visitor lands on a page and they're not logged, the page name/path/url/httpUrl (tried them all) is saved to a session var. Code in _init.php is: $loginPage = pages( 1085); if(!$user->isLoggedin() && $page->id != $loginPage->id) { // not for login page $session->set('returnPage', $page->path); // results in /http404/ stored in session var // $session->set('returnPage', '/rants/'); // works fine $session->redirect($loginPage->url); } Code in the LoginRegister template: if($user->isLoggedin() && !$input->get('profile') && !$input->get('logout')) { // login and go back to the previous page or go to the home page $goToUrl = $session->get('returnPage') ? $session->get('returnPage') : '/'; var_dump($session->getAll()); die; $session->redirect($goToUrl); } else { // let the LoginRegister module have control $content = $modules->get('LoginRegister')->execute(); } This var_dump shows that the returnPage session variable is stored as the path to the 404 error page ["returnPage"]=> string(9) "/http404/" I also tried $page->id with the resulting var (int) 27 which is the 404 Page id. Also tried namespace in the session var... It all worked fine when I manually typed in a valid page path, ie only weirdness when I used the $page var. Any help to explain why this is happening and how to fix greatly appreciated. tia
  13. psy

    Site patterns

    @rajo forgot to mention in my post above... welcome back to ProcessWire
  14. psy

    Site patterns

    You could look at @kongondo's Blog Module http://modules.processwire.com/modules/process-blog/ for your News site and this thread may give you some ideas on how to cut down front end development time
  15. There are loads of favicon generators. I generally use https://www.favicon-generator.org/ then point the link href to the appropriate directory & file
  16. Maybe make the form action '/' and then specify the actual URL in the js code rather than pulling it from the form?
  17. @Macrura Agree 100%. I view Canvas as an extended Bootstrap toolkit - use the bits I want, disregard the rest and add my own custom code without having to reinvent the wheel when I need a particular feature. It in no way limits my options for original design while saving me time & money on FE development. Anyway, works for me and each to their own
  18. For those interested in what's possible with the Canvas template suite & PW, below are a few examples. PS: all recommendations in the Showcase posts actioned and I'm NOT a themeforest affiliate. These HTML templates simply make my front-end-dev work easier. https://flywithmehorses.com.au/ - also in the PW Showcase forum at https://www.goldcoastholistichealth.com.au/ and another biz owned by the same client, https://www.goldcoastosteopathy.com.au/ - this one uses @kongondo 's blog module https://beautifulhumanway.com/ - also in the PW Showcase forum at
  19. @gmclelland Thanks for the feedback . This was my first module, dipping my toe in so to speak. I found the whole schema thing confusing and the module could definitely do with an update. Have taken your suggestions on board - plus a few other things I've learnt about json-ld schemas in the interim - and hope to release an update in the new year
  20. May or may not help... was getting a similar, but not quite the same, error after adding a single auto-load module. Forgot that bit and tried to load it again in a template with a local variable, eg: $mymodule = $modules->get('myModule'); Ambiguous error was: Error: Exception: Unknown Selector operator: '' -- was your selector value properly escaped? (in /home/xxx/xxx/wire/core/Selectors.php line 378) TracyDebugger's error description was no more helpful than the PW logs. While the error message was correct, it didn't truly reflect the cause of the problem. Only by disabling modules (in my case easier cos all worked before adding this particular module), and screening template code, was I able to resolve the problem. Solution for me was to access module's methods as static functions, eg "myModule::someFunction()" in the template. Key difference between 2.x & 3.x is namespaces. Is there a function used by index.php line 64 in your template (or _init.php or ready.php) that needs a namespace (or \)?
  21. @LAPS I haven't used conditional hooks. Instead, I'd have written it as: wire()->addHookAfter('Pages::saveReady', function($event) { $page = $event->arguments('page'); if ($page->template != 'user') return; $page->of(false); $page->title = $page->last_name . " " . $page->first_name; $event->return = $page; });
  22. @LAPS just noticed you have Page('template=user')::saveReady. Try changing it to Pages('template=user')::saveReady - ie Pages, not Page
  23. @LAPS hrmm... here is a similar hook that I use and it works fine: /***** Ensure the $page->seo->title field is not empty */ wire()->addHookAfter('Pages::saveReady', function($event) { $page = $event->arguments(0); $t = wire()->templates->get($page->template); if($t->hasField("seo_title") && !$page->seo_title) { $title = $page->get('headline|title'); $page->of(false); $page->seo_title = $title; $event->return = $page; } });
  24. Did you try turning off formatting before changing the page field data? wire()->addHookAfter('Page(template=user)::saveReady', function($event) { $page = $event->arguments('page'); $page->of(false); $page->title = $page->last_name . " " . $page->first_name; $event->return = $page; });
  25. @heldercervantes Oops... shared your great blog post on FaceBook and concerned it may have gone viral
×
×
  • Create New...