netcarver Posted October 28, 2012 Share Posted October 28, 2012 Warning: Still a work-in-progress. Still has quite a lot to be done.At Tom Reno's request I started work on a module that allows you to setup various watches on fields in your PW installation. You get to choose a field and can then specify when a change to the watched field should trigger a notification email to various interested parties. Pictures might help, so here we go... I intend adding a further restriction so fields in certain templates can be watched. 9 Link to comment Share on other sites More sharing options...
apeisa Posted October 28, 2012 Share Posted October 28, 2012 Very interesting module and looks very cool! I think there will be many kind of use cases for this one. Interested to hear how Tom will be using this? Link to comment Share on other sites More sharing options...
ryan Posted October 28, 2012 Share Posted October 28, 2012 This continues to look really great! One possible suggestion would be to use the PageAutocomplete Inputfield for the individual users, just because some people might actually have thousands of users. This may be too much for an asmSelect. 1 Link to comment Share on other sites More sharing options...
netcarver Posted October 28, 2012 Author Share Posted October 28, 2012 This continues to look really great! One possible suggestion would be to use the PageAutocomplete Inputfield for the individual users, just because some people might actually have thousands of users. This may be too much for an asmSelect. I'm trying this out now as it's a new Inputfield type to me. Can you point me in the direction of a module that uses this Inputfield type so I can get a look at how it's used? I tried the following but I'm missing something... $field = $m->get("InputfieldPageAutocomplete") ->set('label', 'Select individuals you wish to notify') ->attr('id+name', 'users') ->set('parent_id', $this->config->usersPageID ) ->set('labelFieldName', 'name') ->set('columnWidth', 50) ->attr('value', explode("|", $user_ids) ); ; $form->add($field); Thank you in advance! Link to comment Share on other sites More sharing options...
ryan Posted October 31, 2012 Share Posted October 31, 2012 Sorry Steve, I've sent you down the wrong path. The 'name' field can't be used with partial match selectors, so there isn't really any point in using the autocomplete unless you want to have to type out the whole username to find it. Sometimes I have to try things out before I realize them. If you wanted to do that, below is an example how: $field = $m->get("InputfieldPageAutocomplete") ->set('label', 'Select individuals you wish to notify') ->attr('id+name', 'users') ->set('parent_id', $this->config->usersPageID ) ->set('labelFieldName', 'name') ->set('searchFields', 'name') ->set('operator', '=') ->set('columnWidth', 50) ->attr('value', explode("|", $user_ids) ); Link to comment Share on other sites More sharing options...
apeisa Posted December 14, 2012 Share Posted December 14, 2012 Steve, I took another look at this module, since I might have upcoming requirement to have admin emailed every time any page is saved. This module is pretty close hit, but does much more and in more granular way (fields instead of pages and specific changes). This will be great reference for me if I end up building something similar but for pages. But while I was looking through code I noticed that there is sql-query as a first thing in init() method. Is there really need to have that sql in each page load, or could it be done later? Link to comment Share on other sites More sharing options...
netcarver Posted December 14, 2012 Author Share Posted December 14, 2012 I imagine it could be done later Link to comment Share on other sites More sharing options...
Nico Knoll Posted December 16, 2012 Share Posted December 16, 2012 -- Moved into development -- Please create a separate topic in "modules" when the module is finished. 1 Link to comment Share on other sites More sharing options...
netcarver Posted December 16, 2012 Author Share Posted December 16, 2012 @Nico, sure thing. Thanks for becoming a module mod 2 Link to comment Share on other sites More sharing options...
ceberlin Posted January 26, 2014 Share Posted January 26, 2014 This module seems to be not working well with the latest DEV 2.3.13 of PW: - Throws an error about a button problem (I think to remember: InputfieldButton, line 253?) when deleting an entry. - Uses not PDO but Mysqlli (a "depreated" warning) Link to comment Share on other sites More sharing options...
teppo Posted January 27, 2014 Share Posted January 27, 2014 - Uses not PDO but Mysqlli (a "depreated" warning) Slightly unrelated, but is there an actual warning or what? Just checking, 'cause in that case we'd be seeing *a lot* of these Link to comment Share on other sites More sharing options...
ryan Posted February 2, 2014 Share Posted February 2, 2014 There shouldn't be any deprecated warnings about mysqli at least. We don't plan on dropping that database driver anytime soon, just will encourage people to standardize on PDO in the future after 2.4+ is well established. But I don't really see a reason why we'd ever need to remove the mysqli driver, as some sites may need it for legacy use, even after all modules are using PDO. InputfieldButton only has about 50 lines in it, so not sure about line 253. @ceberlin can you post in a screenshot or copy/paste the exact errors you saw both for the deprecated warning and the InputfieldButton? Link to comment Share on other sites More sharing options...
Macrura Posted April 20, 2014 Share Posted April 20, 2014 @netcarver - thank you for this module, I'm finding it really useful for several sites! One question is how can i modify the sent message to also include info about the page where the field was changed, as well as maybe a link directly to the admin edit for that page. TIA Link to comment Share on other sites More sharing options...
netcarver Posted April 20, 2014 Author Share Posted April 20, 2014 @Macrura, Glad to hear it is useful to you. My original plan was to watch fields regardless of the page context so there's no direct way to do this at the moment. I'll look at adding the page context for the parser. 1 Link to comment Share on other sites More sharing options...
Macrura Posted April 20, 2014 Share Posted April 20, 2014 hi steve, thanks - that would be awesome.. Link to comment Share on other sites More sharing options...
netcarver Posted April 20, 2014 Author Share Posted April 20, 2014 @Macrura, Off the top of my head: could you try making a small change to the ProcessFieldChangeNotifier.module file? After making the change shown there, you should be able to access the page context using 'page.subfield' from your templates but I haven't verified this yet. YMMV 3 Link to comment Share on other sites More sharing options...
Macrura Posted April 21, 2014 Share Posted April 21, 2014 that works perfectly.. i was able to have the page title in the email as well as create direct links to the page editor... Many thanks! 1 Link to comment Share on other sites More sharing options...
netcarver Posted April 21, 2014 Author Share Posted April 21, 2014 @all I've updated the module to allow parsing of page subfields, fix xdebug notices, move DB queries out of the init method and make the strings translatable. 3 Link to comment Share on other sites More sharing options...
netcarver Posted April 21, 2014 Author Share Posted April 21, 2014 @all Sorry, looks like I pushed a bad version. I'll fix that. Sorry, false alarm - it was a problem with a local change that wasn't added to the code I pushed. Link to comment Share on other sites More sharing options...
Macrura Posted April 21, 2014 Share Posted April 21, 2014 Hi steve, is there any chance that something changed on this new version that would truncate the field in the email if it has line breaks? I have this new version installed on a site but it is only showing the 1st line of the field, whereas the other site is using the old version and shows the complete field; they are on different hosts, so there could be something with that; Link to comment Share on other sites More sharing options...
netcarver Posted April 21, 2014 Author Share Posted April 21, 2014 @Macrura No changes that I'm aware of; it's the tagParser module that takes care of constructing the email subject and body lines and that hasn't changed for a few days. However, if the field with the embedded breaks is in the email subject template then those fields will be truncated to prevent email header injection attacks. You should be able to use fields with breaks in the email body template without issue. Is your issue occurring in the subject or body of the email? BTW, I just added a new transformation to the TagParser to help deal with this if it is indeed the situation. Take a look at "nl2spaces" which will strip newlines and replace them with spaces. Might not be exactly what is needed but it is, perhaps, better than nothing. Link to comment Share on other sites More sharing options...
netcarver Posted April 24, 2014 Author Share Posted April 24, 2014 @all Just pushed v0.6.0 adding... Config of watches using empty strings (detect changes from empty->non-empty or vice-versa.) Hookable triggerMatch() method - so you can define your own actions when a watch triggers. 2 Link to comment Share on other sites More sharing options...
pwFoo Posted May 7, 2014 Share Posted May 7, 2014 Nice module Could you also implement page change notifications? So users could get a notification at each page update? Link to comment Share on other sites More sharing options...
adrian Posted May 7, 2014 Share Posted May 7, 2014 @pwFoo, Not sure exactly what you need - are you after admin or front-end notifications for users? If the latter, then I described a solution a while back that might take of what you need without a module: https://processwire.com/talk/topic/5534-new-articles-to-users-with-cookie/?p=53935 Obviously not exactly how you want it set up, but might be easily adaptable. Anyway, not sure if it is what you are after, but thought I'd see Link to comment Share on other sites More sharing options...
netcarver Posted May 7, 2014 Author Share Posted May 7, 2014 Hi @pwFoo. Like adrian, I'm unsure of what you are actually asking for. Could you clarify please? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now