Jump to content

strandoo

Members
  • Posts

    112
  • Joined

  • Last visited

About strandoo

  • Birthday 09/19/1961

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

1,659 profile views

strandoo's Achievements

Sr. Member

Sr. Member (5/6)

36

Reputation

  1. @Flashmaster82 I've just had a look at how I did this before. I used a select option field to list a booking times (10:00am, 10:30am, etc). I probably got this from someone else on these forums because my comments for the code were more detailed than I usually do! Rather than use the message in the module settings, override it and use a message.php file: $scf = $modules->get('SimpleContactForm'); include("./message.php"); $options = array( 'emailMessage' => $emailMessage, ... Note: you shouldn't need 'offert_typeoffacility' => 'offert_typeoffacility->title' in the options. In message.php, sanitise and get the field title like this: $facility = $sanitizer->int($input->post->offert_typeoffacility); // (other fields)... // To get the value of an Options Field Type, you need to // first get the id submitted // then get all the options for that field // then use the eq for that option to get the title (eq starts with 0, so subtract 1 from the id) $field = $fields->get('offert_typeoffacility'); $all_options = $field->type->getOptions($field); $theFacility = $all_options->eq($facility - 1)->title; $emailMessage = "Hello, Option: {$theFacility} ... "; I try to use Page Reference fields for SimpleContactForm selects now because it's even easier: $theFacility = $pages->get($facility)->title;
  2. I've just encountered the same issue. Tried to install a module on a site I had finished about 5 months ago. Tried adding the various config settings, etc. k07n's suggestion to check the php zip rang a bell. Only then did I see that I was on php 5.x (which I updated to 7.3) and had zip disabled. That did the trick!
  3. Sorry folks. I've decided to restore and do over. Please disregard; I was a bit stressed when I first posted!
  4. Hi all. I'm in a bit of a jam: I've been working on a site and suddenly received the following error (TraceyDebugger installed): Exception: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined (in ....... /public_html/clients/omnia/wire/core/PageFinder.php line 627) I get it on all front end pages. I'm not sure what I did to trigger it but I desperately need to fix it. I do have a backup from yesterday, but I've done loads of updates. Any ideas where to start? Or should I restore and do over?
  5. My 2cents worth: I frequently add a credit line in the footer of my sites and like to provide a field in my settings to add links. To keep the rich text capabilities but strip out the paragraph tags so the content can be used inline, I use this function on the field: function stripParas($string) { $string = str_replace(array("<p>", "</p>"), "", $string); return $string; }
  6. @PWaddict Happy to help. SimpleContactForm and FlyDev's ReCaptcha did all the real work.
  7. @PWaddict Yes, I've got it working. I made a simple InputField that works with FlyDev's MarkupGoogleRecaptcha module so the reCaptcha can be added to the SimpleContactForm. Then, using the info on the SFC instructions page, I added the following hood to my ready.php file. I've attached the zip file of my field type if you want to take a look. I'm no expert, but I based it on another simple module. $this->addHookBefore('SimpleContactForm::processValidation', function(HookEvent $event) { $form = $event->arguments(0); $recaptcha = $form->get('recaptcha'); if (!$this->input->post->{'g-recaptcha-response'}) { // attach an error to the field $recaptcha->error(__('You didn\'t pass the reCaptcha test.')); // it will be displayed along the field } }); FieldtypeRecaptcha.zip
  8. @Zeka No problem, thanks for the suggestion. I'll have a look. 👍
  9. Hi @Zeka Thanks, but I probably haven't explained it correctly. The Category pages are not actual page trees (the products are already organised under as pages under the product type pages; I use sort=sort on those). The Category pages have no children and fetch their related content not as children but with a 'find' selector. The client wishes to reorder pages differently under Categories than their 'natural' order under Product Type.
  10. I've got an existing site where the client wants to add a custom sort order to his products when viewed on the Categories page. Categories are a Page field type and the products are already manually sorted by Product Type. And a product can appear in more than one category. If it were a 1-to-1 relationship, I'd just add an integer field to the product for a custom sort order field. But some products have 1 category, some have 4. Some categories apply to only a dozen or so product; some apply to 300 or 400. (He's supplied a spreadsheet to import). Even if I figure out how to sort these, will the client be able to add new products and alter/insert a sort order? Here's an illustration: Products (Actual page hierarchy in the Admin. These are sorted manually and appear in this order on the front end when viewing a 'Product Type' page) - Bracelets -- Product 1 -- Product 2 -- Product 3 - Earrings -- Product 4 -- Product 5 ... In the front end, when viewing by Category, we'd like to display the products in a custom order per category: - Amber - $pages->find("template=product, category=$page->title, sort ???") -- Product 1 -- Product 4 -- Product 3 - Silver -- Product 2 -- Product 5 -- Product 3 ... When I thought he was only going to sort the first page of results (18 or so), I was going to add a new page field type for each category so the client could select a limited amount of products to display first (I do this for the 'related products' section of the product page). Then I would select these first, then select the unsorted products (minus the first batch) and append them. But since the client wants to sort hundreds of products this way, I don't think this method would be practical. I've seen a similar post where Teppo uses a single field as an array, but I'm not sure if this would work or if I could populate the field from my spreadsheet. I welcome any ideas! Thanks.
  11. First, if you want to wrap the module render code in a div, don't use that class and id (and don't use 2 ids for the same element). Once the form is rendered, you'll see that there is already a div with that class that wraps the field you wish to hide. In the CSS, just target that class: .form__item--scf-website { display: none; }
  12. Thanks all. I ended up making a simple function that used used preg_replace and str_replace to strip the styles then nuke the empty spans and paragraphs. The imported html was pretty consistent, so it was pretty straightforward. But I like the idea of using $sanitizer, so I'll try both of those options to see how they work.
  13. Thanks, @kongondo . And thanks for the links, I’ll dig in and see what I find. 👍
  14. Hi all. I've built a module to create and update pages from an XML feed. It work nicely, except I'm having a problem with imported inline css styles. My Body field gets populated by a field in the XML that usually contains a load of inline CSS styles (like "<span style="font-style:normal;font-weight:normal;background-color:transparent;text-decoration:none;">). I've tried using $sanitize->purify() but that doesn't seem to do anything. Am I using it incorrectly? Is there another method to clean up this cruft from the HTML? Ideally, I'd just be left with <p>, <strong>, <b>, etc. All of the other fields sanitize correctly. Any ideas what I'm doing wrong?
  15. Here's a follow up (see above): I've been able to partly update my existing registered users with the API. I've enabled tfa_type, but can't set their tfa_code_email. That means that when they first log in, they'll see a notice telling them to configure TFA by entering their email address and receiving a code. That's not horrible, but that means they may not set it up if they are lazy. I'd rather already have their email address set so they'll just receive the 'we've sent you a code...' message and do it. So any thoughts about pre-populating this tfa_code_email field (it's a module setting) would be helpful. I've added an admin confirmation system by adding another role (Ryan suggested this in another forum post) and hooked after the 'LoginRegisterPro::createdUser' method to notify the Administrator by email (with options to approve or deny as links that process the user without going into the CMS; this then notifies the User if successful). I've also hooked 'Users::saveReady' to send the same email, in case the Admin approves manually in the CMS. Finally, I've given the registered users a choice of receiving their TFA code via email or SMS text message as mentioned above. ClickSend is affordable and easy to use. I've added radio buttons for 'Email' and 'SMS' to the User template along with a telephone field so users can choose when they edit their profile. 'Email' is the default, but if 'SMS' is selected, that phone number is prepended to the @sms.clicksend.com and replaces the email address via a HookBefore 'TfaEmail::emailCode'. I'm not great with Hooks, but it all made sense eventually and was a learning experience. I've simplified some of the interface on Edit Profile with 'display: none' in css (not ideal). But it all works pretty well. 🙂
×
×
  • Create New...