Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/15/2024 in all areas

  1. The invoices application site profile that I uploaded last week now has a companion blog post: https://processwire.com/blog/posts/invoices-site-profile/ Thanks for reading and have a great weekend!
    10 points
  2. Hello, updating PHP means you need to install a newer version of PHP, it's not directly related to ProcessWire in first instance. It depends of your OS (Windows, Linux), it also depends if this is a shared host or a dedicated server. In a shared host you usually have an administration interface provided by your hosting service to manage your server. In a dedicated server you generally do everything yourself. About ProcessWire you have to check that the currently installed version is compatible with the PHP version you plan to install. Probably it won't be OK because you talk about years. If you plan to install PHP 8+ you'll also need to upgrade PW.
    2 points
  3. I think you need to extend your annual subscription and this automatically gives you access to the promailer-forum And yes it is possible to have multiple lists. see here:
    1 point
  4. @ngrmm works great, thanks for the hint with a variable!
    1 point
  5. @fruid The cache time should be fine. I'm guessing maybe it just didn't work on the first use for whatever reason, and the non-working data was cached.
    1 point
  6. @kaz you could store your class in a variable before echo // storing class in a variable $class = ($page->check == 1) ? "checkedClass" : "defaultClass"; // // or emtpy by default // $class = ($page->check == 1) ) "checkedClass" : ""; echo "<img class='$class' src='{$page->image->url}'>";
    1 point
  7. Similar to my suggestion to your earlier question, I think you should give your roles the necessary permissions to edit/create/add children for all the templates they will be working with. If you don't do this you're going to be fighting against what PW thinks that users with those roles are allowed to do and it will be more difficult to achieve what you want. Once those roles have the generic permissions to do what they need to do then focus on selectively taking away those permissions in your custom hooks according to your test on $user, $page, $parent, etc. Also, I've never understood the advantage to not explicitly setting access to every template. "Inheriting" access just seems like a recipe for confusion and accidental oversight. It only takes a short while to set the template access you want roles to have, and even less time if you use the Template Access module. Below is some code with demo logic for determining the allowed templates. You would replace that with your own logic which I expect would use some combination of $parent and $user. $wire->addHookAfter('ProcessPageAdd::getAllowedTemplates', function(HookEvent $event) { $allowed = $event->return; $parent_id = (int) $event->wire()->input->get('parent_id'); if(!$parent_id) return; $parent = $event->wire()->pages->get($parent_id); // Your custom logic here to remove any disallowed templates if($parent->template == 'basic_page' && $event->wire()->user->name === 'test-editor') { $allowed_template_ids = [29, 78]; foreach($allowed as $template_id => $template) { if(!in_array($template_id, $allowed_template_ids)) { unset($allowed[$template_id]); } } $event->return = $allowed; } });
    1 point
  8. I do it usually as follows: 1.) Create a file /site/translations.php <?php namespace ProcessWire; /** * TRANSLATABLE STRINGS * Define globally available translatable strings * * USAGE * place this file under /site/translations.php * __("My translatable string", $ferry); * The wire property $ferry refers to the textdomain of this file * */ __("My translatable string"); 2.) Define a wire derived object and place it in /site/ready.php /** * TRANSLATABLE STRINGS * Include translatable strings * @see /site/translations.php * @var $ferry */ $this->wire('ferry', '/site/translations.php', true); output in any template /** * output in template */ echo __("My translatable string", $ferry); Now you need to translate it only once, by using the string in any template. Usecase: strings like "read more" etc. For strings specific to a template you can use simply: /** * output in template */ echo __("My translatable string");
    1 point
×
×
  • Create New...