-
Posts
70 -
Joined
-
Last visited
Everything posted by J_Szwarga
-
Please help! Error in production environment only!
J_Szwarga replied to J_Szwarga's topic in General Support
@bernhard OK you got me on a track here to finding this...thank you! I was able to get logged into backend (with notifications telling me about modules that are not available) and finally found if I could do "Refresh" on the modules menu, then all the site comes back to work again! So my question is....what does that Modules Refresh do? it refreshes the modules cache, but I'm wondering how I broke the modules cache to begin with?... If I restored a backup of the database but didn't include the "caches" table, then that could cause all my modules to be "disabled" I'm thinking? -
Spent hours on this yesterday and just a dead end. If you have any ideas here PLEASE help ? Here's the background: Running local on windows with MAMP PRO. Deploying to server pilot setup on ubuntu with atomic sftp deploys through git. Been using this setup on about 5 sites on daily basis for over 3 years and never ran into this yet. Don't know if this is related to my problem, but right before this issue came up, I tried adding an external library (postmark's official php sdk) with `composer require`. Not realizing that processwire already checks for the vendor/autoload.php and loads it automatically (in the root index.php), I added a line to require_once the vendor/autoload.php file. Worked fine on my local, but when I deployed to production, got an error about the autoload.php file not being found (incorrect path). So I removed the reference to autoload.php. Production environment still having issues with autoload. Hmm, "that's weird" i thought. I'm not requiring autoload anymore. Maybe one of the composer dependencies are? OK, let me revert all my changes back to BEFORE I added this composer stuff in, so at least I can get the site to run. Removed all the new dependencies in /vendor and also from composer.json. Commented out all my code that referenced these dependencies. Site still runs fine in development. Push to production....and now I get 'Fatal Error: Uncaught Error: Call to a member function addHookBefore() on null`. This is referencing a line in my ready.php that sets hooks on $forms: $forms->addHookBefore('FormBuilderProcessor::saveEntry', function ($e) {}) Why all of a sudden does my production environment see $forms as NULL in ready.php? But development works fine? I tried changing $forms to $wire->forms or wire('forms') or $this->wire->forms but all end up with same result. So I commented out all my code that set hooks on $forms, just to get my site to load. Once I do that...it does load. Almost. But now it gets to my page template and my menu has a reference to the MarkupSimpleNavigation module. $menu = $modules->get("MarkupSimpleNavigation"); And I'm adding a hook right after that: $menu->addHookAfter And I get the SAME ERROR: Fatal Error: Uncaught Error: Call to a member function addHookAfter() on null ????? My processwire production install is no longer recognizing any site modules???? But my development is. I tried recreating a brand new server, deployment from scratch, just to the git commit BEFORE things started breaking...and STILL $forms is NULL, and $menu is NULL. I totally deleted the /vendor folder and still nothing better. Please if you have any idea why processwire wouldn't be recognizing any modules let me know. THANK YOU
-
Hooks for modifying page->editUrl
J_Szwarga replied to J_Szwarga's topic in Module/Plugin Development
@bernhard thanks, yes I like your solution. Because then I can fallback to the built-in editUrl still in special cases when needed. -
ckeditor - Remove wrapping <p> from <img> in source code
J_Szwarga replied to CodeCoffeeCode's topic in Modules/Plugins
If you want to set this on a per-field basis, you can go to the Input tab for your Textarea field, and under Custom Config options you can put enterMode:2 -
Need for a InputfieldSubmit->disable() call?
J_Szwarga replied to J_Szwarga's topic in Module/Plugin Development
That is true, but they do require looking up the class name if you don't already know it. I noticed that InputfieldSubmit already has setSmall() (only 1 line of code) and setSecondary(). setDisabled() seemed like it would be consistent with these, just saying. -
Can't find any reference to a disable() method on the InputfieldSubmit field type...wondering if I should submit a PR to add this method as I'm just getting into using a bunch of inputfields on some process modules and have a need for this. The method would simply add the "disabled" attribute to the button, and add the class "ui-state-disabled", but having a nice disable() method to wrap that up would be something that everyone could use if it were built-in? I just hesitate to do a PR because I may be missing something, since surely if this was wanted it would have been put in by now??
-
Trying to find a hook or some other method to change the page->editUrl based on it's template? If this requires using custom classes, I don't mind doing that either. Just trying to find a way to redirect from the normal admin page editor to an editor i have custom made in a module for pages using specific template.
-
Get admin page used for module setup
J_Szwarga replied to J_Szwarga's topic in Module/Plugin Development
YES!! Thank you! -
I created a process module. From a hook in ready.php, I need to access the full http url for this process module's "page". <?php namespace ProcessWire; $info = [ 'title' => 'Sermon Requests', 'summary' => 'Dashboard for approving users to listen to the sermons archive', 'author' => 'Joel Szwarga', 'version' => 1, 'page' => [ 'name' => 'rolerequests', 'title' => 'Sermon Requests', ], ]; So I need to get the url for: http:mysite.com/admin/setup/rolerequests/ I need to retrieve this url while just having the name of the module class (In this case, UserRoleRequests) Because the page's name/url can change, I can't hardcode that part here. I've tried every form of wire()->urls() and modules()->get("UserRoleRequests")->propertyname. Thought this would be really simple but don't see it anywhere. Is there a $pages->get() selector that can let me use the process module classname as a way to find the admin page?
-
@Soma One of the pages at level 2 of my menu has template access restricted so it does NOT show up in lists/searches by default. The only place I DO need this page to show up is in the menu. Here's my MarkupSimpleNavigation options: $homepage = $pages->get("/"); $menuItems = $homepage->children(); bd($menuItems, "Menu items"); $menuOptions = array( // 'outer_tpl' => '<ul class="nav nav-pills" id="mainNav">||</ul>', 'selector' => "check_access=0", 'inner_tpl' => '<ul class="dropdown-menu">||</ul>', 'outer_tpl' => '||', 'has_children_class' => 'dropdown', 'current_class' => 'current', 'parent_class' => 'current', 'item_tpl' => '<a class="dropdown-item" href="{url}">{title}</a>', 'item_current_tpl' => '<a class="dropdown-item" href="{url}">{title}</a>', 'max_levels' => 2, ); I thought if I set 'selector' => "check_access=0" then the module would ignore security restrictions on any of the pages it finds for the menu. But adding this to the selector does not change anything -- the page using my secure template is still not being included in the menu (unless a user is logged in who has permissions to view that page). How can I get this page included into the menu for all users/guests?
-
$page->children("check_access=0") not working
J_Szwarga replied to J_Szwarga's topic in API & Templates
Of course I didn't see this until right after posting... Since I'm using MarkupSimpleNavigation module, the $menuItems that I'm passing to it are just for the root menu items...the MarkupSimpleNavigation module does the heavy lifting for getting the child items to build out the menus. The secure page that I'm trying to show is one of those child menu items. So this is not a problem with the selector...this is something that I need to sort out with MarkupSimpleNavigation. I'll rephrase this question in the MarkupSimpleNavigation support forum... -
I have a template setup with restricted access. I have the following option set on the Access tab: Before, I had this set to "Yes", and the page using this template was showing up in my main menu. I need to keep this page visible in the main menu for all users and visitors. But I need to set security on this page so that all of the children pages (which are based on many different templates) can inherit the security setting and NOT show up in searches/lists. So I changed this template to "NO", don't show up in lists. Now the page is not showing in the main menu (expected). So I thought, "no problem, I'll just tweak the selector used for my main menu items." $homepage = $pages->get("/"); $menuItems = $homepage->children("check_access=0"); So I simply add "check_access=0" to the children() method, so I should get ALL published pages, regardless of security. But...I still do not get the page using my secured template, unless I'm logged in with permissions to view the page. I try different selectors in that $homepage->children() call, and they work. Why is check_access=0 getting ignored?
-
I've attempted fresh install of the module, cleared the cache, etc. Any guesses on why I don't have any libraries to choose from? Thanks.
-
Here's my code for using the InputfieldFile in a form on a backend page (Process module) $f = $this->modules->get('InputfieldFile'); $f->name = "mp3_file"; $f->label = "Mp3 Audio File"; $f->extensions = "mp3"; $f->maxFiles = 1; $f->setMaxFilesize("200M"); $form->append($f); For "extensions" I've tried both ".mp3" and "mp3" without the period. The mp3 extension does show up in the form field UI.... But it does NOT limit which files are visible in the "open" dialog box to choose a file to upload... Furthermore, it does not limit which files can be opened and uploaded. Went through the source code and I'm still puzzled why this isn't working as expected. I would expect that the module would use the extensions to add an "accept" property to the input HTML element (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept) But inspecting the html, there is no "accept" property on the resulting input element....and in the source code of InputfieldFile.module, a search for "accept" turns up 0 results.... Anyone have a clue for me?
-
@d'Hinnisdaël I'm attempting to use the PageIcon module to show page icons on the front end through MarkupSimpleNavigation. Although it appears PageIcon is only for backend use. Do you know of a solution to this?
-
Custom Page Type...findOne() not implemented?
J_Szwarga replied to J_Szwarga's topic in API & Templates
Works great for me too, thanks! -
This one has got me scratching my head for 2 days so hoping someone can shed light... I have a couple grand-child pages that require a top-level url for business reasons. I followed the ideas present in this thread and they work great... 1. Enabled url segments on home page 2. Add code to home.php that looks for specific url segment and outputs appropriate grand-child page instead of home page. 3. Add hook before "Page::path" that removes the parent from the generated url segment. So now instead of /calendar/events, it now works as just /events However, one of these grand-child pages (/calendar/events) also uses pagination to present a list of items. Before making the above changes, pagination works correctly...the url that gets generated with "renderPager()" to get to page 2 results is like this: calendar/events/page2 After adding the above code to remove the "parent" from the grand-child url, I would expect the "renderPager()" to return THIS: /events/page2 but instead it is returning THIS: /events/events/page2 Which of course, doesn't work. After clicking the page 2 link (/events/events/page2) the page re-renders with all page 1 results still, and then the pager continues to generate bad links, this time like: /events/events/events/page2/page2 Is there a known issue with combining url segments with pagination on the same page? If I need to, I'll end up just doing a permanent redirect from my top-level urls down to the grand-child pages, if that's the only way to get pagination to work. I was hoping for another way unless this is a know and un-fixable issue. Thanks!
-
I created a custom page type almost exactly as in the tutorial here: https://processwire.com/docs/tutorials/using-custom-page-types-in-processwire/ Everything working great with custom methods that I added to the Event object as well as the Events object. However, whenever I try to use $events->findOne($selector) I get Method Events::findOne does not exist or is not callable in this context $events->find() works, and $events->get() works. But I need findOne since I dont want to retrieve the page if it is not viewable. Since my $events class is based on PagesType, I thought that findOne should come with that for free. But looking at the PagesType class, there is no findOne method at all... I'm confused why PagesType doesn't implement findOne, and how do I get my custom events class to make that method available?
-
Looking forward to when the good news comes! ?? As @Pete said earlier, if you need anyone to test it out, give us a shout.
-
Here's my query: $pages->find("template=collection, sort=-children.count"); However it is sorting my collections based on the total number of children. I've searched all over and cannot find a way to take visibility into account for this property. (I don't want to include any hidden or unpublished children). While rendering the child items in the html, I use $collection->numChildren(true) to show the number of visible, published children. But the sorting is all messed up because it includes all the hidden and unpublished. There's got to be some way to find the count of visible children in an efficient manner, without retrieving every single record to check it with a for loop??
-
Can this module be altered to work with 12 HR instead of 24 HR?
-
@Macrura Would you be able to provide some example code for how to implement fullcalendar? Trying to get it working for several projects.
-
-
@gmclelland Did you ever find a solution to this issue? I've been searching the forums for this exact thing and can't find anyone else with this problem. Thanks!
-
FormBuilder Multi-page Form for logged in users
J_Szwarga replied to J_Szwarga's topic in General Support
Thank you @teppo for guiding me to the right area!- 2 replies
-
- formbuilder
- form builder
-
(and 3 more)
Tagged with: