Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/28/2020 in all areas

  1. You can disable autocomplete on input elements with the autocomplete attribute. You can modify built-in forms through hooks by looking up which Process module is creating the form and then hooking after it's buildForm method. In this case, it's ProcessPageAdd. This hook sets autocomplete="off" on both the title and the name input fields: // site/init.php wire()->addHookAfter('ProcessPageAdd::buildForm', function (HookEvent $e) { $form = $e->return; // disable autocomplete for the title field $title = $form->getChildByName('title'); $title->attr('autocomplete', 'off'); // disable autocomplete for the name field $pwPageName = $form->getChildByName('_pw_page_name'); $pwPageName->attr('autocomplete', 'off'); });
    4 points
  2. Or you could also inherit the variable in your closure (anonymous function) from the parent scope (see the use() keyword) : wire()->addHookBefore('LoginRegister::createdUser', function($event) use($myRole) { ...
    2 points
  3. I think this may be the problem. 58 seems to be the ID of your template, but the config setting must be supplied with the ID of the page. In your example from the opening post, that page is “Members”, so you want to change Members’ template to owners (58) and put Members’ ID into $config->usersPageIDs. It’s probably a four digit number rather than a double digit template ID.
    2 points
  4. Try to put the $myRole variable definition inside the hook's anonymous function.
    2 points
  5. $format = $modules->get("TextformatterMarkdownExtra"); $format->format($str); echo $str;
    1 point
  6. Do you want this functionality available from the front-end or only from the admin side?
    1 point
  7. The key would be the "page-edit-created" permission. Read : https://processwire.com/blog/posts/language-access-control-and-more-special-permissions/#limit-edits-to-pages-user-created-page-edit-created
    1 point
  8. @thetuningspoon - What is UI Blocks?
    1 point
  9. It’s both! A user is a special kind of page. If you look at ProcessWire’s source code, you will see that the User class extends the Page class. At first it’s a little confusing, but it’s pretty cool because you roughly always deal with the same (or quite similar) things in PW. For example, you can find users using selectors just like finding pages of content. You can also modify and save them the same way, as you did in your hook. And if you want to add a field to your user (maybe a profile picture) you know just what to do: create a field and add it to the template, just like any other content.
    1 point
  10. Yes ? my misstake. i meant @adrian Things gets confusing sometimes.
    1 point
  11. Hi @zoeck See setFieldOptionsString() method I guess I've never came up with any migration for repeater fields, so this might need some custom integration. PRs welcome. I don't use Repeaters at all these days ?
    1 point
  12. Uh, I’ve never used LoginRegister, but some pointers: Not sure if you can use the hook arguments that way. I always use $event->arguments(0) (it’s a method). You should probably hook createUserReady instead. This fires immediately before the user is saved, so you don’t need to do it. You aren’t setting the user’s template to 57.
    1 point
  13. The image field trip up even the most seasoned developer from time to time. I almost allways have the PW API documents open in a tab when i do PW dev because you can´t keep everything in your head. It´s a great resource for all devs, and ofcourse using the TracyDebugger module by @dragan
    1 point
  14. @adrian works like a charm, thanks!
    1 point
  15. There's these events to hook into: https://getuikit.com/docs/sortable#events. Most likely you want the moved event. Here's some code stolen from the wild and a pen from the said wild: UIkit.util.on('#sortable', 'moved', function (item) { // do stuff }); And a specific example on sort order: https://stackoverflow.com/questions/47549648/uikit-how-to-get-order-with-the-sortable-component
    1 point
  16. 1 point
  17. This is not yet implemented, sorry. But it’s on my list and it will be the next feature to be added. @LostKobrakai @fruid Sorry for my stupidity, this is already implemented in a rudimentary way. You need to add the preinstalled field snipcart_item_custom_fields to your products template. This is a textarea where you can add custom configuration options for your product by using the data-item-custom*-* syntax described here: https://docs.snipcart.com/v2/configuration/custom-fields#product-custom-fields Sample code: data-item-custom1-name="Print label" data-item-custom1-required="true" data-item-custom2-name="Size" data-item-custom2-options="Small|Medium|Large" data-item-custom2-value="Medium" data-item-custom3-name="Gift" data-item-custom3-options="true|false" As I said - this is a rudimentary way to add options to your products. As this method only allows to select/change product options after they are added to the cart, I need to find a reliable way to generate those data-item-custom*-* tags from regular ProcessWire fields so they can be selected directly on the product detail page.
    1 point
  18. @Mamun Paul, Welcome to the forums and ProcessWire. Please don't double post. You asked the same question here and @adrian provided a response. Thanks.
    1 point
  19. Developing custom fields for ProcessWire is great! And it's easier than many might think once you get the basic concepts. But it's hard to learn those concepts by reading the code and doing some trial and error... That's why I think we need a good tutorial about that topic. It took me quite long, but now I feel knowledgeable enough to write such a tutorial. I also have the idea (or the need) for some new fields that might be helpful to the community. What I don't have is time ? So I thought to share the workload and share my knowledge while the development of the module (and testing, writing docs, etc) could be done by someone else under my supervision (hope that does not sound scary ? ). What do you think? I'm happy to hear your opinions - we are in the PUB ? Have a great week and happy coding!
    1 point
  20. omg thank you so much i was so stupid ? i changed it to this and it work foreach ($page->produkt_repeat_field as $building) { foreach ($building->r_galeria_image as $obrazok){ $thumbnail = $obrazok->size(450, 250); echo"<article>"; echo "<a href='{$obrazok->url}' class='fresco' data-fresco-caption='{$obrazok->description}' data-fresco-group-options='preload: [1,2], effects: {spinner: {show:150, hide:150 } }' data-fresco-group='kolace'><img src='$thumbnail->url' alt='obrazok'></a>"; echo"</article>"; } } i totally forgot i was looping throught repeat fields and not throught gallery, thank you sorry for my mistake
    1 point
  21. We recently launched the website “Resilienz-Kongress”, which is kind of an online summit / online conference about resilience (only in German language). The users can register as a participant and will receive daily emails during the conference timeframe with a conference room link for each day. Within this virtual conference room the participants can watch several interviews with experts and exchange ideas via comments. This concept is especially during the COVID-19 lockdown an interesting possibility for idea exchanges. Some technical details: • ProcessWire 3.0.155+ • ProCache • ProFields (RepeaterMatrix) • PrivacyWire • Seo Maestro • WireMail SendGrid • CodyFrame UI Framework • CopeCart (as the E-Commerce API) • Git, Node, Yarn, Gulp, PostCSS, Autoprefixer for a modern workflow combined with our individual local <-> stage <-> live environment and sync helper build with Python We heavily used the ability to specify custom Page classes (introduced in PW 3.0.152) and a lot of custom helper classes for cleaner code. Every frontend user registration with double opt-in is linked with the SendGrid API. The login process for frontend users is quite individual as we wanted to integrate a password-free login method similar to “Magic Links”. To achieve this we developed a “FrontendUserManagement” Class, which takes care of all the magic in the background. I’ll write another article about this topic as soon as I find the time, as I like the idea to implement this solution also as an open-source ProcessWire module. For the after-selling area we used CopeCart as our cart system with their IPN. With this combination we don’t have to handle the billing process at all. Also a clean cross-device affiliate tracking system between CopeCart, ProcessWire and SendGrid is integrated even though we’re currently not using the affiliate system at all. As frontend framework we used CodyFrame with an intense usage of CSS Custom Properties (for modern browsers with a classic fallback CSS for old browsers). https://www.resilienz-kongress.de/
    1 point
  22. I can't be limited to just 5... ListerPro MarkupSitemapXML ProFields Table ProFields RepeaterMatrix AdminPageFieldEditLinks AdminModalception Decimal TextformatterVideoEmbed ProCache ProDrafts UI Blocks
    1 point
  23. Hi huseyin, 1. Use the appropriate Sanitizer methods to test user input from post and get. Depending on the circumstance, you'll either want to validate (reject it completely if there's something wrong with it), or filter/sanitize it (accept it but strip out unwanted characters). If doing both filter and validate, do your validation AFTER your filtering. 2. Even more important than step #1 is to use escaping on your output. This means using htmlspecialchars() or htmlentities() or $sanitizer->entities() when you output any field from the database or user input to the page (if you have htmlentities setup on your field's output formatting, then you can skip this step for those fields). Even if you mess up on the filter/validation from #1, as long as you've escaped all of the html, you should be ok. 3. When using user input (get or post variables) inside ProcessWire selector strings, use the Sanitizer::selectorValue() method on the value first. Even better, just use Selector Arrays since selectorValue can sometimes strip out characters (quotes and commas) that you actually want to search for. 4. If you're using any SQL directly, you must use prepared statements to bind any user input, which automatically escapes the input for SQL. 5. For protection against Cross Site Request Forgery (CSRF), use ProcessWire's SessionCSRF class when building custom forms. See https://processwire.com/api/ref/session-c-s-r-f/ for details on how to use this. 6. Don't use GET for secret data (passwords, security codes, etc). That data can get picked up by browser extensions or appear in server logs that might get compromised. 7. Use SSL/https on your whole site.
    1 point
  24. I realise that this is a rather old request, but I've just added a config setting for this. It's available as of AdminBar 2.5.0 ? So far I've been unable to reproduce this issue. There's a check for RepeaterPage, in which case it should be skipped for this sort of purpose, and since RepeaterMatrixPage extends RepeaterPage that should kick in here as well. Please let me know if this still occurs, though, and I'll be happy to take a closer look!
    1 point
  25. We use Nginx. But the ProcessWire Site is non public.
    1 point
  26. The module can be found at https://github.com/MetaTunes/AdminInModal Use at your own risk! The hook is specific to my app, but I hope the following gives the general idea: wire()->addHookAfter('User::hasPagePermission', function(HookEvent $event) { // Get the object the event occurred on, if needed $user = $event->object; // An 'after' hook can retrieve and/or modify the return value $return = $event->return; // Get values of arguments sent to hook (if needed) $permission = $event->arguments(0); $p = $event->arguments(1); /* Your code here, perhaps modifying the return value */ // Is it a page we need to customise access for? $templates = ['Membership', 'Member', 'Profile', 'Subscription', 'Payment', 'MemberShop', 'Booking', 'NewsItem']; $permissions = ['page-edit', 'page-add']; if ($p and in_array($p->template, $templates) and $permission and in_array($permission, $permissions)) { // Get the member-user $currentUser = $this->users->getCurrentUser(); if ($currentUser and $currentUser->isLoggedin()) { if ($currentUser->hasRole('member')) { $email = $currentUser->email; $memberPage = $this->pages->get("has_parent=/memberships/, template=Member, email=$email"); if ($currentUser->memberOnly) $return = false; // Member-only users can only access pages as defined below if ($memberPage->id) { $membershipPage = $memberPage->parent; //... and a lot more like that ($profilePage etc.) ... $editablePages = new PageArray(); $addablePages = new PageArray(); $editablePages = $editablePages->add($membershipPage)->add($profilePage)->add($siblings)->add($currentSub)->add($shops)->add($subsPaymentPages)->add($draftNewsPages)->add($bookingPages); $addablePages = $addablePages->add($membershipPage)->add($memberPage); // pages where creation of children is allowed if ($editablePages->has($p) and $permission == 'page-edit') $return = true; if ($addablePages->has($p) and $permission == 'page-add') $return = true; } } } } // Populate back return value, if you have modified it $event->return = $return; });
    1 point
×
×
  • Create New...