Jump to content

adrian

PW-Moderators
  • Posts

    11,097
  • Joined

  • Last visited

  • Days Won

    365

Everything posted by adrian

  1. Just make sure $page->created is returning the format needed by the function by doing: date("Y-m-d H:i:s", $page->created);
  2. +1 for DOMDocument over regex
  3. I have had some personal communication with Ryan about this and it seems to be an issue with MySQL 5.6 (although arjen does debunk that is one of his posts), but I had the problem on a server with 5.6, but as soon as I rolled back to 5.5 it went away. Regardless this is something that does need to be fixed sooner than later because 5.6 will start getting more common. Can's fix is the current best option though and works perfectly.
  4. Not really sure if this helps your problem or not (I think maybe not), but is your server in a timezone 14 hours away from QLD? If you need to convert from that to QLD time, you can use a function like this: function convert_time_zone($date_time, $from_tz, $to_tz){ $time_object = new DateTime($date_time, new DateTimeZone($from_tz)); $time_object->setTimezone(new DateTimeZone($to_tz)); return $time_object->format('Y-m-d H:i:s'); } then call like this: $qld_time = convert_time_zone($page->created, 'Other/Timezone', 'Australia/Queensland');
  5. Hey teppo, Thanks for the thoughts on the checkbox issue. I agree that unchecking "password changed" does sound weird My reasoning for going this way was because I was wanting to avoid the need for an additional step (checking the checkbox) when creating a new user. I thought, maybe incorrectly, that anyone using this module would want to ensure that all new users are required to change their password when they first login. My approach to setting up admin users is to send them all the same initial password and ask them to change it immediately. I wonder if a better approach might be to use a dropdown select that is a required field when setting up a new user. It could be called "force password change" and have a blank default and then "yes" and "no" options. It's still an extra step when setting up a user, but at least this way I can ensure the superuser doesn't forget to do it. Any thoughts on whether this would be a more logical setup? Thanks for the reminder on the license - I actually haven't been good with that for any of my modules - mostly because of ignorance/trust with these sorts of things. I'll take care of it shortly and also check my other modules and do the same. PS Minor fix committed this morning - I woke up realizing that I had hardcoded the path to the profile page EDIT: Do you, or anyone else, know why I can't set the collapsed state of the pass field via the API? I can do it with other system fields, but not this one. You'll see in my code two commented blocks where I try to set it to open before the redirect and then set it to collapsed after they have changed their password.
  6. Hi everyone, Here's a little module that allows you to force users to change their password on their first login, or at any time if you manually force it. http://modules.processwire.com/modules/password-force-change/ https://github.com/adrianbj/PasswordForceChange Key Features During install it creates a new checkbox field in the user template, "force_passwd_change". Automatic checking of this checkbox when creating a new user is determined by the "Automatic Force Change" module config setting. When a user logs in for the first time (or if you have manually checked that field for an existing user), they will be warned that they have to change their password and they'll be automatically redirected to their profile page. They must change their password to something new - they are not allowed to re-enter their existing password. Bulk "Set All Users" option to at any time, force all users (by selected roles) to change their password. Hopefully some of you will find it useful and please let me know if you have any suggested changes/enhancements. PS I used the new info.json way of defining the module details, so it requires PW 2.4.3+
  7. It already strips out all html tags except <br><br /><p><strong><b><a><img> Although looking at this, it should probably be expanded to include <em> and maybe even <b> and <i> Does this take care of your request, or is it something else I am not understanding? Or is the stripping of tags not working for you?
  8. @mr-fan - thanks for testing. I am not sure this module is getting a lot of use, so I am not expecting many others to test so maybe I'll just submit a PR to Pete to get this new version committed to Github and available from the modules directory.
  9. Or you can use SQL directly as per Ryan's suggestion to a similar question I had: https://processwire.com/talk/topic/3053-possible-to-select-modifiedcreated/?p=30093 It always feels dirty to me to query and then truncate
  10. There is this mention: https://processwire.com/talk/topic/5281-paypal-payment-method-for-processwire-shop/?p=67668 So long as whatever payment system you are using (Paypal in the example mentioned above) has some way of securely confirming that the user's payment has been received, you can easily make the download available based on whether a "paid" flag has been set for their order.
  11. Glad you worked it out. Just a small note on PHP syntax: date(Y) will work, but will throw a: Notice: Use of undefined constant Y - assumed 'Y' error It should be: date("Y")
  12. Ok, here is my forked version that lets you choose the images and body fields for each email category: https://github.com/adrianbj/ProcessEmailToPage Please let me know how it goes for you.
  13. @mr-fan, It looks like you are using my latest version of this module - I was playing around with attachments and embedding them into RTE fields. I think the error is coming from the images field. Does your page have an images field? Is it named "images"?
  14. Just to explain the difference between what diogo and I wrote. His is simpler, but mine is more descriptive. child on it's own will always be the first child. With children, you can further select last(), or use eq(n) to choose the exact one in the list of children by its numerical order index. Hope that helps.
  15. Hi Tramvai and welcome to PW. This can be accomplished easily with a redirect. Place this in the template file that is connected to your Cars page: $session->redirect($page->children->first()->url); Of course you could also be more specific about the page that it redirects to, but in this example it will always go to the first child of the parent page.
  16. I am not sure where $name is initially defined, but your: $name = $event->arguments('$name'); doesn't look right. If you are wanting to get an event argument by name, you need something like: $event->argumentsByName("page"); Also, this: $person = $this->wire('users')->get("name=$name"); can be simplified to: $person = wire('users')->get($name);
  17. If you're putting that in a module you need to either use: $this->user or wire('user') $user is not available from modules (inside the module class) or inside functions due to variable scope
  18. This is how I have done it in the past: https://processwire.com/talk/topic/5534-new-articles-to-users-with-cookie/?p=53935 Ignore the title of the first post - this option does not use cookies. Note that this is not just about storing the last login, but rather the datetime of the last page they viewed, which may or may not be what you are looking for
  19. I think you should take a look at PayPal's IPN (https://developer.paypal.com/webapps/developer/docs/classic/products/instant-payment-notification/) Setting this up will allow you to set a field in PW to confirm that the user has definitely paid, then you could safely make use of their order-id by sending them an email with the order-id as a get variable in the URL. Your download script would then check the order-id and make sure the paid flag was set before initiating the download. I use this script as a starting point for my ipn.php file https://github.com/paypal/ipn-code-samples/blob/master/paypal_ipn.php Just add: include("./index.php"); at the top to bootstrap in PW and then inside: if (strcmp ($res, "VERIFIED") == 0) { you can use the PW API to set the paid flag to true etc.
  20. Absolutely possible and no problems! One thing you might want to check out is Soma's Soft Lock: http://modules.processwire.com/modules/page-edit-soft-lock/ This warns (or optionally prevents) users from editing the same page at the same time which could otherwise result in data loss. EDIT: You might have issues with multiple superusers changing field/template config settings.
  21. Hi Ioquan and welcome to PW! I am really surprised to see those failures as they should both be on by default in your version of PHP. Is it a default MAMP installation? Can you perhaps check your phpinfo results to figure out if it is in fact not available, or if it is a detection problem with PW. Let us know if you need help getting that info.
  22. Maybe I shouldn't be stealing your thunder Ryan, but just in case someone finds this post and is wondering the status of your module: https://processwire.com/talk/store/product/11-likes-fieldtype/
  23. I am no multilanguage expert, but perhaps this helps: https://processwire.com/talk/topic/1228-search-in-multilanguage-site-with-multilang-fields/ If not, at least this post will bump your question and someone more knowledgable will chime in.
  24. No offense intended to Khan, but in its current state, that module has several bugs. It also has a lot more than most people/sites need. I would recommend building your own using these posts as help: http://processwire.com/talk/topic/1716-integrating-a-member-visitor-login-form/ http://processwire.com/talk/topic/107-custom-login/ http://processwire.com/talk/topic/2937-creating-a-front-end-admin/
  25. kongondo's approach looks to be right to me, but remember that if your file field can handle more than one file, you'll need to specify which file, eg: $mp3->file->first->description or instead of first you can use: last, or eq(n) Or you could set the file field max files to "1" in the field's config settings.
×
×
  • Create New...