Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/20/2020 in all areas

  1. Just a quick heads-up that Wireframe 0.17.0 went live a few hours ago. Versions 0.15.0 .. 0.17.0 mostly included behind-the-scenes improvements and refactoring for existing features, so didn't think these were particularly interesting. Full changelog can be found from CHANGELOG, as usual. Probably the one and only feature that might come in handy during development is the shortcut method for defining view template and view at the same time (to use a view from a specific template instead of current one), added in 0.16.0: <?php // find blog posts and render them using the "list_item" view of the "article" template: ?> <ul> <?php foreach ($pages->find('template=blog-post') as $post): ?> <?= $post->setView('article/list_item')->render() ?> <?php endforeach; ?> </ul> On a loosely related note I've removed the "WIP" label from the topic of this thread, and am considering submitting the module to the modules directory. I think it's long overdue, really ?
    2 points
  2. Nope. It's never been possible. You must be confusing this with something else. Nothing to do with ProcessWire. Many (most?/all?) languages have variable scope. $config is outside the variable scope of myfunction(). myfunction() doesn't know what config is. You have to tell it. Having a namespace declaration has nothing to do with it. namespace ProcessWire; // alternative 1: use the global wire() function - @see: https://processwire.com/api/ref/functions/wire/ function myfunction() { echo wire('config')->paths->assets; // no error } // alternative 2: pass in $config function myfunction2($config) { echo $config->paths->assets; // no error } alternative 3: functions API - e.g. https://processwire.com/api/ref/functions/config/ @see also: https://processwire.com/api/ref/functions/
    2 points
  3. This week the core version remains at 3.0.166, but 3.0.167 should be ready by next week. The main reason I'm not bumping the version is just because a couple additional updates I want to get in 3.0.167 are started by not yet fully finished. Below is a look at what's been committed to the dev branch this week so far: Added custom Page class support for the Language class by implementing your own LanguagePage class that extends it (i.e. /site/classes/LanguagePage.php). Added a PR from MoritzLost with improvements to the CURL support in the WireHttp class. Added a new method to the Fieldtype interface named getMatchQuerySort() this method lets a Fieldtype module optionally manage the query when a $pages->find() requests a sort by a field/subfield handled by the Fieldtype. The first implementation of the getMatchQuerySort() method was added for FieldtypeOptions, which now lets you sort by option values or titles, despite those values and labels being in a separate table that the rest of ProcessWire doesn’t know about. Added a new getAfterLoginUrl() method to the Process module interface which lets Process modules optionally sanitize and validate request URLs to the module for a non-logged-in user. The resulting URL can be automatically redirected to once the user has logged-in. While the method has been added and implemented in several core Process modules, it is not yet used by the core after login—that will come next week in 3.0.167. Previously the only aspect of an admin URL that could survive login was an “id” integer in the query string. This week there were also several optimizations and improvements made to the PageFinder class and resolutions to 4 issue reports. Thanks for reading, have a great weekend!
    1 point
  4. You can try CKEditor content templates. I think you can get it into your system with AOS module.
    1 point
  5. Have you ever thought about using a repeater field (instead of CKE) for user input? One repeater item for each tab? This would be much easier for the client and certainly less error prone...
    1 point
  6. Hi @bernhard, thanks for the welcome and your fast reply! ? I'm happy you want to add it and try to prepare a PR with usage instructions tomorrow or monday.
    1 point
  7. @gebeer It'll likely be executeCommit as executeEntity returns the view. However, the 'routes' will be split out in v2 (namely, executeStore, executeUpdate, executeDisable, executeEnable, the first two of which will probably be used to trigger a cleanup).
    1 point
  8. @teppo and @bernhard Please try the attached main module file. With this version, you can simply add your panel to your module directory structure eg: /site/modules/TestModule/TracyPanels/TestThirdPartyModule.php Make sure the class name of the panel in this example is: TestThirdPartyModulePanel That should be all you need. Not super well tested so let me know if you find any problems or have any suggestions. If everything looks good, I'll commit the changes to the repo. TracyDebugger.module.php
    1 point
  9. I have opened a ticket on GitHub, in which I present a modification respectively a proof of concept, which significantly improves the editing of pages, especially with long contents. The save buttons are always in view with this modification, and the scroll position when editing and saving is saved and restored after saving. You can also find a screencast and code extensions on GitHub. What do you think of that? Link: https://github.com/processwire/processwire-requests/issues/177
    1 point
  10. Would it be possible to not have the clock icon show up on fields that are not editable since their value shouldn't change?
    1 point
  11. Hi I’m posting drunk again, and I just want to say, this module is awesome! Thanks a bunch, teppo, you’re the man. I feel much better with this after giving a friend edit permissions on my site ? But also, one thing, does anyone else feel that the diff should always be old to new? Right now when you open the history and click the most recent compare button, it’s the other way around. Wikipedia gives you one radio button for each version to compare and simply doesn’t let you select old to new. It’s kind of awkward and over-engineered, but I think the spirit of not going backwards in time is intuitive.
    1 point
  12. Here's some updated code to try: // Find IDs of users that have been active in the last $mins number of minutes function onlineUserIDs($mins, $limit = 500) { $table = SessionHandlerDB::dbTableName; $seconds = $mins * 60; $sql = "SELECT user_id " . "FROM `$table` " . "WHERE ts > DATE_SUB(NOW(), INTERVAL $seconds SECOND) " . "AND user_id!=40 " . // exclude guest "ORDER BY ts DESC LIMIT $limit"; $query = wire('database')->prepare($sql); $query->execute(); $results = $query->fetchAll(\PDO::FETCH_COLUMN); return $results; } // User IDs active in the last hour $online_user_ids = onlineUserIDs(60); // Convert to string for use in selector $online_user_ids = implode('|', $online_user_ids); // Online users $online_users = $users->find("id=$online_user_ids"); // Offline users excluding guest user $offline_users = $users->find("id!=$online_user_ids, roles.count>1");
    1 point
  13. In case you want it a little more simpler $pages->setOutputFormatting(false); $pag = $pages->find("template=basic-page"); foreach($pag as $p) { foreach($languages as $lang) { if($lang->isDefault()) continue; $p->set("status$lang", 1); $p->save(); } }
    1 point
×
×
  • Create New...