-
Posts
6,264 -
Joined
-
Last visited
-
Days Won
313
Everything posted by bernhard
-
Great news ? I've just pushed v3.35 which adds auto-loading of pageclasses to RockMigrations! Now if you are developing a module that ships with custom pageclasses all you have to do is to add them in the /pageClasses folder of your module and add the proper namespace! ??? See the docs here: https://www.baumrock.com/en/processwire/modules/rockmigrations/docs/custom-pageclass/ What about PRs? Having a watch priority as class constant for example sounds like a good idea to have ?
-
Force guest users to login with no backend access at all [solved]
bernhard replied to cwsoft's topic in General Support
Hiding from guests is quite simple, see how I do it in RockMigrations: https://github.com/baumrock/RockMigrations/blob/141143a9108e1cc0eed52ed3bd53ed06a5ff3cb0/RockMigrations.module.php#L2243-L2275 Then you could add something like this into /site/templates/admin.php: <?php $user = wire()->user; if($user->isLoggedin() and !$user->isSuperuser()) { $session->redirect("/"); } I guess you'd improve that to check for login/logout pages, but you get the idea ? -
No. What I'm always doing is this in Site.module.php: $rm->createTemplate('foo'); This will create the template if it does not exist and it will automatically trigger ->migrate() on an in-memory page that has that template. On subsequent requests the template does already exist and if it's a MagicPage then it should automatically be watched for changes. PS: Did you read the phpdoc on migratePageClasses() ? ? DEPRECATED AS OF 24.7.2023 * Please use $rm->pageClassLoader() instead! * * Migrate all pageclasses in given path * Note that every pageclass needs to have the template name defined in * the "tpl" constant, eg YourPageClass::tpl = 'your-template-name' I have to add better docs on that one day...
-
Using version 5.1.0 we can use the conventionalcommits preset without any other dependencies ? This is what I'll use from now on in all my modules: name: Releases on: push: branches: - main jobs: changelog: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: conventional Changelog Action id: changelog uses: TriPSs/conventional-changelog-action@v5.1.0 with: preset: "conventionalcommits" github-token: ${{ secrets.github_token }} - name: create release uses: actions/create-release@v1 if: ${{ steps.changelog.outputs.skipped == 'false' }} env: GITHUB_TOKEN: ${{ secrets.github_token }} with: tag_name: ${{ steps.changelog.outputs.tag }} release_name: ${{ steps.changelog.outputs.tag }} body: ${{ steps.changelog.outputs.clean_changelog }}
-
If you are working with Git I highly recommend installing the "git graph" extension: This extension truly helped me understand everything around git way better (What is this origin? What is this HEAD? What is a rebase actually doing? etc...). It also has great right-click-menus with helpful actions: Unfortunately the author of the extension seems to be not available any more and the license seems to be quite restrictive so that forking is not allowed, but it's an interesting read: https://github.com/mhutchie/vscode-git-graph/issues/715 I didn't find a good alternative. If anyone knows one please let us know ? https://marketplace.visualstudio.com/items?itemName=mhutchie.git-graph
- 242 replies
-
- 1
-
- visual studio code
- vsc
-
(and 2 more)
Tagged with:
-
Hey @iank I just pushed the new version v5.0.0 to my website ? https://www.baumrock.com/releases/rockpagebuilder/ Please note that in this version I have changed the way how sorting blocks works. In the older release we had this icon, which opened a modal to sort the elements: OLD way: The new way of sorting is Drag&Drop ?? I'll send out some more informations with the next Rock-Monthly soon! ? Thx for reporting the issue! I hope you like RockPageBuilder ? PS: Please make sure to also update RockMigrations + RockFrontend to the latest versions!
-
SuperUser account access only on development server
bernhard replied to NikNak's topic in General Support
You could create a dedicated user for your client and only allow logins of that user on the development domain. -
Why is creating pages any worse than populating a repeater? I'd prefer pages I guess. I don't understand the last part. Could you please explain what you mean exactly? ---- I'd go with pages and build a custom Inputfield for selecting icons. It's really not that hard and definitely the best UX ? Once you have answered the above questions I might be able to help ?
-
You can use custom page classes and add a getPageListLabel() method: It can be a problem though that this markup also ends up in the main navigation and also in page select fields. You can hide those elements via CSS though: // site/classes/YourPageClassPage.php public function getPageListLabel() { return "<span class=foo>foo</span> " . $this->title; } /* /site/templates/admin.less */ .PageListPage.label .foo { border: 2px solid red; } Another option is to use RockMigrations + MagicPages, then you can simply add "pageListLabel()" instead of "getPageListLabel()" and you'll get the modified label in the pagetree but not in the menu. This is the hook I'm using: https://github.com/baumrock/RockMigrations/blob/85c28fb97411f2af1ab3c77d3911b777d3f77ccf/MagicPages.module.php#L268-L290
-
Add custom options to InputfieldSelect via a hook
bernhard replied to a-ok's topic in General Support
Had the same need today and was not able to get it working properly. The quoted version did only work if I had some options set in the inputfield's config, which is not good. I came up with this solution (that only works for single selects): <?php $wire->addHookBefore('InputfieldInteger::render', function ($event) { $inputfield = $event->object; if ($inputfield->name != "your_fieldname") return; $f = new InputfieldSelect(); $f->name = $inputfield->name; $f->value = $inputfield->hasPage->{$inputfield->hasField}; $f->setOptions([1 => 'UK', 2 => 'USA', 3 => 'Etc etc']); $event->return = $f->render(); $event->replace = true; }); This works because it simply stores the option's id in the integer field so it does not try to sanitize for options that it does not have. -
[Solved] TinyMCE symbolbar are not on top in frontend edit (bug?)
bernhard replied to Tiberium's topic in RockPageBuilder
Hi Denis, thx. That's already fixed in the latest version on the dev branch ? Sorry for the trouble! I'll merge that soon!- 1 reply
-
- 3
-
Permissions for some modules are getting added as unpublished?
bernhard replied to gornycreative's topic in General Support
@gornycreative have you seen https://github.com/baumrock/RockMigrations/issues/50 ? Or was that you posting the issue? ? -
This would also work: <?php if($page->matches("id=1042|1043")) ... ?
-
Assigning a value by page name (I didn't know you can do this)
bernhard replied to Jonathan Lahijani's topic in Tutorials
Thx for sharing, didn't know that as well! Not sure if your example is real or not, but I'd recommend something like this: $order->setOrderStatus('pending'); So your $page should better be an OrderPage (custom page class) and that pageclass should have this method: <?php ... public function setOrderStatus($status) { $this->setAndSave( 'order_status', $this->wire->pages->get("/path/to/order-statuses/$status") ); } I know the benefit looks little, but the code does not only get cleaner to read: <?php $page->setAndSave('order_status', $pages->get('/path/to/order-statuses/pending/')); // vs $order->setOrderStatus('pending'); It gets also more error-proof (what if someone/something created another page with name "pending" somewhere else in the tree? And not to forget your system will be better and easier to maintain. Imagine for example you change the path of your statuses one day. You only change the path in setOrderStatus() and you are done, rather than finding all instances of ->setAndSave(...). Also maybe one day the client want's E-Mail notifications on changed statuses... Simply go to setOrderStatus() method and add the mail code there. If you have several ->setAndSave('order_status', 'something') sprinkled around you might be tempted to add the mail sending on several locations or you might forget it somewhere and you'll have introduced an unnecessary bug ? PS: I'd even more prefer setStatus() but that's already taken by the Page baseclass. updateStatus() would also be an option. But setOrderStatus() might be the clearest anyhow ? -
I added echo "$file<br>" in WireClassLoader.php:354 right above the is_file() and this is what I get: /path/to/user/www/tmp/processwire-dev/wire/core/ModulesInfo.php /path/to/user/www/tmp/processwire-dev/wire/core/ModulesClass.php /path/to/user/www/tmp/processwire-dev/wire/core/ModulesFlags.php /path/to/user/www/tmp/processwire-dev/wire/core/ModulesFiles.php /path/to/user/www/tmp/processwire-dev/wire/core/ModulesConfigs.php /path/to/user/www/tmp/processwire-dev/wire/core/ModulesLoader.php /path/to/user/www/tmp/processwire-dev/wire/core/WireDatabasePDOStatement.php /path/to/user/www/tmp/processwire-dev/wire/core/WireCacheDatabase.php /path/to/user/www/tmp/processwire-dev/wire/core/DefaultPage.php ProcessWire\DefaultPage.php /path/to/user/www/tmp/processwire-dev/site/classes/DefaultPage.php /path/to/user/www/tmp/processwire-dev/wire/core/HomePage.php ProcessWire\HomePage.php /path/to/user/www/tmp/processwire-dev/site/classes/HomePage.php /path/to/user/www/tmp/processwire-dev/wire/core/PageProperties.php /path/to/user/www/tmp/processwire-dev/wire/core/PageValues.php /path/to/user/www/tmp/processwire-dev/wire/core/AdminPage.php ProcessWire\AdminPage.php /path/to/user/www/tmp/processwire-dev/site/classes/AdminPage.php /path/to/user/www/tmp/processwire-dev/wire/core/UserPage.php ProcessWire\UserPage.php /path/to/user/www/tmp/processwire-dev/site/classes/UserPage.php /path/to/user/www/tmp/processwire-dev/wire/core/RolePage.php ProcessWire\RolePage.php /path/to/user/www/tmp/processwire-dev/site/classes/RolePage.php /path/to/user/www/tmp/processwire-dev/wire/core/WireInputDataCookie.php /path/to/user/www/tmp/processwire-dev/wire/core/PermissionPage.php ProcessWire\PermissionPage.php /path/to/user/www/tmp/processwire-dev/site/classes/PermissionPage.php /path/to/user/www/tmp/processwire-dev/wire/core/FileLog.php /path/to/user/www/tmp/processwire-dev/wire/core/PagesRequest.php /path/to/user/www/tmp/processwire-dev/wire/core/PagesPathFinder.php /path/to/user/www/tmp/processwire-dev/wire/core/AdminThemeFramework.php /path/to/user/www/tmp/processwire-dev/wire/core/WireMarkupRegions.php Then I added this: if($file === "ProcessWire\DefaultPage.php") { echo var_dump(Debug::backtrace()); } // result array(9) { [0]=> array(2) { ["file"]=> string(34) "/wire/core/WireClassLoader.php:313" ["call"]=> string(81) "WireClassLoader $classLoader->findClassInPaths("DefaultPage", [ 'ProcessWire\' ])" } [1]=> array(2) { ["file"]=> string(28) "/wire/core/Templates.php:862" ["call"]=> string(39) "class_exists("ProcessWire\DefaultPage")" } [2]=> array(2) { ["file"]=> string(28) "/wire/core/Template.php:1441" ["call"]=> string(45) "$templates->getPageClass(Template $obj, true)" } [3]=> array(2) { ["file"]=> string(31) "/wire/core/PagesLoader.php:1312" ["call"]=> string(24) "Template->getPageClass()" } [4]=> array(2) { ["file"]=> string(24) "/wire/core/Pages.php:217" ["call"]=> string(30) "PagesLoader->getById(array(8))" } [5]=> array(2) { ["file"]=> string(30) "/wire/core/ProcessWire.php:625" ["call"]=> string(14) "$pages->init()" } [6]=> array(2) { ["file"]=> string(30) "/wire/core/ProcessWire.php:582" ["call"]=> string(47) "ProcessWire $wire->initVar("pages", Pages $obj)" } [7]=> array(2) { ["file"]=> string(30) "/wire/core/ProcessWire.php:315" ["call"]=> string(36) "ProcessWire $wire->load(Config $obj)" } [8]=> array(2) { ["file"]=> string(13) "/index.php:52" ["call"]=> string(43) "ProcessWire $wire->__construct(Config $obj)" } } Any ideas? Maybe I should better create an issue for PW itself?
-
Hey @adrian just installed a new pw instance (dev) for testing and got this error: ErrorException: is_file(): open_basedir restriction in effect. File(ProcessWire\BasicPagePage.php) is not within the allowed path(s): (/path/to/user/www:/path/to/user/files:/path/to/user/tmp) in /path/to/user/www/tmp/processwire-dev/wire/core/WireClassLoader.php:354 Stack trace: #0 [internal function]: Tracy\Bar->Tracy\{closure}(2, '...', '...', 354) #1 /path/to/user/www/tmp/processwire-dev/wire/core/WireClassLoader.php(354): is_file('...') #2 /path/to/user/www/tmp/processwire-dev/wire/core/WireClassLoader.php(313): ProcessWire\WireClassLoader->findClassInPaths('...', Array) #3 [internal function]: ProcessWire\WireClassLoader->loadClass('...') #4 /path/to/user/www/tmp/processwire-dev/wire/core/Templates.php(878): class_exists('...') #5 /path/to/user/www/tmp/processwire-dev/wire/core/Template.php(1441): ProcessWire\Templates->getPageClass(Object(ProcessWire\Template), true) #6 /path/to/user/www/tmp/processwire-dev/wire/core/PagesLoader.php(1312): ProcessWire\Template->getPageClass() #7 /path/to/user/www/tmp/processwire-dev/wire/core/PagesLoader.php(521): ProcessWire\PagesLoader->getById(Array, Object(ProcessWire\Template)) #8 /path/to/user/www/tmp/processwire-dev/wire/core/Pages.php(289): ProcessWire\PagesLoader->find('...', Array) #9 /path/to/user/www/tmp/processwire-dev/wire/core/Wire.php(419): ProcessWire\Pages->___find('...', Array) #10 /path/to/user/www/tmp/processwire-dev/wire/core/WireHooks.php(968): ProcessWire\Wire->_callMethod('...', Array) #11 /path/to/user/www/tmp/processwire-dev/wire/core/Wire.php(484): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Pages), '...', Array) #12 /path/to/user/www/tmp/processwire-dev/wire/core/Page.php(3968): ProcessWire\Wire->__call('...', Array) #13 /path/to/user/www/tmp/processwire-dev/wire/core/PageTraversal.php(132): ProcessWire\Page->_pages('...', '...', Array) #14 /path/to/user/www/tmp/processwire-dev/wire/core/PageTraversal.php(157): ProcessWire\PageTraversal->children(Object(ProcessWire\HomePage), '...', Array) #15 /path/to/user/www/tmp/processwire-dev/wire/core/Page.php(1883): ProcessWire\PageTraversal->child(Object(ProcessWire\HomePage), '...', Array) #16 /path/to/user/www/tmp/processwire-dev/site/assets/cache/FileCompiler/site/modules/TracyDebugger/panels/RequestInfoPanel.php(484): ProcessWire\Page->child('...') #17 /path/to/user/www/tmp/processwire-dev/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Bar/Bar.php(143): RequestInfoPanel->getPanel() #18 /path/to/user/www/tmp/processwire-dev/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Bar/Bar.php(115): Tracy\Bar->renderPanels('') #19 /path/to/user/www/tmp/processwire-dev/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Bar/Bar.php(89): Tracy\Bar->renderPartial('...') #20 /path/to/user/www/tmp/processwire-dev/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Debugger/DevelopmentStrategy.php(123): Tracy\Bar->render(Object(Tracy\DeferredContent)) #21 /path/to/user/www/tmp/processwire-dev/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Debugger/Debugger.php(319): Tracy\DevelopmentStrategy->renderBar() #22 [internal function]: Tracy\Debugger::shutdownHandler() #23 {main} Tracy was installed some seconds before, so it should be the latest version ?
-
Ah, true. Now I remember I checked that yesterday but didn't think of that any more ? Then I'm out of ideas ?
-
Maybe the permissions page has moved somehow? That would explain why name=permissions finds something and providing the path does not.
-
What you are seeing is a display glitch. The "Recently Found and Installed Modules" should be on a separate tab called "new", so it looks like you don't have any missing modules?! Not sure why the tab is visible in that case though.
-
You could try to delete the row of your module in the "modules" database table. That would mean that the module is uninstalled. Then you could check if the module get's installed automatically on the next page load or modules refresh. If it get's installed you could add something like this to your install() method of the module: bd(debug_backtrace()); die(); In that backtrace you should then see what is triggering the installation of the module.
-
I can't reproduce this behaviour. Both return the page properly.
-
Just install the module on another ProcessWire installation. If it's the same behaviour there the issue is in your module. If it's different, then the issue is in your current project. ?