Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/26/2017 in all areas

  1. More improvements to the Captain Hook panel which I think now makes it the definitive source for browsing and understanding what each hook does. You have always been able to click the line number to open the file to the line of the method in your code editor (if you have things set up correctly), but this new version adds the following two new features: 1) Inline documentation for each hook - click method (last column) to expand/collapse the docs: 2) Direct link to PW API reference (from the Class::method link in the first column), eg clicking on "Pages::saved" will take you directly to this page:
    6 points
  2. Turns out I was using a selector that didn't work... I basically used the same one I use for regular search. In the end my selector just needed to define the parent, that was all. It all works nicely now. I've added a little LazyCron task too: I save the JSON in certain intervals to a (hidden) PW page/field, and only query this JSON data with JS. It really speeds things up. Otherwise (with browser cache cleared) I had to wait a few seconds till the suggestions were loaded. Thanks again for your help, suggestions + patience @AndZyk
    3 points
  3. This post is all about fieldsets in ProcessWire. Version 3.0.73 adds some nice UI upgrades when it comes to working with them. Plus we cover two new modules we have in development for managing groups of fields in fieldsets: https://processwire.com/blog/posts/processwire-3.0.73-and-new-fieldset-types/
    2 points
  4. 2 points
  5. Glad to hear it works now. If your site doesn't frequently change, there is an cache option available in the Typeahead plugin: But use whatever works best for you.
    2 points
  6. One of the most obvious uses of this is I can finally make my own bunch of SEO fields and apply them to multiple pages. SEO is a core part of every site I develop and MarkupSEO just isn't getting the development it requires.
    2 points
  7. Glad you got it working that way. As for the approach you are using - honestly not sure - I haven't worked with PayPal for a few years, so I am probably out of date on the latest practices, but at the time IPN was the way to go, but maybe now there is a better approach to verifying a payment as being legit and not a spoofed POST to your form.
    1 point
  8. I also had some troubles with sessions and form data sometimes ago. In my case I wanted to store multiple infos (fe first name, last name, email,...) inside a session. I have tried it with an array, but this didnt work. So I ended up to put my form data into an array and convert this array into a json array before storing it into a session and this works. After that I have outputed the form data by converting back the json array to a standard array (so jsonencode, jsondecode) was the key of success for me to work with multiple data and sessions. Best regards
    1 point
  9. Can you post your entire code (or at least the relevant bits)? That's simply how sessions work. You can't set new session vars and retrieve them in one go. From http://php.net/manual/en/features.sessions.php The keyword being "subsequent"
    1 point
  10. Thanks, Adrian. I managed to bootstrap in PW and change it all to $session and it worked! Must be that it doesn't like the multiple variables... although it does say this on the $session API page https://processwire.com/api/variables/session/ I hate not knowing why it wasn't working but I had tried and tested everything until using $session worked so perhaps that was just it. Re PayPal... not I'm not... I'm using something similar to this: https://paypal.github.io/PayPal-PHP-SDK/sample/doc/payments/CreatePaymentUsingPayPal.html and https://paypal.github.io/PayPal-PHP-SDK/sample/doc/payments/ExecutePayment.html and relying on the Approval URL. What do you think? Thanks again for all your help.
    1 point
  11. It sounds to me like things are being lost in the redirect to Paypal and back. Paypal should return most things back to you so you can grab them again. What I do is create and populate a PW page with the user's details, submit them to Paypal for payment, and then on return I can look up the user by an ID that I assign to them (stored in their page and also sent to Paypal). With that I can update their page with the payment details (verification of payment, etc). This of course does result in some entries which weren't finalized - sometimes people choose to back out at the last minute, but at least you have more info on this. Also, getting OT here, but are you making use of Paypal's IPN system (https://github.com/paypal/ipn-code-samples/blob/master/php/PaypalIPN.php) to verify payment?
    1 point
  12. You could use the API, or the AdminActions module's Page Maniplulator action. Maybe with settings like this:
    1 point
  13. I've done some websites with fractal directly using the style guide templates (twig) from within processwire. I've written a (german) medium post about it: https://medium.com/webdevs/living-styleguide-mit-fractal-und-processwire-e900f05e0b79 But I'm sure with recent updates to fractal stuff might no longer work exactly as explained. Overall it's been a nice experience to try it and for larger organisations / projects I'd expect it to make more sense. Our projects were kinda smallish and we're two people, so the overhead seemed to be a lot. As all templates came from the style guide I had to have all different versions of pages in it, so it's really easy to communicate with people, as you can view all of them in the style guide without actually having the real website in that state or getting it there locally (the website had different stages for an event registration).
    1 point
  14. Hello @dragan, here is a tutorial by me about this topic: Regards, Andreas
    1 point
  15. I recently needed a module that automatically fills the title field of a page using fields on that page. I couldn't see one that already existed so I made my own. This is mostly based on ProcessSetupPageName by @kixe which I use along with this module. Keep in mind I am very new to ProcessWire so perhaps somebody else can contribute or make a better one Note: The title is automatically hidden when using this module You can enter any string. To add a fieldname, subfield or property, you surround the fieldname with {}. Dot syntax allowed. Example: Fish: {parent.title} {myfield} https://github.com/nextgensparx/AutoPageTitles
    1 point
  16. Hi @adrianmak You can achieve this by using hooks and my ReCaptcha module. First install the MarkupGoogleReCaptcha module then in file ready.php, write the following code : /* * replace the LAST occurence of $search by $replace in $subject */ function str_lreplace($search, $replace, $subject) { return preg_replace('~(.*)' . preg_quote($search, '~') . '~', '$1' . $replace, $subject, 1); } /* * replace the FIRST occurence of $search by $replace in $subject */ function str_freplace($search, $replace, $subject) { $from = '/'.preg_quote($search, '/').'/'; return preg_replace($from, $replace, $subject, 1); } $captchamod = wire('modules')->get("MarkupGoogleRecaptcha"); wire()->addHookProperty('Page::captcha', function($event) use ($captchamod) { $event->return = $captchamod; }); wire()->addHookAfter('Page::render', function($event) { $template = $event->object->template; $page = $event->object; if ($template == 'admin' && !wire('user')->isLoggedin()) { $captchaScript = $page->captcha->getScript() . '</body>'; $captchaHtml = $page->captcha->render() . '</form>'; $event->return = str_freplace('</form>', $captchaHtml, $event->return); $event->return = str_lreplace('</body>', $captchaScript, $event->return); } }); wire()->addHookAfter('Session::authenticate', function($event) { $page = wire('page'); $template = $page->template; if ($template == 'admin') { if ($page->captcha->verifyResponse() == false) { wire('session')->logout(); wire('session')->redirect(wire('config')->urls->admin); } } });
    1 point
  17. I built this module because I needed a versatile solution to replace tags and simple if-blocks in some E-Mails and PDF documents. If you only need to replace static tags (no if-conditions), then you can use default PW api and need no module: $str = "My favourite color is {color}."; $texttools = $sanitizer->getTextTools(); echo $texttools->populatePlaceholders($str, ['color' => 'red']); // output: My favourite color is red. Usage: See the two example Files in the folder /replacements Methods: replacementsTable() Renders an overview of all available replacements (see the example in the Module's config file: Create new Replacements: Simply copy the sample file and adopt to your needs. Download: https://gitlab.com/baumrock/RockReplacer
    1 point
×
×
  • Create New...