Jump to content

adrian

PW-Moderators
  • Posts

    10,902
  • Joined

  • Last visited

  • Days Won

    349

Everything posted by adrian

  1. Not sure, but it looks to me like you're logging in with a user without any editing privileges. Is that possible?
  2. If you are worried about possible overwriting with users uploading at exactly the same time, perhaps you should consider uploading each user's files to a unique subfolder within the tmp_uploads folder. If the users are logged in users, rather than guests, you could name the subfolders based on the user's ID. If not, generate a unique name - lots of ways to do this in PHP. Anyway, just some ideas for you.
  3. Well I see that you are wanting to rename it based on the POST value for qquuid. My module is not designed to rename based on user supplied values at upload time, but rather standard formats set up in the config based on the values of PW fields. You could use my module to rename the file to the value of a qquid field. The only catch is that the field would have to be saved before the file was uploaded. You have got me thinking that maybe my module would benefit from the ability to rename a file at any time if the value of a field used in the rename rule is changed.
  4. With Lazy Cron you will not be able to guarantee exactly when a task will be run - a page on the site will need to be loaded, just as you noted. You could skip lazy cron altogether and use cron directly on your server, or you could use the technique that Ryan mentions at the bottom of: http://modules.processwire.com/modules/lazy-cron/ (How to make it not-lazy) If you are running your site on a shared host, you will probably find a tool in your control panel for setting up and managing cron jobs. If you don't have a control panel, you can simply google it and you'll get lots of tutorials: https://www.google.com/search?q=limux+manage+cron+job
  5. Just wanted to point out to others that if you are using this (and the Map Markup module) along with zurb foundation (I am still testing, not convinced it's worth the bloat) and you come across an issue with the zoom controls looking not right, it is due to: img { max-width: 100%; } I just added this to my site's css to override this and it seems fine again: .gm-style img { max-width: none; } Hope that helps someone else out.
  6. Ok, gotcha. I did this on a site a while back. I'll dig up the code and get back to you in a minute. Actually I did this on the very first PW site I built, so there might be a better way, but this still works. Create a new datetime field called last_page_load and add it to the user template (remember to "Show System Templates" so you have access to it). Put this code somewhere that is included on every page of the site: if ($user->isLoggedin()) { $user->last_page_load = date('Y-m-d H:i:s'); $user->of(false); $user->save(); } Then you can do this: foreach($articles as $article){ if($user->isLoggedin() && $article->modified > $user->last_page_load){ // echo article here } } Let me know how you go with that. I don't think I have missed any components in making this work, and maybe there is a better approach, but one advantage of this over cookies is that it won't matter whether the user clears their cookies or not, or if they are visiting from different devices. EDIT: Thinking through this - in my case I had already limited $articles with a find. You may want to do the same as foreach'ing through 100's/1000's of articles won't be a good idea, so you could use something like this: $new_articles = $pages->find("template=articles,modified>{$user->last_page_load}");
  7. Thanks Willy, Try it, I did not I do think it might be nice if these options were not shown in the first place though.
  8. You should just need this: if($user->isLoggedin()){ //show new articles here }
  9. Not sure if I am missing something obvious, but I haven't used the Administer Users permission very much and just realized that if you give someone that permission, they then have the ability to add the superuser role to themselves, or to any new user they create. I would really like to limit assigning of superuser to just superusers. The current way this works seems dangerous to me. Am I missing something very obvious about how to disable this?
  10. Make sure you read the instructions for the module: "getThumb returns url to the thumbnail you have asked for" So all you would need would be: $child->overviewimgbig->eq(0)->getThumb('thumbnail') There is also a great video on the usage of the module here: http://processwire.com/videos/using-the-image-thumbnail-plugin/
  11. Things in PW generally are simple Also, in case you haven't seen it yet, you need to read through the cheatsheet: http://cheatsheet.processwire.com/
  12. Hi Xpn and welcome to Processwire. Accessing the url for the image is as easy as: $child->overviewimg->url The only caveat to that is how your overviewimg field is set up. If the Max Files Allowed setting (Details tab) is set to anything but 1, you will need to use one of the following; $child->overviewimg->first()->url $child->overviewimg->last()->url $child->overviewimg->eq(x)->url //where x is the number of the image in the array of images, starting with 0 as the first. Also, have a read of: http://processwire.com/api/fieldtypes/images/
  13. Thanks for that info. I have a late 2011 model so hopefully ok, but I did see some people in that thread with 2012 models also reporting issues. Not exactly encouraging. Anyone else have any Mavericks experience to share?
  14. Interesting to hear given that I am probably just about to upgrade from Lion to Mavericks. I avoided Mountain Lion, but now there is starting to be too many things that won't work on Lion that I am being forced into it. I can't say I am thrilled about the dumbing down on my desktop that seems imminent, but maybe I am making too much out of what I have read on the subject. Do you know if this was a common error for these machines when upgrading to Mavericks, or just an unlucky situation?
  15. This is one of those cases where an SQL query would be easier. WHERE DAYOFWEEK(date) = '6' But it probably isn't worth it to do an SQL query for such a simple situation, so you might be best just removing the non-Saturday dates from the results. $results = $pages->find("date>=2014-01-01, date<=2014-12-31"); foreach ($results as $result) { if (date('l', $result->date) != 'Saturday'){ $results->remove($result); } }
  16. Why not just have them enter the period and the rate type and the rate in the repeater. If you used page fields to store the period and rate types, they could add new ones as needed using the "Allow new pages to be created from field?" so they wouldn't have to retype them each time. Do you think that would work at all?
  17. Ryan, If Peter went with that approach, what would you recommend he implement in his search.php script to make it possible to find those fictional rider pages? Maybe something like this: $matches = $pages->find("title|body|sidebar~=$q, limit=50"); $rider_matches = $users->find("name~=$q, limit=50"); $matches->append($rider_matches); foreach($matches as $m) { if($m->template == 'riders'){ $out .= "<li><p><a href='/riders/$m->name/'>{$m->name}</a></p></li>"; } else{ $out .= "<li><p><a href='{$m->url}'>{$m->title}</a><br />{$m->summary}</p></li>"; } }
  18. Please let me know how you go with that module. There are some very recent changes in there that added support for API uploading on the front-end. Prior to that, it was only for admin uploads, so I'd like to hear about your experience with it and any changes you would like to see.
  19. Hey Pete, the problem happens sometimes and not others. I'll reload the page and it works ok, and then reload again and it won't work at all, no matter what speed nor how fast I drag. Not sure if it is related to image not loading in time or what, but definitely not functional when it's mis-behaving. I am sure Joshua will get it sorted out though
  20. From what I understand, you want to be able to rename an image during the upload process. A couple of options: Install Custom Upload Names and define rules for what files should be named what Hook into Pagefile::install and work with this code from Ryan Let us know if you need any specific help.
  21. Hey joshua - it is very stylish indeed. One issue I am having is dragging the sliders sideways is temperamental for me. Most of the time they just bounce back to the start. I am on Chrome / OSX. Anyone else having this issue?
  22. Just wanted to share a little story of my old Dell laptop. It was 9 years old and still running quite adequately, with only one RAM upgrade in its lifetime. I was spending a working holiday in Mexico for a month when the graphics card decided to pack it in one week into the trip. All I got on the screen was some random fuzzy lines. Not looking very promising A quick google, a screwdriver, some aluminum foil, a kitchen oven, and 15 minutes later she was good as new and is still working 2 years later! No chance of fixing something like that on a Macbook these days. FYI, I am on a Mac now and I have finally wrangled it into submission and am generally happy. Two things I shelled out for were an SSD and a matte screen - I know glossy are all the rage, but the reflection off the glass drives me nuts! Am I the only one?
  23. Select setup taking too long: http://mods.pw/5R | Rename ugly uploaded filenames: http://mods.pw/5m | On demand SVG rasterizing: http://mods.pw/62

  24. Hey reno, You can set your defaults like this. Just put it before your init(): protected static $configDefaults = array( "defaultSelector" => "default value here" ); /** * Data as used by the get/set functions * */ protected $data = array(); Add this line to your inputfield: $field->attr('value', $data["defaultSelector"]); And add the following at the top of your static public function getModuleConfigInputfields(array $data) {: foreach(self::$configDefaults as $key => $value) { if(!isset($data[$key]) || $data[$key]=='') $data[$key] = $value; } You can then access this throughout your module using: $this->defaultSelector; At least that is how I have been doing it - maybe someone else has something cleaner Does that make sense? PS, Sorry for all the consecutive edits. I really shouldn't try to offer device when I am busy with other things and rushing EDIT Again - I just read that tutorial you pointed to and I see if uses: public function __construct() to set the default values. I haven't used that before. I guess I started by copying from other modules and never came across that approach. I guess there are a few different options, but construct does seem cleaner.
  25. Firstly wanted to say amazing job Ryan - PW just keeps getting more capable and powerful and it's a real pleasure being part of this community. I have never experienced anything else like it - so incredibly friendly and supportive. A far cry from so many others. Obviously a result of the tone and standards you set here. Just a quick request - I am sure it is on your list, but it would be helpful to have 2.4 checkbox option in the modules directory sooner than later. Thanks again for everything!
×
×
  • Create New...