Jump to content

adrian

PW-Moderators
  • Posts

    11,097
  • Joined

  • Last visited

  • Days Won

    365

Everything posted by adrian

  1. You'll probably want: if($user->hasRole("viewer")) Note the quotes around the name "viewer", rather than $viewer But otherwise, that should do what you want!
  2. Whatever! Very far from it - sometimes we all just need a second set of eyes
  3. Can you send through the entire code for your form - I'd be happy to test and figure this out for you - would be good to know if it's new PW bug.
  4. I am a big fan of Forklift for remote editing (although I am sure many others work well). The great thing about Forklift is that it is a full dual pane Finder replacement. I honestly couldn't survive without it. Finder really is horrible http://www.binarynights.com/forklift/
  5. I found the problem You are overwriting $field so the value of $field->columnLabelFieldName is blank. This line is the culprit: https://github.com/kongondo/FieldtypeMatrix/blob/master/FieldtypeMatrix.module#L168 foreach(wire('fields') as $field) { If you log $field->columnLabelFieldName before that, it returns the selected value as expected. Hope that helps!
  6. While Matrix may not be as flexible as Profields Table, one cool thing (although there are lots of cool things about it), is that your site editors can add new columns to the table - you can't do that with Table fields
  7. Hi Lauren, In PW a user needs page-edit permission to view the page tree in the admin. Of course you can disable their ability to edit anything using the Access tab on all templates. I think this will achieve what you are looking for.
  8. Not really sure what security issues you are thinking might exist. Using page fields and the 'has' method is a standard PW technique and there are no SQL injection possibilities with it. If you are concerned about someone being able to view the page that shouldn't, then I don't think you need to worry there either. There is no possible way to view the page unless the user has the page selected in their allowed_pages field. Does that answer your question?
  9. Thanks Charles - glad to hear it is working well for you. I have another brand new version for you with a LOT of new features. You can prevent creation of pages from email addresses with host names that are not in the whitelist - great antispam option You can limit creation of pages to email addresses that match registered PW users - in this case, the ability to add the page will also be determined by the user's permissions for creating pages on the selected template You can determine whether the page should be published based on the user's page-publish/edit permissions You can set up customized email notification messages when a new pages is created, including choosing who they should be sent to. The config settings should also help to see all the new changes. Please let me know if you find any problems with this new version - quite a bit changed. Also please let me know if you think of improvements to the logic of the way things are set up.
  10. Thanks - I have been doing lots of testing with your file and can't replicate the "missing required zip or json" error. I did however find some bugs regarding image import in certain situations that I have just fixed, so please grab the latest versions of both Migrator and MigratorWordpress. I will send some screenshots showing the properly imported content in reply to the PM you sent. In an attempt to figure out why you are getting that error, can you please try logging the value of: $this->session->jsonFilename and also uncomment the exit on line 882. Then make sure that there is some json content in the file at the path that should be stored in: $this->session->jsonFilename
  11. You can do a check to see if the product_type is the same as it was during the last loop. Something like this: $last_product_type = ''; $sid=$pages->find("template=product, sort=product_type"); foreach($sid as $product){ if($product->product_type != $last_product_type) echo $product->product_type ."<br>"; echo $product->product_name ."<br>"; echo $product->product_image->url ."<br>"; echo $product->desc ."<br>"; $last_product_type = $product->product_type; }
  12. I think it should be just as simple as this: $sid=$pages->find("template=product, sort=product_type");
  13. I have just committed another update that has a separate field for attachments that are not images. An email can now contain both and they will be treated separately with images being embedded in the body text when appropriate, but keeping other file types only a "attachments" and stored in the selected files field.
  14. I am not sure why you are getting that missing required zip or json error, but it would be helpful if you could PM me the xml file so I can test. I don't really understand what is wrong in the second image you posted. To attach images here, you need to click the "More Reply Options" button.
  15. Oops - sorry about that - fixed that and added a couple of checks around the user detection. I am thinking the next important addition is treating attached images differently to attached files.
  16. That makes sense - thanks for clarifying the reason for the email address actually being populated. I have just pushed another update that now has three separate options: name, email, user The first two are obvious. The third one (user) needs to be pointed to a page field that has "user" as the template of selectable pages. Also, you might want to set Label Field to "name" rather than the default "title". When the page is created, this field will grab the user from the list of PW users based on the email address, which means you then have full access to all other fields in the user template. It also sets the created and modified users on the Settings tab to this user. This should make it pretty powerful for emailing in blog posts and the like. I probably need to add some checks to deal with the email address not matching a PW user, but I'll wait for the next update for that. Let me know how it works for you. This is what the result looks like on the new page:
  17. Interesting - maybe the account you are sending from doesn't have a name in the from address field, eg: "John Smith" <john@example.com> I think it would be great to be able to match up the sender with a PW user account, most likely via their email address. This is easy to do, I just don't know what most people would want and don't want to end up with too many config options. I am also not sure just how many people are actually using this module, especially given how effective the PW admin is on mobile devices. Anyone else out there have any thoughts on this - are others using this module? Should it simply populate a text field with the sender's name/email address, or try to match up to a PW user account? I might need to do some testing of the returned data to see what is actually being returned and match if possible.
  18. I think you are way too kind, but I am very glad I could help out a little. Please let me know if you do need access to the from email address, rather than the name and I'll sort that out.
  19. Hi again - I have just committed an update to my fork that supports capturing the received date and the from address (actually I parsed out the name associated with the email address). Is that what you are looking for, or do you actually want the email address? If so, I might need to add an option to choose what is required. Anyway, let me know if things work for you.
  20. That line is checking to see what iteration of the loop you are in. $i is set to 1 before the start of the foreach loop. At the end of each loop, 1 is added to the current value of $i with the $i++; line. So by getting the number of children of the page and setting $colcount to that value and then checking whether $i is equal to the number of required columns you are checking whether to add the "end" class or not. Hope that makes sense.
  21. This will do what you are looking for. You need to get the page array for the page you are adding: $pageitem and also use "add" to add it to the array of pages held by the page field. $p = $pages->get(1234); $pageitem = $pages->get(4321); $p->of(false); $p->foo->add($pageitem); $p->save(); Hope that makes sense.
  22. adrian

    Merry Christmas!

    Feliz Navidad mi amigos from sunny Mexico
  23. Not sure what your final goal is, but you mention wanting to import the xml data as well. Maybe you should take a look at Migrator: https://github.com/adrianbj/ProcessMigrator
  24. Great writeup! Now that you have learned the full way to create the templates and pages for populating a page field you are qualified to do it the easy way http://modules.processwire.com/modules/process-page-field-select-creator/
  25. Not to be pedantic, but you can actually do this. It can be a bit of a shortcut way of assigning things to variables. That said, I generally think it looks confusing and ugly, but can occasionally be useful, but not in this case since you aren't using $quotes anywhere else $quote_w_heading = "Quote goes here: " . $quotes = "The quote"; echo $quote_w_heading; You would end up with: Quote goes here: The quote and $quotes would equal: The quote
×
×
  • Create New...