Jump to content

formmailer

Members
  • Posts

    319
  • Joined

  • Last visited

  • Days Won

    1

Posts 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

    • Like 2
  2. On 2017-06-19 at 1:35 AM, Jozsef said:

    The same issue. Running PW 3.0.61 and Map Marker 2.0.6 worked just fine. After upgrading to 2.0.9 and entering my API key I get the above error to any address I try.

     

    On 2017-06-01 at 11:45 PM, Arcturus said:

    I'm having an issue in PW 3.0.62 where the module will only geocode an address when I manually click the checkmark between address and lat/lng off/on when editing the page within the admin. Based on what I've read here, it seems only the client-side geocoder is working?

    Additional details:

    • I have both Google Maps and Google Places APIs working without issue on the front-end and have added my Maps key to the module's configuration
    • My MapMarker-based field, "map", has a MapMarker: Error geocoding address notification and I can't find any elaboration
    • Neither API has any issues with my address formatting/default address, with an example being 5 Bloor Street, Toronto, ON M4W 3T3
    • My addresses are mapping properly when I play with the checkbox (status goes from UNKNOWN to OK)
    • I can't trigger the geocoding via the API

    Any ideas?

     

     

    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. Hi!

     

    I tried to enable mail notification for users (guests), enabled "Allow commenter e-mail notifications":

    image.thumb.png.cb62ae107a9b8b61f782388508c088cf.png

    The option shows up on the page:

    image.png.aa32f2e187e13d962bb07159f04777fc.png

    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

     

     

  4. 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

  5. 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

  6. 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

  7. 1 hour ago, abdus said:

    Try

    
    // get two random images
    $a = $page->images->findTag('inline-body')->shuffle()->slice(0, 2);

    https://processwire.com/api/ref/wire-array/

    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

    • Like 1
  8. 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

  9. 1 hour ago, maxf5 said:
    
    		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>';
    			if ( $item->id == wire('page')->id ) {
    				$out .= '<div class="w3-bar-block w3-padding-large w3-medium">';
    			} else {
    				$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>";
    		}

     

    Quick & Dirty. Can you try this one?

    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

  10. 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:

     

    image.png.68853d9cedc7f6d374623ae1e0c992a4.png

    And when I am on the Page called "Buro Scanbrit", the menu should be like this:

    image.png.2f71f3eeec90bf9de74552b98b2db739.png

    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 

  11. 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

  12. 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

  13. 11 minutes ago, DaveP said:

    ... or you could try the Cloudflare rule I mentioned in my blog post to exclude the PW backend. :rolleyes:

    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

    • Like 1
  14.  

    6 minutes ago, LostKobrakai said:

    I'm not sure it's worth looking into. Caching for backends is imho not the best idea to start with, so at best Ryan could mention it somewhere as "known issue".

    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

     

  15. 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

×
×
  • Create New...