Jump to content

J_Szwarga

Members
  • Posts

    70
  • Joined

  • Last visited

Posts posted by J_Szwarga

  1. @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?

  2. 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

  3. 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??

     

  4. 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?

  5. @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?

  6. 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...

  7. I have a template setup with restricted access. I have the following option set on the Access tab:

    image.png.0934011b37a09fbff20938a999f289c7.png

     

    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?

  8. 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....

    image.png.d5c38144879f661e602bc2a272f7291e.png

     

    But it does NOT limit which files are visible in the "open" dialog box to choose a file to upload...

    image.png.f51d65588789aec0c8e8a2b9c0528576.png

    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?

  9. 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!

  10. 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?

  11. On 12/10/2019 at 3:48 AM, kongondo said:

    Hi @k07n. Yes, I am OK, thanks ?.

    I do have some good news but cannot share it now. There was a bit of a rethink about the GUI/UX but we are making some great progress.

    Hi @Mikie  I am not sure what you mean by custom data store. Currently everything will live in the site DB (i.e. accessible via ProcessWire's $database). I'd like to hear more about your line of thinking, thanks.

    All, sorry it's been a while since the last update. Rest assured that we are working on this as fast as we possibly can with great enthusiasm and motivation without sacrificing quality ?

    Looking forward to when the good news comes! ??

    As @Pete said earlier, if you need anyone to test it out, give us a shout.

    • Like 1
  12. 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??

  13. On 11/20/2017 at 7:56 PM, Macrura said:

    i use fullcalendar, but native ProcessWire;

    your questions are more general PHP, so i'm not sure really how related this is to ProcessWire.

    As far as i can tell, you are just trying to run a full calendar/php implementation alongside a PW site; You should be aware that this won't work b/c you have php files in the templates folder - you will need to move your files to the root.

    @Macrura Would you be able to provide some example code for how to implement fullcalendar? Trying to get it working for several projects. 

  14. On 3/16/2017 at 5:35 PM, gmclelland said:

    I'm trying to show upcoming calendar posting pages that have an event_start_datetime and an event_end_datetime.

    The listing should show

    • calendar postings greater than or equal to today (no past events unless it has an event_end_datetime that is within 3 days after today)
    • if the calendar posting has an event_end_datetime and is within 3 days of today it should still show even though the event_start_datetime has passed.

    Ex. an event that spans Wed-Saturday. If today is Friday, I still want to show the event on my calendar.

    Here is the code I have tried:

    
    $date = date("Y-m-d");// current date
    $date_start = strtotime( date('Y-m-d') . " 00:00:00");
    
    $date_end = strtotime(date("Y-m-d", strtotime($date)) . " +1 week");
    
    $paginated_calendar_postings = $pages->get("/calendar")->children("template=calendar-posting|community-event,event_start_datetime>=$date_start, event_end_datetime<=$date_end, sort=-event_start_datetime");

     

    @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!

×
×
  • Create New...