Jump to content

formmailer

Members
  • Content Count

    319
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by formmailer

  1. Hi, I noticed that started to get some spam comments on my site from IPv6 adresses, but unfortunately I cannot easily see from which addresses since IPv6 addresses get logged as 0.0.0.0. I found there is an (rather old) issue regarding this on Github: https://github.com/ryancramerdesign/ProcessWire/issues/1596 Is a fix regarding this on the roadmap? I would prefer not to use $_SERVER['REMOTE_ADDR'] or something similar. Thanks in advance! //Jasper
  2. Hi @Arcturus and @Jozsef, Did you find a solution for this issue? I am running 3.0.84 and am having the same problem. //Jasper
  3. And another small issue, after submitting a comment, the "waiting for approval message" shows, but even the form. Shouldn't the form be hidden when the GET variable "comment_success" is present? //Jasper
  4. Hi! I tried to enable mail notification for users (guests), enabled "Allow commenter e-mail notifications": The option shows up on the page: But no e-mails are being sent. Is there something else I need to do? Other mail notifications, like the admin notification for comments, are working just fine, so it's not a general e-mail issue. Any help is appreciated. //Jasper
  5. I managed to build the whole site without using Jquery, for speed optimization, so unfortunately the Jquery option is no alternative. I will go for the copy solution. Thank you for your help!
  6. Hi! Yes, I thought about doing that, but I was hoping there was a shortcut to this. A risk (even if it's a minimal one) is that future core updates could break the module. I was hoping there would be a way to change classes without modifying the module. But if this isn't possible I'll go with the copied & modified module. //Jasper
  7. Hi, I am trying to style the comments form (and comments list) to match the rest of the site. I know that it's possible to edit the CSS file for the comments module, but I would rather add my existing classes to the fields, instead of making another css file containing the same CSS styling. I use the following to render the form: $page->comments->renderForm(); Is there an easy way to add the CSS classed to the fields? //Jasper
  8. For some reason the count() always return one image less than the actual number of pictures. If the page has 3 images with the correct tag, the count is 2. Strange but it seems to be that way....
  9. Thanks again! For some reason this is not working. But this is: $page->randomIndex; if (--$page->randomIndex >= -1) { I am not sure why this is working but it is.
  10. One more (final) question. Is there an easy way to make this work for pages with only one image? That would allow me to use the same hanna tag on every page, not only on the ones that have more than one image. //Jasper
  11. Thank you guys so much, this solved my problem! Good trick about the "seed attribute", @Robin S. //Jasper
  12. Thanks again. Unfortunately my plan is not going to work, because the Hanna Code generates the same result if the Hanna tag is added multiple times. I validated this by making a Hanna code snippet with the following: echo(mt_rand(10,100)); I added the Hanna tag 3 times and the result was 3 times the same integer. //Jasper
  13. Thanks Abdus! Using: $a = $page->images->findTag('inline-body')->getRandom(2); Would be even easier. Problem is that the template doesn't specify location of the images defined. These are inserted in the body text field using Hanna Code. That makes the above a bit harder to apply. My own idea was to create a code snippet in Hanna that could be re-used as many times as needed. If I can check if the array $a exists and only create a new one if it doesn't, it should be possible to do so. I know that it is not the fastest code, but since all the pages are being cached by ProCache I am not worried about this process taking an extra second or two. /Jasper
  14. Hi! I use the following to display a random image on a page: $image = $page->images->findTag('inline-body')->getRandom(); This works of course really fine, but on some pages I want to use 2 or more random images. The images have to be on different places and the same image shouldn't be displayed twice. I assume that I have to something like: $a = $page->images->findTag('inline-body'); $image = $a->getRandom(); echo "<img src='$image->url'>"; $a->remove($image); and with later in the template, for the next image, I'll just do: $image = $a->getRandom(); echo "<img src='$image->url'>"; $a->remove($image); Would this make sense? Or is there a better way? //Jasper
  15. I just solved it using Bernhard's tips, so I didn't try this one. But looking at it quickly, I don't think it would solve the whole problem, since the pages parents are still hidden. But thank you for your reply, It's very much appreciated. /Jasper
  16. Hi! I have a side menu, based on the renderNavTree function that comes with the default site template in PW: /** * Given a group of pages, render a <ul> navigation tree * * This is here to demonstrate an example of a more intermediate level * shared function and usage is completely optional. This is very similar to * the renderNav() function above except that it can output more than one * level of navigation (recursively) and can include other fields in the output. * * @param array|PageArray $items * @param int $maxDepth How many levels of navigation below current should it go? * @param string $fieldNames Any extra field names to display (separate multiple fields with a space) * @param string $class CSS class name for containing <ul> * @return string * */ function renderNavTree($items, $maxDepth = 0) { // if we were given a single Page rather than a group of them, we'll pretend they // gave us a group of them (a group/array of 1) if($items instanceof Page) $items = array($items); // $out is where we store the markup we are creating in this function $out = ''; // cycle through all the items foreach($items as $item) { // if there are extra field names specified, render markup for each one in a <div> // having a class name the same as the field name /* if($fieldNames) foreach(explode(' ', $fieldNames) as $fieldName) { $value = $item->get($fieldName); if($value) $out .= " <div class='$fieldName'>$value</div>"; } */ // if the item has children and we're allowed to output tree navigation (maxDepth) // then call this same function again for the item's children if($item->hasChildren() && $maxDepth) { $out .= '<div class="w3-block w3-padding w3-white w3-left-align accordion">'; $out .= $item->title; $out .= ' <i class="fa fa-caret-down"></i></div>'; $out .= '<div class="w3-bar-block w3-hide w3-padding-large w3-medium">'; $out .= renderNavTree($item->children, $maxDepth-1); $out .= '</div>'; } else { // markup for the link $out .= "<a href='$item->url' class='w3-bar-item w3-button w3-opacity-min'>$item->title</a>"; } } // if output was generated above, wrap it in a <ul> // if($out) $out = "<ul class='$class'>$out</ul>\n"; // return the markup we generated above return $out; } The only problem is that all submenus are hidden by default (the w3-hide class). Now I am looking for a way to find if the current page is somewhere in the tree, this part of the tree should be visible: Eg. If I am on the page called "Complete rondreis “Arvid” met Buro Scanbrit", the menu shoul look like this: And when I am on the Page called "Buro Scanbrit", the menu should be like this: How do I achieve this? I guess I need to check if $item is (grand)parent of the current page, but I can't really figure out how to do this. Any smart suggestions? Thanks in advance! //Jasper
  17. I upgraded to the latest dev and the problem is gone, so you were absolutely right @adrian. Thanks! A side note: I still might go for a clean install to get rid of some old, now obsolete, modules and scrappy coding from my side. A new start makes it also easier to use new PW features.
  18. The version is correct. I don't think that Repeater fields are an issue since I have never used them. Since I am redoing an existing site that has been running PW since 1.x and has been upgraded every time, it might be a good idea to start from scratch and manually transfer content (will be a QA-job for the content as well). The DB itself seems to be fine, but contains quite some history and fields that aren't used anymore. //Jasper
  19. Hi! I am getting the following error when trying to create a link in the editor (html textfield). Error: Uncaught Error: Call to a member function className() on null in /home/site_com/public_dev/wire/modules/Process/ProcessPageEditLink/ProcessPageEditLink.module:374 Stack trace: #0 /home/site_com/public_dev/wire/modules/Process/ProcessPageEditLink/ProcessPageEditLink.module(350): ProcessWire\ProcessPageEditLink->getFilesPage(Object(ProcessWire\Page)) #1 /home/site_com/public_dev/wire/modules/Process/ProcessPageEditLink/ProcessPageEditLink.module(393): ProcessWire\ProcessPageEditLink->getFiles() #2 /home/site_com/public_dev/wire/modules/Process/ProcessPageEditLink/ProcessPageEditLink.module(215): ProcessWire\ProcessPageEditLink->getFilesField() #3 /home/site_com/public_dev/wire/core/Wire.php(380): ProcessWire\ProcessPageEditLink->___execute() #4 /home/site_com/public_dev/wire/core/WireHooks.php(698): ProcessWire\Wire->_callMethod('___execute', Array) #5 /home/site_com/public_dev/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\ProcessPageEditLink), 'e (line 374 of /home/site_com/public_dev/wire/modules/Process/ProcessPageEditLink/ProcessPageEditLink.module) Any ideas what could be causing this? //Jasper
  20. Sure, I did that. I did that as soon as I discovered that Cloudflares Rocket Script was causing the issue. Even before you posted the link. What I meant was that the info in your post could be included in the Readme file, as a known issue. So that other users don't need to spend a couple of hours in order to find the cause to this problem. /Jasper
  21. I agree with you that caching for backend isn't the best idea. I just didn't think of it, when the issue occurred, and I am quite sure that others might run into it sooner or later. Mentioning this as a known issue would be fine. Maybe in the readme file under Installation/Upgrade. @ryan, would this be possible? //Jasper
  22. I checked the files on my backup and the version I was running was 2.6.1. So assume that Cloudflare breaks somthing that changed between 2.6.1 and 2.6.13 dev. And it's something that's still there. I am not sure if it's worth looking into it more and if it's something that can be fixed in Processwire or that this is something that Cloudflare has to fix on their end. Do you think I should report this as an issue on Github? /Jasper
  23. Okay, unfortunately I don't remember what version 2.6.x version I was running. Probably not the dev release. //Jasper
×
×
  • Create New...