-
Posts
150 -
Joined
-
Last visited
Everything posted by strandoo
-
Thanks, @kongondo . And thanks for the links, I’ll dig in and see what I find. ?
-
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?
-
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. ?
-
I've just been playing around with the TfaEmail module in conjunction with the LoginRegisterPro module. I've got a client who wants to upgrade their simple user registration/login system to use TFA (users request an account and if approved can access proprietary content and downloads). I thought the Email/SMS route would be the simplest and most familiar method. It works fine with just an email address (see below for SMS). The site already has about 60 registered users, all with valid email addresses. I'd like to be able to transparently upgrade all accounts to TFA, so I thought I could copy their email address to the 'Email/SMS two-factor authentication' field. The problem is that if I do that and save the user, a code gets sent out (which would seriously worry/confuse the user!) Is there a way to avoid this? Maybe disable something while I update the email fields? Or should I do this programmatically when a user logs in for the first time after in the front end? Maybe copy the email address 'behind the scenes' along with a notice of some sort? I guess I'm trying to skip the initial confirmation step of the TFA. Once that's solved, I plan to allow the users to decide whether they want to continue using an email address or change to SMS message for authentication. I'll offer the option on their profile page. If they choose SMS, I'll use a service like ClickSend to send (I've had trouble finding free gateway numbers for the UK mobile carriers). In that case, I'd try to hook into the TfaEmail module to append the '@sms.clicksend.com' to the mobile number provided.
-
Yeah, that's what I thought. While I was building the site, I hit the Stripe form page a lot (testing the layout, shopping cart, etc) then back again. I think I must have generated quite a few incomplete transactions! Once people start using the site, I don't think it will be a big problem. Maybe I'll just disable the intents during development in the future. But I'll probably look into a way to delete them via the API. I'll post my results if I get any. Thanks for the module.
-
@benbyf Hi Ben. I've been trying out this module and modified the form for use with the Padloper shopping cart. (I was using a different Stripe module but I needed to upgrade to one that uses Intents). All is working well, but I've just realised that I've got a lot of 'incomplete' transactions listed in my Stripe Admin panel. I see the cancelIntent() function in the module, but I'm not sure when/how I should call this. Could I use this to get rid of my backlog of incomplete transaction? Sorry if I'm being thick, but I guess I don't quite understand the Stripe Intents concept. Thanks.
-
Get all pages with multiple categories as duplicates
strandoo replied to strandoo's topic in General Support
@Robin S Thanks, that's perfect. I can't believe it was that simple; I was definitely over-thinking it, trying things like append and add. Many thanks. - P -
Hello ProcessPeople. I'm trying to get an xml file for a store locator-type map page. It works fine, but the client wants the icon colour to change depending on the location categories (which can be multiple categories). I've decide the easiest way to do this based on my existing javascript would be to just get multiple results in my xml file for those locations with multiple categories and let the js display. Like so: 'Location A' has 2 categories 'Residential, Health' 'Location B' has 2 categories 'Health, Education' 'Location C has 1 category 'Residential' I'd like a selector which would produce this xml (sort of like the opposite of 'unique'): <marker title="Location A" category="Residential" ... /> <marker title="Location A" category="Health" ... /> <marker title="Location B" category="Health" ... /> <marker title="Location B" category="Education" ... /> <marker title="Location C" category="Residential" ... /> Note that it doesn't matter if the result is 'category="Residential, Health"', as long as any location with 2 or more categories appears as a duplicate; I don't need to strip out the other categories since I'm using the first word of the category string to determine the colour of the marker. I think I may need only one category returned, if possible. There are only 5 categories in total. Any suggestions? I've tried searching through the forums and cheatsheet, but I don't really know the term for what I'm looking for. Non-unique? Thanks.
-
Hi all. I'm using the LoginRegister module with a Business-to-Business site. Currently, it appears that you can only call up the Registration form if you are not logged in. I don't want just anyone signing up for an account but would like the sales reps to sign up clients for them. As such, I want to password-protect the Registration form so only certain roles can access it. "Why not just log in to the back-end and create a new user?" you say. I'd like the signup form in the front end because a) this will be the only function the sales reps will use and b) they will often sit with the customer and fill-out the form together. I'd like the interface to match the front end of the site. Can I enable the Reg form through a hook? Any pointers would be greatly appreciated.
-
@dragan I’m using the SimpleContactForm module, not Ryan’s. It’s my “go to” contact form solution lately, but I’ve only just tried it in a modal today (actually, I’m trying it with the featherlight.js light box plugin for the pop up functionality). I’ve done it with a hand-rolled form with Ajax, so I’ll probably just do that again. It’s on a local machine. If I try to make it work, I’ll post it.
-
Hi Roych. Did you ever solve this? I'm trying the same thing with pretty much the same results, so I'd be interested if you did.
-
Yeah, pretty much. It's not as clean as I would like it, but it works fine. I discovered that it works fine if I include the necessary javascript in the $config->ajax part of my page, then it works as expected: if ($config->ajax) { $scf = $modules->get('SimpleContactForm'); echo "<div>{$scf->render()}</div>"; // if not enclosed in a div, my column formatting was getting lost echo "<script src=\"{$config->urls->siteModules}SimpleContactForm/resources/jquery.simplecontactform.js\"></script>"; echo "<script src=\"{$config->urls->templates}js/main.js\"></script>"; // including the 2 scripts made it work. } else { ... // full page with contact form The only downside is that every time the form submitted with missing required fields (i.e., to throw an error), the 2 script includes get added to the form section. This makes for redundant/duplicate scripts called. Not ideal, but it works. If anyone know why this happens – or a way around it – I'd love to hear it. Edit: Looking at other sites where I've used this module, I realise that I only need to include the main.js script (where I have the $.simplecontactform($('.js-simplecontactform')); line). Also, if I put that <script ... main.js\"></script> line inside the <div>, it works fine without duplicating the script on every error.
-
I've got a project where this module may work nicely. One question however: has anyone found a way to update an existing page via email with this? Like send an email to a specific address or with a specific field that will find an existing page and replace a field's content? I'd appreciate any suggestions or ideas along these lines.
-
@lickny2001 I came across this post that should help:
-
@gebeer Wow. That was fast AND very helpful. I just changed 'Inputfield::render' to 'InputfieldSelect::render' as you suggested. I don't know why I didn't try that; I'll try harder next time! Cheers.
-
Hi again. Great module; I'm using it again and wondered about this bit of code in your documentation: $this->addHookBefore('Inputfield::render', function(HookEvent $event) { if ($this->page->template->name === 'contact') { // adapt template name to compare with $inputfield = $event->object; $inputfield->addClass('col-sm-8'); $event->return = $inputfield; } }); This adds the 'col-sm-8' class to every field input. How can I just single out a specific type of input to add a class to? Specifically, a <select> input. (I need the class for some jquery stuff). Thanks in advance. P
-
Maybe I'm missing something, but I've been using the following technique to darken my 'hero' images so I can put white text over the top: In my template, I have two fields, 'hero_image' and 'hero_overlay' (usually an integer if I'm dealing with alpha/opacity - or a text field if I want to specify rgba colour values). <?php $hero = "{$page->hero_images->first->width(1920)->url}"; //simplified; I usually do some responsive stuff here. $heroOpacity = $page->hero_overlay ? $page->hero_overlay : 0.3; // set a default opacity $heroOpacity = $heroOpacity * 0.1; //convert integer to a percentage. ?> <section class="hero" style="background: url('<?php echo $hero; ?>') 50% 50% no-repeat;background-size: cover;"> <div class="hero-overlay" style="background: rgba(0,0,0,<?php echo $heroOpacity; ?>)"></div> ... </section> Styles: .hero has a fixed height and .hero-overlay is absolutely positioned to fill the width and height of .hero. (I use 'first->' with my hero images because I like to try out different images and the ones I don't use can stay in the system in case I change my mind). The beauty of this system is that you can match the overlay opacity to the image to get the best fit between text legibility and hero image. I suppose you could reverse this and apply css opacity to whatever div holds the background image, thereby controlling the opacity of the image and letting a background color fill show through (as the ngrmm mentions in the o.p.) You can see this here: https://www.creationofnature.co.uk. Play with the opacity in the inspector. You can also expand this with 'rgba(x,x,x,x,)' instead of opacity to get coloured overlay effects.
-
I’d like be able to show mine, but it is horribly out of date, so here’s one I did awhile ago for my (ahem, very talented) daughter: http://sarahstrandoo.com Also perhaps http://lynnmooredesign.com/ And although it’s not a portfolio, per se, this gallery goes into a bit more depth about their pieces and might provide some inspiration. http://ptfineart.co.uk/
- 4 replies
-
- 5
-
- portfolio
- developer portfolio
- (and 2 more)
-
Ok, I'm revisiting this. I guess I need to echo the form when I use Ajax: if ($config->ajax) { echo $modules->get('SimpleContactForm')->render(); } else { Now the form works fine with one exception: when I submit the form with required fields empty, ajax works and I get the red 'Missing required field' text, but when I submit a second time (with or without entering data in a required field), the page submits without Ajax (i.e., it refreshes). I suspect it's a jquery thing; any suggestions? Here's the work-in-progress: http://bullocks-ley.strandoo.com/contact-us/. Thanks in advance.
-
Hi all. Great module, Justb3a. It was easy to set up and get working, submitting to the same page without Ajax. Now I'm trying to do it with Ajax but something's not right: when I submit a blank form (expecting errors for required fields), the form disappears from the page without any notice (and without refreshing, so it's sort of working). Same if I submit the form with all the fields filled-in (I expect a Success message and no form, as without Ajax). I don't get any console errors. I've included the simplecontactform.js and initialised it per the instructions. My contact-page.php looks something like this: <?php if ($config->ajax) { $modules->get('SimpleContactForm')->render(); } else { include("./includes/head.inc"); ?> ... <div class="row row-2"> <div class="col"> <?php echo $page->body; ?> <div><!-- if I remove this div, the entire .col div disappears --> <?php echo $modules->get('SimpleContactForm')->render(); ?> </div> </div> ... <?php include("./includes/foot.inc"); } ?> Am I doing something wrong here? Any suggestions are greatly appreciated.
-
Doh! I had, but not correctly, I guess. Once I echoed '$modules->get("MarkupGoogleRecaptcha")->getScript();', it worked. Thanks for your help. Now I need how the rest of it works. Cheers, Paul
-
Hi @flydev My, that was quick! I did put this in my ready.php file, but don't see a captcha. Do I need to include your '$captcha = $modules->get("MarkupGoogleRecaptcha");' on the page? (I've tried it both ways). I've also tried this $f->markupText = 'Foobar'; (instead of your module) and 'Foobar' appears above the submit button, as expected.
-
Hi @flydev. Great module. I'm using it on a custom form. I'd like to add it to an existing site where I've used Ryan's Form Template Processor module. (It's a long form; I'd rather not start from scratch). I've had a look at what you did with the log in form above; would I take a similar approach? Is there an easy way to slot the Captcha form in before the submit button (instead of outside the generated form)? I'm pretty new to hooks, if that's what's needed. Any suggestions appreciated.