Jump to content

psy

Members
  • Posts

    636
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by psy

  1. Getting closer to an initial release. Def been a learning experience using EB's self-proclaimed "easy API". Tip for other devs when implementing other vendors' API's - check the github pull requests before committing hari-kari. In my case https://github.com/eventbrite/eventbrite-sdk-php/issues/7 - wasn't me after all, just a MAJOR bug in the API. My alpha version has the suggested solution implemented and all good so far What I can say is that if you only want to pull info from your own EB stuff into PW, you won't need my module. Simply set up the necessary in EB and create a PW page/template to handle the web hooks, eg when an event is created in Eventbrite, you can pull that info into PW with: // Retrieve the request's body and parse it as JSON $eventbrite_json = @file_get_contents("php://input"); $eventbrite_obj = json_decode($eventbrite_json); /** * Eventbrite webhooks * attendee.checked_in - Triggered when an attendee’s barcode is scanned in. * attendee.checked_out - Triggered when an attendee’s barcode is scanned out. * attendee.updated - Triggered when attendee data is updated. * event.created - Triggered when an event is initially created. * event.published - Triggered when an event is published and made live. * event.updated - Triggered when event data is updated. * event.unpublished - Triggered when an event is unpublished. * order.placed - Triggers when an order is placed for an event. Generated Webhook’s API endpoint is to the Order endpoint. * order.refunded - Triggers when an order is refunded for an event. * order.updated - Triggers when order data is updated for an event. * organizer.updated - Triggers when organizer data is updated. * ticket_class.created - Triggers when a ticket class is created. * ticket_class.deleted - Triggers when a ticket class is deleted. * ticket_class.updated - Triggers when a ticket class is updated. * venue.updated - Triggers when venue data is updated. */ switch ($eventbrite_obj->config->action) { case 'event.created': $apiUrl = $eventbrite_obj->api_url; $apiUrlArr = explode('/events/', $apiUrl); $eventId = str_ireplace('/', '', $apiUrlArr[1]); $template = wire('templates')->get('name=test-eventbrite-webhook'); $p = new Page(); $p->template = $template; $p->title = $sanitizer->text($eventId); $p->name = $sanitizer->pageName($eventId); $p->parent = pages(1); $p->save(); break; default: break; } // tell eventbrite the webhook was received. http_response_code(200); // PHP 5.4 or greater
  2. @rick overcame that hurdle, now onto next one. Eventbrite is a great app but unfortunately : their v3 API doco is at best minimal and often misleading/confusing, the errors it reports are correct but don't accurately describe the exact problem, and what works on their browser based debug page doesn't always translate to the actual PHP API. In the above case, the order of the $_GET vars is important and when using one $param, the doco doesn't mention you also require another. In my case above, I needed both page_size and page (page_number). All good now. Still working on getting it all into a functioning PW module.
  3. Thanks @rick, feel like I'm channelling Thomas Edison - "I have not failed. I've just found 10000 ways that won't work." Tried everything combination I can think of and now very tired. Have posted in the Google EB support group but not hopeful of an answer. Maybe with a clear head tomorrow... Appreciate your suggestions
  4. it's not just the 'whole number' error. If I remove the page_size var, I get a similar error on the token var and I know $eb->access_code outputs the correct value. Seems like EB doesn't recognise the end of the URL when submitted via the API. Just want to confirm it's not me doing something dumb in the module code
  5. @rick Ummn, kinda, I think... put it this way, when I echo the full URL and enter it manually into the browser bar, I the correct response output on the screen:
  6. More... if I remove the page_size $_GET var, I get the same error for the access code
  7. 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
  8. 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
  9. 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
  10. 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);
  11. @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.
  12. 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/
  13. @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
  14. @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.
  15. @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.
  16. @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
  17. @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
  18. 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
  19. psy

    Site patterns

    @rajo forgot to mention in my post above... welcome back to ProcessWire
  20. 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
  21. There are loads of favicon generators. I generally use https://www.favicon-generator.org/ then point the link href to the appropriate directory & file
  22. Maybe make the form action '/' and then specify the actual URL in the js code rather than pulling it from the form?
  23. @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
  24. 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
  25. @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
×
×
  • Create New...