Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by strandoo

  1. @LMD Yes, that's a great point. I'll check with the client to see if they are unique or not. Either way though, if the user fails to log in, the change/recover password system could be amended to include instructions i.e. 'Please ensure that you have selected your original country yada yada...' But I still think the requested changes will make things more complicated than they need to be.
  2. @flydev Brilliant! This looks very helpful. I'll be starting on this again this week. I do have an older version of LoginRegisterPro and I'll have a look at that. I think this would also be a good time to purchase/upgrade it. Thanks, flydev.
  3. @LMD I think the number part may not be unique. In any case, that user name format pre-dates the website. It’s what the company has been using for customer/dealer ID numbers for years and they are part of their internal ordering system. I agree that what they want complicates things. But the idea to hide the country code comes from the company’s Managing Director, so I’ve got to try to implement it. 😮‍💨
  4. @bernhard Good question. There’s also a drop-down ‘region’ selector in the navbar to select your region. Presumably, once the new system is instigated, there will also be text on the login page along the lines of “Please ensure your region matches yadda yadda.” The site is live; the log in is the DealerNet link in the footer: https://teak.com. (Regions are currently limited to 3.)
  5. Ok, it turns out it's very easy to do this with the 'normal' /processwire/ login form: https://processwire.com/api/ref/process-login/login/ A quick test hook confirmed this. But I'm using the form generated from the LoginRegister module and that one's not so obvious (to me anyway). Maybe the Pro version would permit me?
  6. Hello ProcessPeople. I need some help, please: I've built a site that's mainly a catalogue of products, but certain approved Dealers can login to gain access to dealer-related stuff (mainly place orders with the manufacturer). Each Dealer is pre-assigned a username in the form of Country Code and Number (UK-12345, FR-56789, etc). I'm using this with the LoginRegister module and it works well. Not content with this simple setup, the client would like me to modify the login so that the Dealer only types the numeric part of the Username (12345) and have the Country Code (UK-) invisibly prepended to the user-supplied part when the Submit button is clicked. The user's Country Code is captured when they first arrive at the site with an IP-based geolocation service, so getting the Country Code is easy. Is there a way to hook into the ProcessLogin module (or the LoginRegister module) to quietly insert the Country Code? I'm still a bit new to hooks. Thanks for any suggestions.
  7. I haven't tried these fixes on any of my forms with the Recaptcha yet. But I did try changing that line back to '!$form->getErrors()' (the original) and it seems to still work. By the way, are you getting 2 emails sent for every form submission?
  8. @Java Doesn't EmailObfuscation just works on email addresses and not forms? Many of my clients request contact forms (although they can be such a pain in the ass (the forms, not the clients (well, maybe them too!😆))).
  9. @PWaddict Yeah, that's because the newer InputfieldForm.module creates a new hidden field before the closing </form> tag (<input type="hidden" name="_InputfieldForm" value="[your-form-name]">). The presence of that field throws off the 'spam count'. That's another anti-spam measure in the module which makes sure the total count of form fields is what is expected. See the comment around line 206. I tried to figure out how to target and exclude the new hidden field, but I gave up and just changed line 211 to '$excludeFields = -1;'. Not very elegant and of course, this will break the form if used on a pre-3.0.210 installation, but it gets it working until I can spend more time on it.
  10. Ok, more digging and I think I've got it. The InputfieldForm.module made at least 2 changes that effected the no-longer-supported-but-heavily-used SimpleContactForm (by me anyway): 1) it appends a hidden field at the end of your form ('$landmark', line 178). I don't know it's purpose, but I'll now see if I can subtract it from the field count in the Spam Protection of SimpleContactForm. 2) $form->getErrors() doesn't work the way it did previously. Thanks to a post by @da² that I came across, I've been able to use $form->getErrorInputfields() instead on lines 203 and 245 in the SCF.module. For now, I'll just edit the module, but maybe there's a more elegant way to do it.
  11. Ok, I had a look and but couldn't figure out exactly what is going on. I'm filling in the honeypot to test and that's getting logged as spam, but isSpam doesn't seem to be working and I'm not clever enough to know why. But since SimpleContactForm + PW 3.0.210 is adding a hidden field (<input type="hidden" name="_InputfieldForm" value="contact-form">) where PW 3.0.200 isn't, I thought I'd try the replacing 210's InputfieldForm.module with the one from 3.0.200. Once I did that, no more hidden field and the spam filter works as expected. So maybe someone more knowledgeable than myself can spot the difference and see if SimpleContactForm can be patched?
  12. @PWaddict Yes, I was looking into this with a non-recaptcha form. I've got probably a dozen or more sites using SimpleContactForm, some probably now updated to 3.0.2xx, so I'd like to solve this! Yesterday, I noticed this error in TracyDebugger: PHP Notice: Undefined offset: 0 in .../modules/SimpleContactForm/SimpleContactForm.module:238 So when I get a chance, I'll try to see what that's all about.
  13. @Flashmaster82 I had a quick look at some forms on a few sites and it appears that under PW 3.0.210, a new hidden field is being inserted at the end of the form, just after the token field: <input type='hidden' name='_InputfieldForm' value='contact-form'/>. I suppose this is why the count is off, but I don't know why the form gets sent anyway. I found https://processwire.com/api/ref/inputfield-form/ that might explain it somehow.
  14. @PWaddict I'm getting the same as you: either 'Number of fields does not match' or 'Honeypot field was filled', then followed by [SUCCESS] a second later. But this is happening with my own tests, so it's probably not so much clever spammers as much as something broken with recent PW updates. Any idea where this might be failing?
  15. Do you have ‘scf-website’ as one of the fields in the module settings > Select Form Fields settings? If so, try removing that.
  16. Thanks @Guy Incognito. Yes, now that I've dived in a bit, I can see that handling the communication may be tricky. (Logged-in sales rep initiates a 'stock query' > check if exists, creates a new DB record > writes file > waits for response > checks if new response file matches my stock query > parse file and update DB record > display result > rinse and repeat.) The php module 'Inotify' looks promising as far as checking for directory/file changes, but I haven't gotten there yet. Thanks again.
  17. Hi folks. I wonder if anyone has built or encountered an API-like FTP system of interacting with another computer. My client wishes to exchange product information (primarily stock quantity) via small text files that they will get/put via FTP to their website. (Currently, they FTP 10 csv files every day which I parse and use to update their website, so hopefully I can build on that). I think writing the files won't be difficult, but I imagine that I'll have to somehow monitor a directory, looking for new files and/or changes to existing files. I'd instigate the action on my end, then wait for a response via ftp and respond by parsing the new file and responding accordingly. I'm most worried about detecting the incoming files: any ideas on how this can be done? Maybe only start 'watching' after the initial action? Any other thoughts about parsing/writing/deleting the files? I'd appreciate any thoughts, ideas, etc. - Paul
  18. Hi all. I've used this module loads of times but I'm having a problem now. I've imported a long list of redirects that I've grabbed from a sitemap.xml file. They imported fine and looked good. When I came back a few days later, many (if not most) of the 'redirect to' entries turned into 5 digits preceded by a carat character (^). See screen shot. I've tried a few times since, including pasting in the list in small chunks. Any idea what is going on?
  19. @Jan RomeroThanks. I did try that with limited success. For some reason, it would only return the same 12 category pages then stop. I ended up doing something completely different (getting the categories, then getting the products for each by converting those spaces to pipes ( | ) and using the text as a selector. Much simpler and more 'ProcessWirey'. Thanks for leading me there.
  20. I'm sorry if this has been covered before. I can't seem to get my head around how I do this. I have a bunch of Product pages with product codes (just say P1, P2, P3, etc). Different products may be displayed on the site depending on many criteria, including what region you are in (EU, USA, GB). Each product belongs to a Category page, but this relationship is set in a Category page field called product_codes which contains a number of product codes separated by spaces (P1 P2 P5 P6 ...). I need to display only the Category pages for those products in my found products list. If I were doing this from scratch, I probably would have structured this differently, but the data comes from frequently updated CSV files. Is this a case of creating an array from $category->product_codes and searching through those or creating a selector from that field with pipes (P1|P2|P3)? Thanks all.
  21. Ok, a little more research turned up a topic about merging different arrays and that led me to explode my page array then use the above-mentioned json_decode/encode thing to convert to a standard array. I don't quite understand how that works, but it does, so I'm a happy camper. $entriesList = wire('pages')->find("template=options-page, title=$id, limit=1")->explode(['title', 'sku_code', ... ]); $entriesList = json_decode(json_encode($entriesList), true); /// CONVERT TO STANDARD ARRAY
  22. Hi all. This is where my lack of actual PHP knowledge is getting to me. I've inherited a never-completed WordPress website that I'm trying to redo in PW. There are products, categories and product options all supplied as separate CSV files. (These will be edited and uploaded every day, so I will need to eventually import the data with a chron script). Importing and displaying the category and product data isn't a problem, but the product options files contains numerous fields with comma- and pipe-delimited strings which need to be converted into arrays. So, when viewing the product-page (template) for 'Chair 123' (product code 'c123'), I'd normally get all the options like '$options = $pages->find('template=options-page, pcode=c123'); But since there are fields in the options-page that look like "505|501|512" (for color codes), I'll need to get these into an array. Thats' very simplified; the actual options page has about 45 fields, used to present various options in 3 worldwide territories with multiple parts/color combinations for each conditional territory! I should also mention that I have the old WordPress site and can see the custom functions the previous guy had set up and (for me) it's very complicated. Most of it is standard PHP, so I was hoping to use much of it 'as is' as I can. For instance, there's a function on the products page that returns an associative array that looks like this (in the WordPress php): $bt_options = bt_get_product_options($entry["code"]); foreach($bt_options['spec_docs'] as $key => $bt_spec_doc) { $bt_show_download = ""; if($bt_options['spec_docs_territory'][$key] == "E" && $bt_this_territory == "EU") { $bt_show_download = "Y"; } elseif($bt_options['spec_docs_territory'][$key] == "U" && $bt_this_territory == "US") { $bt_show_download = "Y"; } ... } And the bt_get_product_options function starts with this (again from WordPress) function bt_get_product_options($id) { global $wpdb, $bt_colours, $mysql_table; $entriesList = $wpdb->get_results("SELECT * FROM ".$mysql_table['options']." WHERE web_product_code = '".$id."' ORDER BY id ASC LIMIT 1"); $entriesList = json_decode(json_encode($entriesList), true); /// CONVERT TO STANDARD ARRAY if(count($entriesList) > 0){ $output = array(); $output['jquery'] = ""; foreach($entriesList as $entry) { ... /// COMBINATION TERRITORY elseif($key == "comb_territory" || $key == "addnl_subtabs_territory" || $key == "spec_docs_territory"){ $ter_array = explode("|", $tt); foreach ($ter_array as $k => $tr) { $output[$key][] = $tr; } } ... loads more like this ... } } return $output; } TL;DR: Can I use the above in my PW code, provided I swap the WP MySQL bit with $entriesList = $(wire)pages->find("template=options-page, product_code=$id, limit=1) ? (I tried this on a limited set of fields but didn't return anything). Or do I need to do a MySQL request too? And from what I can tell, thet json_decode/encode line should covert the page object to an associative array, correct? Should that work in this case? Thanks for reading this far.
  23. @Robin S Ok, that is concise, clear and – now that I see it – much simpler than I thought. As usual, things are always easier with PW. Many, many thanks.
  24. Hi. Sorry about the confusing title. I suspect this might be a case for the owner selector, but I can't figure it out. I've got Video pages (about 140) where each video can be tagged according to subject (tags are a Page Field displayed with checkboxes). Videos are then added to a Client page, also with a multiple checkbox Page field. A client logs onto his/her page to see a number of videos selected for this client, displayed in a grid with a list of the aforementioned tags in a sidebar. Clicking the tags displays/limits the videos via Ajax. All pretty simple (getting all tags, selecting vids by tag page field). Now the client wants to limit the tag list based on the clients' available videos (so they only see the categories of 'their' videos). I'm not sure how to select just the tags that are included in the videos that are included in the client page. It's probably simpler than I think. I suspect I need to get the 'owners' of the PageField for the videos of the client, but I'm not sure how to construct that. Any pointers? Thanks in advance. Oh, and these are fitness videos. Although, I suppose they could be just about anything... Paul
  25. @AndZyk Thanks for the response, but this doesn't work. I'm using the Body field, a CKEdit textarea field. When the text was imported, wasn't formatted with <p> tags. Those tags are added (via javascript presumably) when a page of that field type is loaded for the first time in the admin. I think one solution might be to just do a find/replace on that field using the API and add <p> and </p> tags, maybe replacing double line breaks with </p><p> or something. Of course, while working on the site, many of those fields are now properly formatted, so I may make things worse on those pages. I'll have a look at the database content before proceeding.
  • Create New...