Jump to content

verdeandrea

Members
  • Posts

    129
  • Joined

  • Last visited

Everything posted by verdeandrea

  1. @bernhard Yes, I tested the hooks, but they have some issues. The main “problem” with that workflow—specifically, having a field to “enable” statuses on the parent (courses) template—is that if the user is creating a new course and needs a new status, they would have to: Save the course. Go back to the parent page to enable the status and save it. Return to the course page, select the newly enabled status, and save the course again. This essentially turns the process into a 2-3 step task, whereas I’m aiming for everything to be achievable within the single course creation step. At that point, it’s actually easier to create the new status page directly from the course page. Then, if it’s not automatically selected (because it already exists), the user can simply select it and save the course again in a second step. This would still be quicker overall compared to the alternative workflow. I know it might seem like a small detail, but I believe this adjustment could improve the user experience and make the workflow smoother.
  2. Hey @da² this is the issue: When the user creates a new status, but a status page with that title already exists, the new status does not get selected in the field automatically. The user has to select it manually a second time for it to be applied. I think @bernhard’s proposed solution might fix the issue. I’ll give it a try and let you know how it goes.
  3. Hi @ottogal, thank you for your response! The challenge is that “Courses,” “Masters,” and “Workshops” are just examples. I have no way of knowing in advance what my client will create, so I can’t rely on static “Status” groups. Were you suggesting dynamically creating a new status group every time a new “Courses” page is added? If so, I’ve experimented with something along those lines. The issue I encountered is that the PageReference field requires a defined parent to allow the creation of new pages. Unfortunately, I haven’t found a way to make this work dynamically. If you have ideas or workarounds for this, I’d be happy to explore them.
  4. Hey @bernhard, thank you for your response! The issue is not necessarily that the list could grow large over time (although that wouldn’t be ideal from a UI perspective). The real problem is that I need to display filters on the frontend, even if no courses currently have that status. However, I only want to show the filters relevant to a specific group of pages. Here’s an example to make it clearer: The user creates a new “Course 1” and sets its status to “Open.” Later, the status of “Course 1” is changed to “Closed.” On the website, I need to display both filters, “Open” and “Closed,” even if no pages are currently assigned the “Open” status. The challenge is figuring out which filters to show if there’s no explicit action by the user to associate a specific filter with the group of pages. Without that, there’s no way to determine that I should display “Open” but not, for example, “In Preparation.” I considered adding a field to the parent page (e.g., “Courses”) to manually manage the available statuses for that group, but I’m trying to keep the backend workflow as simple as possible for my client. That said, I’ll give your suggestion with the hook a try and will get back to you. Thank you very much for the idea!
  5. Hi @bernhard, I’m not sure if I fully understood your question, but I’ll try to explain the situation in more detail, hoping to clarify things. My client wants to have a section called “Academy,” where they can create an unlimited number of pages (e.g., “Courses,” “Masters,” and “Workshops”). These are just examples, but there could be more, each with different names. Each of these pages has subpages (the ones I referred to as “Course 1,” “Master 1,” etc.). These subpages can also be unlimited in number, but they all share the same template. The client wants to allow filtering of these pages (on the frontend) based on a property called “status.” However, the possible status values are not predefined, and they can vary for each group of pages. Additionally, the client wants to be free to add or remove statuses for each group of pages as needed. For instance: Pages under “Courses” might have statuses like “Open” and “Closed.” Pages under “Masters” could have statuses like “In Preparation” or “Registrations Open.” On the website’s “Courses” page, users should be able to select a filter by status, e.g., see only pages with the “Open” status or vice versa. Similarly, on the “Masters” page, users would see filters like “Registrations Open” or “In Preparation” and use those to filter all the master pages. I hope this gives you a clearer idea of what I’m trying to achieve, but feel free to ask if you need more information.
  6. I’m working on a website with the following structure: |-- Academy (template = academy) | |-- Courses (template = courses) | | |-- Course 1 (template = course) | | |-- Course 2 (template = course) | | |-- Course [...] (template = course) | |-- Masters (template = courses) | | |-- Master 1 (template = course) | | |-- Master 2 (template = course) | | |-- Master [...] (template = course) | |-- Workshops (template = courses) | | |-- Workshop 1 (template = course) | | |-- Workshop 2 (template = course) | | |-- Workshop [...] (template = course) |-- Course Status (template = course_status) | |-- Status A (template = status) | |-- Status B (template = status) | |-- Status [...] (template = status) The course template includes a PageReference field called course_status, which connects to the pages under the “Course Status” section. Editor users cannot directly access “Course Status” pages but can create new statuses via the PageReference field (using the “Allow new pages to be created from field” feature). Objective I need to filter the status options by course groups. For example: Courses under “Courses” should share the same statuses. Courses under “Masters” should have a different set of statuses. If a new status is created under “Course 1,” it should automatically appear for all “Courses” but not for “Masters” or “Workshops.” Current Solution I save a reference to the parent page (e.g., “Courses”) within the newly created status page. This allows me to filter status options based on the parent group. Here’s how I implemented it: $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if ($event->object->hasField == 'course_status') { $page = $event->arguments('page'); $parent = $page->parent; $statusPages = $this->pages->get(1028)->children("related_courses={$parent->id}"); $event->return = $statusPages; } }); $wire->addHookAfter('InputfieldPage::processInputAddPages', function(HookEvent $event) { $field = $event->object; if ($field->hasField && $field->hasField->name === 'course_status') { $coursePage = $field->hasPage; if ($coursePage) { $parentPage = $coursePage->parent; if ($parentPage && $parentPage->template->name === 'courses') { $selectedStatusPage = $field->value; if ($selectedStatusPage && $selectedStatusPage->template->name === 'status') { $selectedStatusPage->of(false); if (!$selectedStatusPage->related_courses->has($parentPage)) { $selectedStatusPage->related_courses->add($parentPage); $selectedStatusPage->save(); } } } } } }); The Issue The setup works well except in this scenario: 1. I create a new status (e.g., “Open”) under “Course 1.” It appears for all “Courses” as expected but not for “Masters,” which is correct. 2. If I try to create a status called “Open” under “Master 1”: A new page is not created (presumably because the title “Open” already exists). The “Open” status becomes available but isn’t automatically selected. I have to manually select it and save again to finalize the selection. Questions How can I ensure that the existing status is automatically selected in this case? Is there a better, more efficient way to manage the entire status setup? I’m open to restructuring if it leads to a smarter solution. Thanks in advance for your help!
  7. Hi and thanks for your module! I am trying to install it, but I get this errors: InputfieldWrapper: Skipped field 'cookie_groups' because module 'InputfieldAsmselect' does not exist InputfieldWrapper: Skipped field 'content_banner_text' because module 'InputfieldCkeditor' does not exist InputfieldWrapper: Skipped field 'content_banner_details_text' because module 'InputfieldCkeditor' does not exist InputfieldWrapper: Skipped field 'content_banner_privacy_link' because module 'InputfieldUrl' does not exist InputfieldWrapper: Skipped field 'content_banner_imprint_link' because module 'InputfieldUrl' does not exist InputfieldWrapper: Skipped field 'ask_consent_message' because module 'InputfieldCkeditor' does not exist I am on PW version 3.0.123 Do you know what can be causing this issue? Thanks
  8. I have the same issue, but I also noticed another problem: Initially I had Italian as main language, but I switched to English as main one. Now the new pages created by PageReference are created with the name "untitled-xxxxxxxxxxxxx" (xxx = a series of number) and they have no Italian title so the page has an error cause it is missing the main title. Does anyone know if I am missing some steps or should I also look into processInputAddPages?
  9. Does anyone knows on which files could I have a look to understand what is happening?
  10. I am sorry, that was a typo. The error is 410. Yes the error is always shown, also to guest users, if ProCache is enabled.
  11. Hello, I am using ProCache v3.1.8 on ProcessWire 3.0.96. Everything worked fine in the past, but today I noticed that the css file serverd by procache gives a 410 error. The file is there, I checked. I deleted the cached files, I deleted the css file, I looked into the .htaccess file looking for some clues about this problem but nothing worked. The only way i can see my website correctly again is disabling ProCache. Has anyone any clue on what could be the cause of the problem or on what should I do to fix it? Thanks!
  12. Thanks @wbmnfktr and @dragan! I was looking into it and it is acually way more complex than a single color picker. It is challenging and I would like to give it a try but I think I would initially go with dragan suggestion. It sounds like a smart and fast solution! Thanks!
  13. Hello everybody! I am working on a project that should allow the user to generate a gradient from the admin panel. Something similar to the Photoshop gradient panel, or to this https://www.colorzilla.com/gradient-editor/ Is anyone aware of an existing module that is already doing that? The alternative is that I try to write my first (!) module! Do you have any advice or suggestion on how I should approach this? Thanks
  14. Hello everybody, I'm working on website that has some simple queries. I have the same version on my server and on my client server but the one on my client server is incredibly slow on make some simple queries of pw pages. I suspect that could depend on server or database settings but I'm not an expert in that field so i don't know exactly what to look for. Does anyone has some advices on what could affect that? What should I check? Thanks!
  15. Thanks @PWaddict, yes i already did that, but it didn't help Thanks @BitPoet. The PHP version is 7.1.10, so a very recent one. And from phpinfo, for open_basedir i can read open_basedir no value no value Should i ask my server admins to change something? Thank you.
  16. Sorry, i think i posted this in the wrong section...
  17. Hello girls and guys, i moved a PW project to a new server and now i get this error: Uncaught Exception: Cannot open source device in .../wire/core/Session.php:267 I updated PW to the last stable version 3.0.98 but i still get the same error. The site is working on localhost and on another server, so i suspect can be something related to the server settings or php. Here is the full error Error: Uncaught Exception: Cannot open source device in .../wire/core/Session.php:267 Stack trace: #0 .../wire/core/Session.php(267): session_start() #1 .../wire/core/Wire.php(380): ProcessWire\Session->___init() #2 .../wire/core/WireHooks.php(723): ProcessWire\Wire->_callMethod('___init', Array) #3 .../wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Session), 'init', Array) #4 .../wire/core/Session.php(166): ProcessWire\Wire->__call('init', Array) #5 .../wire/core/ProcessWire.php(432): ProcessWire\Session->__construct(Object(ProcessWire\ProcessWire)) #6 .../wire/core/ProcessWire.php(209): ProcessWire\ProcessWire->load(Object(ProcessWire\Config)) #7 .../index.php(52): Pr (line 267 of .../wire/core/Session.php) This error message was shown because: site is in debug mode. ($config->debug = true; => /site/config.php). Error has been logged. I'm printing phpinfo hoping that can help. Any idea on how to solve this? Thanks
  18. Thanks bernhard, i tried to change the trailing slash option to "no" and also the Scheme/Protocol to HTTPS only, but nothing changed. I always get the 301 redirect. Any other idea? Thanks
  19. I'm checking some other projects too, and actually i see this behaviour in other projects. Is there some configuration or setting I'm missing?
  20. Hello girls and guys, i was trying to figure out why facebook was not reading the og tags on my page and i saw i get a 301 redirect if i curl my website (and also for facebook crawler) but i'm able to see the page correctly via browser. The website in on https. There was a redirect from http to https but i disabled it for now. I checked the .htaccess and i commented all the 301 redirect lines, still i get the 301 redirect. I'm trying to understand where the redirect is happening. Is there any file i should check other than .htaccess? Thanks!
  21. Thanks guys, I also have some multilanguage website, but some words can be the same in all languages (for example: "note", that it is my case). If there is no solution to that maybe it's good to keep in mind not to use common words as classes or data-attributes in textarea.
  22. Hello girls and guys, i just saw that if I use a selector on a textarea, for example $pages->find('body%=notes') it also find that key in html classes and attributes. For example it will find <p class="text-notes">Lorem ipsum dolor sit amet cosectetur.</p> Is there a way to avoid this anche check only the texts without the html tags? Thanks!
  23. Thanks @wbmnfktr, thank for your support. I see the invoice but it says it's expired. I also see I purchased ProCache(Dev) license and I'm thinking about renewing this e not the single license. But the last invoice for the Dev version is October 29, 2016 and it says it's expired. I don't see a way to renew it
  24. Thanks, but i can not see or find the last invoice. Is there a way to have it again?
×
×
  • Create New...