Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

28 Excellent

About modifiedcontent

  • Rank
    Sr. Member

Recent Profile Visitors

1,601 profile views
  1. Is there a way to allow the front-end editing feature for a role, without also giving that role access to the admin area/control panel?
  2. Why doesn't this work? $members = $pages->find("template=user"); foreach($members as $bogus) { // don't use $user if ( $bogus->firstname === $bogus->lastname ) { $bogus->delete(); } } I get this error: If I echo $bogus->fullname, I get a nice list of spam accounts where the first and last name are the same. There has to be a way to let PW allow me to delete them. I have also tried $users->delete( $bogus ) and $users->delete( $bogus, true ) and a few other variations, but keep getting the same error message. Line 1017 is this: if(!$this->isDeleteable($page)) throw new WireException What makes a page not deletable? Any ideas? I have a similar bit that deletes user accounts with numbers in the name fields: $members = $pages->find("template=user"); foreach($members as $bogus) { if ( preg_match('/[><\-0-9]/', $bogus->name ) ) { $users->delete( $bogus ); } } That one works fine. What am I getting wrong with the other one? Edit: I think I figured it out. $firstname === $lastname would also be TRUE for two empty fields, so I guess PW has wisely made that not deleteable somewhere. So you have to check first if either field is set at all. The following seems to work: $members = $pages->find("template=user"); foreach($members as $bogus) { // don't use $user if ( $bogus->firstname && $bogus->firstname === $bogus->lastname ) { $users->delete( $bogus ); } } Or still wrong?
  3. To me the beauty of Processwire is that it makes no assumptions how you use it. This module breaks with that logic a bit, probably unnecessarily. I have started editing the css. That is no big deal. I'll look into how to use this field as input for the map marker modules, make them work together. btw, I hope your health problems are under control. Either way, take care.
  4. I need some kind of address field type to store street addresses for events - the map marker modules produce unusable garbage addresses... This module looks solid and probably does what I need for my case. Why does the module assume it will be used for postal mailings? Is that really necessary? Couldn't the UX be a bit more usage agnostic and use the regular admin fonts etc.?
  5. The 'address' field is supposed to output the address you entered. echo $page->map->address; // outputs the address you entered But it actually outputs whatever the map thinks is at that lat-long, with a lot of unnecessary details added, something like this: The address search also insists Water Street is in lower Manhattan when I mean Water Street in Brooklyn. Brooklyn becomes Kings County in map->address; nobody calls it that! You can force the map to select the right location by dragging the pointer. Now the address is: Which is hilarious and completely useless. Is there a way to keep/store the actual "address you entered"? Or else a way to format that map->address into something usable?
  6. This module is great, essential. Unfortunately I can't yet get it to work on my front end. The map doesn't show up due to a javascript/jquery conflict. The module outputs regular jquery script starting with $(function() { ... If I manually add the following alternative to the footer it works fine, the map shows up in all its CartoDB glory: How can I get the module to do the same? Or get around this problem some other way? Edit: I have replaced the following line in MarkupLeafletMap.module: $inlineScript = "<script type='text/javascript'>\n$(function() {\n" . with this: $inlineScript = "<script type='text/javascript'>\nvar jMap = jQuery.noConflict();\njMap(function() {\n" . Now the module works as expected. Could you make that part of the module for next updates? With jLeaflet instead of the more generic jMap. Or is there a good reason not to do it like this or a more cleverer way to avoid jquery conflicts?
  7. Thank you so much adrian. I had been using your Admin Actions module for other things. Super useful. I should have thought of trying that sooner. I have first applied 'Copy Content to Other Field', then used 'Delete Unused Fields'. Both no problems. More clean-up work to do before I can declare victory. I would be pleasantly surprised if the data really is still there, but at least the old fieldtype is gone. Will report back...
  8. I was trying to uninstall the FieldtypeMapMarker module, that is connected with the problematic Google Maps API that has raised their prices and produces errors. I want to replace it with Leaflet Map Marker. I uninstalled parts in the wrong order, hoping I could keep my address data. The module's uninstall is disabled, because the 'module is a Fieldtype currently in use by one or more fields'. But admin for the field in question now produces this error: Fatal Error: Uncaught Error: Call to a member function set() on null in /home/.../site/modules/FieldtypeMapMarker/FieldtypeMapMarker.module:54 Stack trace: Reuploading/reinstalling the FieldtypeMapMarker module didn't fix access to the fieldtype admin. I have tried uninstalling via the API, but don't understand how that works. I have tried putting this in a template file: $modules->uninstall("FieldtypeMapMarker"); That didn't do anything. I guess I have to put this in a function or "hook" it somewhere? I have no clue. Or would this method still perform the same check if I am allowed to uninstall? How can I nuke FieldtypeMapMarker without doing more damage? Is deleting rows in mysql really the best option? Is there a somewhat clean way to force uninstall and/or replace FieldtypeMapMarker with the Leaflet alternative?
  9. I have "solved" the issue by using window.location.origin as the ajax url. My ajax call now looks something like this: Leaving url out - using "self" as url - produces the error described above for urls based on titles starting with quotes. I wasn't able to figure out what/where/how to escape something to prevent that error. Bypassing problematic urls by using window.location.origin solves the problem. Or is there a better solution?
  10. I have this same error after updating to the latest version of PW: I haven't explored further yet, working on other things, will get to this eventually. Any news what causes this?
  11. I have Ajax search that works fine in most of my site, except on pages with single quotes/apostrophes in the title. I get this error in the log: Exception: Unknown Selector operator: '=&' -- was your selector value properly escaped? The error log gives this clue: ... wire/core/Selectors.php(460): ProcessWire\Selectors->create('title', '=&', '#039;IoT is gro...') #1 ... &#039 is a single quote. " 'IoT is gro...' " is the start of the title of the page this search is on; the URL of that page includes ".../iot-is-gro ..." But that title is not the search term. I have double-checked if I have escaped the search terms correctly and if I have used correct single and double quotes in my Ajax and search code. Again, search works fine in most of the site. How does that title end up as a "selector value" anywhere? How does the title of the page that this search is on interfere with the selector operator? I can't figure it out. Could this be a bug? I have tried/explored just about everything else.
  12. This is a self-contained basic example of how to use $config->ajax: Anyone can put this little demo in a template file and it works. Hopefully it helps other people who don't know Javascript or/and PHP well to understand how to work with Ajax in PW. Something like this is all I needed. Getting the variable(s) ($_GET) and doing something with it - in this basic example just echo it - can also be done in a separate php file in your templates folder that you can include after if($config->ajax)
  13. Yes, of course. I don't know Javascript. I have one bit of Ajax working in my PW site, but now want to step back and try to better understand how this stuff actually works. All examples help. Thanks kongondo. Edit: Btw, I have the same problem with kongondo's latest example as with every other example of this; it only gives one part and assumes that the rest is obvious. kongondo's example is mostly generic PW PHP that has nothing to do with Ajax. The example says an 'author' var was sent by the Ajax call, but doesn't explain how - which is precisely what I am trying to wrap my head around. I am looking for an example that shows me how it all works together. Here is a self-contained basic demo:
  14. Thanks @bernhard, but this example assumes you use the default profile. I don't, so there is way too much unnecessary distracting stuff going on. I think this example only shows how you can fetch one line of text via an ajax call. Typically you'd want to send the call with parameters/variables (?) to a php script that does something with the vars and then returns something. I am looking for basic examples of that entire process. I'll keep working on my example(s) above.
  • Create New...