Jump to content

DrQuincy

Members
  • Posts

    296
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by DrQuincy

  1. Just that…once a page is created I do not want to allow the page slug/name to ever be changed. So the name should be available no the initial page during creation but not after that. Is that easy enough to do? Thanks!
  2. How can I write a hook that happens when PW has dtermined the page is not found? I have some pages where the page name is a unique numerical ID (also stored in a hidden field) followed by a standard slug. E.g: /folder/4545-foo-bar /folder/89897-test-page If someone enters, to use an example above, enters site.com/folder/4545 PW will send a 404. However, what I want to do in the hook it search for a page that has the unique numerical ID. If it exists, redirect to that. If it doesn't, allow the default 404 behaviour to occur. I hope that makes sense. Thanks!
  3. I've got it working. It's really easy; before you read anything from the utf8mb3_general_ci database run this query: $database->query('SET NAMES `utf8mb4`'); This will mean any queries in the current connection will use the same charset as PW and everything will work okay.
  4. Okay, so I'm pretty sure this is a charset issue, I'm just not sure how to solve it. I have a MySQL database (non-PW) with news items in that uses utf8mb3_general_ci. I have a new PW site that uses utf8mb4_general_ci. I am using \ProcessWire\WireDatabasePDO to connect to the non-PW database and am interating through and converting them to PW pages. It seems characters such as em dashes and the Euro symbole are coming through as ?. It's happening in the titles only but they may be becuase in the HTML field, CKEDitor is using entites. How do I reconcile the charsets? I recall doing something like this years ago on a non-PW job and seem to remember SET NAMES might be the soluiton but if anyone could help me out that'd be appreicated. ? Thanks.
  5. I'm sure I've seen this before but can't find it anywhere… I have the TextformatterMarkdownExtra text formatter installed. I have a field that uses TextformatterEntities but in certain instances I want to switch to markdown on the fly. How can I do this. Obviously $page->of(false) first — and then what? Thanks.
  6. I have some code like this (simplified): $page = new Page(); // Set template, parent, etc here $item = $page->matrix->getNew(); // matrix is a RpeaterMatrix $item->repeater_matrix_type = 4; // HTML $item->html = '<p>Foo bar.</p>'; $item->save(); $page->matrix->add($item); $page->save(); // Saving now so I can add an image $page->image->add('foo.jpg'); $page->save(); I always thought save() was imdempotent so if you kept saving it would just overwrite the same data. But in this instance my matrix has two identical items. This works though: $page = new Page(); // Set template, parent, etc here $page->save(); $item = $page->matrix->getNew(); // matrix is a RpeaterMatrix $item->repeater_matrix_type = 4; // HTML $item->html = '<p>Foo bar.</p>'; $item->save(); $page->matrix->add($item); $page->save('matrix'); // Saving now so I can add an image $page->image->add('foo.jpg'); $page->save('image'); Just so I understand is the matrix difference to the other fields in that once added to the page when just $page->save() is called it will save a new once each time? I.e. it doesn‘t “forget” about the new matrix item on saving. In general, is it better to save by explcitily passing field names as above (once you've saved the core fields)? If so, can you pass an array of fields to save()? It doesn't appear so from the docs. I've been using PW for a while now and have always used saved and not yet come across this. ? Thanks!
  7. Is this to meet Google's new standards for ads? You need to use a Google-approved Cookie management system (CMS) so it's done independently of ProcessWire. It seems unfair you have to use commercial options but there isn't an oen source version that I am aware of. You can see the list here: https://support.google.com/admanager/answer/13554116?hl=en#zippy=%2Cgoogle-certified-cmps I've used CookieYes for a few clients. Looks decent enough and quick to set up. It's free up until 25k page views per month (I think). A few clients are paying ~$10 a month as they get more traffic than that.
  8. Ah, thanks for checking! I'll keep an eye out for the new version.
  9. I have set a default address for the module and when I save it it correctly geocodes the address. However, when it loads in a new page the Latitude and Longitude are both 0. Any ideas why? Thanks.
  10. Brilliant, thanks. Looks like they added X is the last update. ? https://github.com/NikolayRys/Likely/releases/tag/v3.2.0
  11. Hi, I need something like this as a JS plugin: https://shareon.js.org/ However, I can't find one that uses X instead of t for Twitter? Any recommendations? Thanks!
  12. 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.
  13. Thanks for the suggestion. It's slightly different in this instance since there are additional items in the admin that appear in the menu, which I can't remove, and it would just make it look like they're broken if they 404. I was hoping instead to simply override the text of these to make the user experience make more sense: ProcessWire: You don't have access to edit The process returned no content. Even something as simple as a translation would be better: You don't have permission to view or edit anything on this page This page is for administrators only. Please click here to go back to the main admin page. Is that easy to do?
  14. When a user goes to a page in the CMS that they don't have permission to access you get two messages: ProcessWire: You don't have access to edit The process returned no content. How can I use hooks to override these messages? Ideally for point 2, I'd like to use HTML. Thanks.
  15. That's really good, thanks for the suggestions! I'm going to keep that as a potential way. I like it, thinking outside the box. ? My somewhat liazier solution is simply to add a field to the user template: Legacy, Legacy converted, and New. If A Legacy user attempts a login it simply sends them to the password reset page. And when they do they become Legacy converted. Your way is far slicker so I'll present the client with both options.
  16. I have an old custom site I built myself where the passwords are hashed using BCrypt. I'm assuming the answer is no due to the one-way nautre of hashing but is there any way to take my bcrypt-hashed passwords and import them into PW? Where as my passwords stored the BCrypt strength, hash and salt together, PW seems to store the hashed password in two parts. I think it's further complicated by the $config->userAuthSalt value (this looks more like a pepper to me). It can't be done, can it? In which case, will just have to copy the emails, etc across into PW and send them each an email asking they set a new password or display a message on the website if a legcay email is used to attempt a login.
  17. Oh wow, you are amazing, LOL! That worked great. The only downside I can see if that I can't see a way of having a dynamic number of rows in the Google Doc. So I have to paste more than I need for the update to work. E.g. If I paste 10 rows in the Doc that limits it to 10. That should be okay but am I missing something that would allow me to have any numbers of rows pull through?
  18. Hi all, This is nothing to do with PW… I have some data in Google Sheets. Do you know if it's possible, ideally without having to use their API, to create Google Docs that automatically feed in data from certain sheets/cells. E.g. A Google Sheet has a list of addresses that have address in one column and a “type” flag attached to them (e.g. rural, suburban, urban). Let's say there are 3 x types as mentioned. Is it possible to have 3 x Google Docs that feed in addresses filtered by type? And, ideally, if the data is updated in the Sheet it automatically progates into the Docs. Can this be done? I have had a look but can't find anything. It looks like they have a decent enough API but it looks like it would take more work than I have time to spend on it. Thanks.
  19. Thanks! So I guess since that github comment is ~3 months old you have to be on a fairly recent version for the performance increase.
  20. When you access an image from the API you can get the width and height with $imade->width() and $image->height(). When you run these internally does ProcessWire get the sizes from the database or does it actually use GD to get them? I'm assuming if you aren't creating variations on the fly it just reads them from the database (the schema has width and height columns). Just checking that there won't be any significant overhead if doing this on lots of images.
  21. I have a site that has a parallax fixed banner at the top and then the rest of the content goes underneath with a higher z-index. It works great but when — on a Mac at least — you scroll quickly down to the bottom of the page it scrolls beyond the height of the document body and then snaps back and for a breif moment you can see the fixed banner underneath. Is there a CSS property to prevent this?
×
×
  • Create New...