Leaderboard
Popular Content
Showing content with the highest reputation on 05/01/2024 in all areas
-
Thank you. I totally agree with you but… The reason I'm doing it this way is I'm using the https://github.com/Toutouwai/CustomAdminMenus plugin — and this is unaware of page permissions. EDIT: I've realised this will do the job. It's not quite what I was after but it's a bit of an edge case anyway and only takes a minute to implement. wireLangReplacements([ 'The process returned no content.' => 'This page is either for administrators only or it doesn’t exist. Please go back and choose another page.', ]); Thanks for your help.1 point
-
I proposed to either 404 or redirect. So if you redirect to the main admin page and add a message before you redirect, the user doesn't even need to click anywhere and gets there automatically. Better UX IMO. Which items would that be? You can setup your roles/permissions in a way that users only see the menu items for pages/processes they have access to. If your users get access to the page tree, you can use hooks that utilize Page::viewable to remove those pages from the tree that they should not see. You'd have to activate language support (if you haven't already) and then in the settings for each language search through the core translation files to find those strings and then overwrite them.1 point
-
1 point
-
Resolved. public function init() { $this->addHookAfter('ProcessPageEdit::buildForm', $this, 'addResources'); } public function addResources(HookEvent $event) { $page = $event->object; $this->config->styles->add($this->config->urls->SeoTextWidth . "SeoTextWidth.css"); $this->config->scripts->add($this->config->urls->SeoTextWidth . "SeoTextWidth.js"); }1 point
-
I somehow managed to miss this reply. Thank you for both of your replies, @Robin S! I did manage to get this working, with some oddities here and there that had to be worked through due to how I was checking/setting access permissions. I chose not to explicitly set permission for each and every template per role since I'm using a field that's added to the templates to determine access, so it seemed doubly difficult to do that, and my hope was that inheritance would work properly most of the time. So far that's fairly true, with occasional exceptions (ex: nested repeaters since repeaters have their own system templates). It felt a little hack'ish but I checked against the template name and if strpos() found a match to "repeater_" against $page->template->name, then I'd allow access to the edit method (add didn't cause an issue the way I had it written). I wasn't sure how else to check if a template of a page being checked for access belonged to a repeatable fieldtype.1 point
-
I'd take a different approach and use hooks Page::viewable and Page::editable in templates/admin.php to either throw a 404 or to redirect to some default page they can view. In either case you can add a message or error that will be shown at the top of the page.1 point
-
Hi @Michael Lenaghan There is no "Mark as solution" button here as far as I know. You have to edit the post title and add "Solved" or whatever you think appropriate. Gideon1 point
-
Please check if you have a page item added twice in your PageArray after the add operation. Had a similar issue with sorting in one of my projects due to one page item added twice as result of an add call. Just output the PageArray e.g. with Tracy dump methods for a quick check. If there are duplicated page items, PageArray is sorted by page ids by default. See this thread for additional infos.1 point
-
This week we have another update to the ProFields table field. A couple of weeks ago I wrote a blog post about Table v28 and the new actions features that it added. I've been working with Table a lot for my current client project, and have found these new features very useful. But I'm doing a lot of data entry in Table and found I still wanted more. Specifically, I wanted to be able to apply some of the actions directly on the row I was working in (rather than having to select it and then scroll down to the actions). Kind of like how one can click the Trash icon on any row to delete the row... I wanted to be able to apply other actions in the same way (Add, Clone, Copy, Paste). And Table v29 (released today) does exactly that. Another desire I had is for the for row-level actions to be just really simple, with not too much to look at... something folks could use rapidly without having a lot to read. This leaves several powerful and verbose features for the actions menu you saw earlier (the one that appears under the Table). Below is a video that outlines these new row-level actions. It's actually the same video from before, but I added to it for the version 29 features. So I'll try to post a link that starts at the timecode of the new stuff. But if you haven't seen this video before, you may want to rewind to the beginning. Below is the full CHANGELOG for this version: Expanded actions support so you can also execute actions directly on individual rows, which is often more convenient than selecting rows and then applying actions. Hold down the SHIFT key before clicking the row actions select and it will convert any actions that usually append rows to instead prepend rows. This works with the the Add, Clone and Paste actions when clicked at the individual row-level. It also works with the Select action for selecting multiple rows at once. The Select action is there in part for people that may not realize you can already click the sort arrows to select the row. Removed the Vex dialogs when copying or pasting and replaced them with other visual cues to indicate successful copy and/or paste. Added a new config option for disabling the DELETE (trash) icon on individual rows when individual row actions are enabled. This is because the row actions already include a delete action, so the trash icon can be redundant for some who might prefer the additional space. For all non-page selection column types, a new "Settings" option was added (named “formattedValueType”) to indicate how the value should be represented when accessed from a formatted page. Previously the API value was always the selection value. Now you can specify that it should include both the value and label (in your choice of array), or just the label rather than the value. Table v29 beta is available for download now in the ProFields download thread. More core updates are likely for next week. Thanks for reading and have a great weekend!1 point
-
Lots more Adminer updates in the last couple of weeks, but the key things are: 1) Shift-click on the DB icon links will now open Adminer in full mode rather than with the Tracy panel 2) Page, template, field, etc ID within Adminer table views are now linked - note the page title (and path) and the link to edit that page - this comes from hovering on any of the id, parent_id, templates_id, created_users_id, modified_users_id, etc. These sorts of links are present throughout including linking to modules from the "modules" table, hanna_code, pages_meta, etc. It also works for all Page Reference field's page IDs in Profields Table "field_table" tables, Profields Combo, repeater, RM fields, etc. Hopefully you'll all find this as useful as I am.1 point
-
This week we have ProcessWire 3.0.238 on the dev branch. This version contains 17 commits containing new features (some via feature requests) as well as issue fixes. Recent updates have been nicely covered in ProcessWire weekly issues #517 and #518. Also added this week are the following: Improvements to ProcessPageClone, which now supports some new options such as the ability to configure it to always use the full clone form (a requested feature), and an option to specify whether cloned children should be unpublished or not. New $datetime->strtodate($date, $format) method that accepts any PHP recognized date string and reformats it using the given format. It also supports date strings that PHP doesn't recognize if you give it a 3rd argument ($options array) with an `inputFormat`. The existing $datetime->strtotime() method now supports an `inputFormat` option as well. The Inputfield class now has new methods: $inputfield->setLanguageValue($language, $value) and $inputfield->getLanguageValue($language), added by the LanguageSupport module. Previously there were no dedicated methods for this, so you had to manage them with custom keys containing language IDs if you wanted to programmatically use an Inputfield in multi-language mode. The ProcessWire.alert() JS method has been updated with an auto-close option (`expire` argument) that automatically closes the alert box after a specified number of seconds. InputfieldDatetime has been updated with 7 new interactively configurable settings for the jQuery UI date picker. See the screenshot below for an example of a few. Plus, its API has been updated with the ability for you to specify or override any jQuery UI datepicker option, either from PHP or JS, as requested by Toutouwai/Robin S. See the new datepickerOptions() method and phpdoc for details. Next week we've also got some more updates to InputfieldTable that take the newly added actions even further and make them easier to use. Thanks for reading and have a great weekend!1 point
-
Most of our sites are running InnoDB with 10.5.19-MariaDB-0+deb11u2 or later and so far, absolutely no issues.1 point
-
Hi @GradDev, The $pageData = $pageData->unique() line is redundant because WireArrays/PageArrays never contain duplicates unless you specifically allow them using setDuplicateChecking(false). I can't reproduce the issue here - the order of items in a PageArray is the same as the order I add them in and they are not ordered by ID. In my example I am adding countries: But you can see that when adding an item that already exists in the PageArray, the earlier item is removed - Finland, Iceland and Ireland are added in the last append() but would already exist in the PageArray. If you wanted pre-existing items to maintain their earlier position in the PageArray you could modify the selectors so that items in the PageArray are excluded:1 point