Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/03/2017 in all areas

  1. $latest = $users->find('roles=anzeigen-anbieter, sort=-customer_number, limit=1'); $newnumber = $latest->customer_number + 1; $user = new User(); $user->of(false); $user->name = "Paul"; $user->pass = "max123"; $user->email = $email; $user->customer_number = $newnumber; $user->addRole("anzeigen-anbieter"); $user->save();
    3 points
  2. I just tried this and it works as expected: $highestID = $pages->get("template=user, sort=-id, limit=1, roles=intern")->id; echo $highestID; in your case, you'd have to replace id with customer_number, and use your specific role anzeigen-anbieter.
    3 points
  3. Huh! This is interesting! I need to explain a bit about the naming conventions of image filenames in PW, I think. /site/assets/files/{page-id}/basename.jpg /site/assets/files/{page-id}/basename.0x260.jpg /site/assets/files/{page-id}/basename.-tag1-tag2.jpg /site/assets/files/{page-id}/basename.-tag1-tag2.200x300.jpg /site/assets/files/{page-id}/basename.800x800.-tag5-tag3.jpg /site/assets/files/{page-id}/basename.800x800.-tag5-tag3.200x300.jpg Beginning after the basename, with the first dot, every dot indicates an imagevariation that also exists as a file. (only the last dot leads to the file-extension) Every previous part in the chain is the [source | parent | original] of the actual part. The tags chain, implemented into PW around 2.5 and made to become very robust and foolproofed by Ryan around 2.6, was meant to be used as lowercase tags, concatenated by - chars. This very restrictive usage is due the valid filename characters (lowercase), and the preserverd dot, and to prevent concatenating multiple same tagnames. (this is cleaned up to become unique in the filenames). But this is not very userfriendly in cases like the CropNames, and the users are not aware of this restrictions why it is / would be important to follow them. Thats why I have to handle the cropnames less restrictive. Thats also the reason why the implemented tag system in PWs imagenames cannot be used like intended. All the cool methods to get the variations of a parentimage (getVariations(), isVariation()) will fail in many cases when using images with an (invalid) tagname / cropname! That's why I was happy to find another bulletproof solution for getting rid of the srcset variations. (Detecting the children of a crop-parent) @PWaddict The way you uses it isn't an intended one. You create different INTERMEDIATE crops. The intended way is to create 1 INTERMEDIATE crop image, that serves as parent for the derived variations. But this intermediate functionality also is obsolete and will become deprecated in the next version, as it isn't much useful but leads to code bloat and confusion. Also it sin't possible to detect derivatives of that sort. Imagine a setup with 3 cropnames: test & test-portrait & test-landscape. As we have already read above, people do this a lot, using invalid cropnames / tagnames, with - chars or Camelcase, etc. Now go select and create a new crop of the "test" cropname. It will errorinously also delete all variations of test-portrait and test-landscape. Also image variations that may have the cropname on another place in the filename will get deleted too. The only way to detect variations is to keep the parent-children relation. (Blood is thicker then water, ) Maybe you can use it this way: $thumb_master = $photo->photos_main_photo->getCrop("thumbnail"); $thumb_medium = $thumb_master->width(660); $thumb_small = $thumb_master->width(480); $thumb_x_small = $thumb_master->width(360); This is the intended way that brings you back into sync with the system.
    3 points
  4. Recently when I added a similar feature I grabbed the div containing the Next link too from the next page, so I got always the updated link (I used no plugins).
    3 points
  5. Here it is in a hook. Use it with $pages->get(1234)->setPublished($timestamp), where you can get timestamp using strtotime or edit hook to build a date formatted as Y-m-d h:i:s wire()->addHookMethod('Page::setPublished', function (HookEvent $e) { $page = $e->object; $timestamp = $e->arguments(0); if (!$page->id) return false; if (!$timestamp) return false; $date = date('Y-m-d h:i:s', $timestamp); $query = $e->database->prepare("UPDATE pages SET published=:pub_date WHERE id=:page_id"); $e->return = $query->execute([ ':pub_date' => $date, ':page_id' => $page->id ]); });
    2 points
  6. Hello, members! To be honest with I can't envisage many scenarios where I wouldn't use PW. And while I’m on the topic, I need to consider another terrific system people here should look at ProcessWire. It’s a “CMF,” which suggests it has the flexibility of a framework, with some of the core elements built in. Thanx
    2 points
  7. I quite played with their API (i am talking about Twitter here), its absolutely not possible to retrieve private information with the OAuth2 protocol (still waiting a confirmation on the twittercommunity) but no big hope here. We are forced to use the OAuth 1.a protocol for those sensible datas. So, there I come with two propositions. I can make an exception and integrate Twitter and OAuth-1.a in this module or I publish a standalone module for Twitter login. What do you think, a suggestion ?
    2 points
  8. FieldtypeColor is on github Fieldtype stores a 32bit integer value reflecting a RGBA value. Input 5 types of Inputfields provided Html5 Inputfield of type='color' (if supported by browser) Inputfield type='text' expecting a 24bit hexcode string (RGB). Input format: '#4496dd'. The background color of the input field shows selected color Inputfield of type='text' expecting 32bit hexcode strings (RGB + alpha channel) Input format: '#fa4496dd' Inputfield with Spectrum Color Picker (Options modifiable) Inputfield type='text' with custom JavaScript and/or CSS (since version 1.0.3) Output Define output format under 'Details' tab in field settings. Select from the following 9 options string 6-digit hex color. Example: '#4496dd' string 8-digit hex color (limited browser support). Example: '#fa4496dd' string CSS color value RGB. Example: 'rgb(68, 100, 221)' string CSS color value RGB. Example: 'rgba(68, 100, 221, 0.98)' string CSS color value RGB. Example: 'hsl(227, 69.2%, 56.7%)' string CSS color value RGB. Example: 'hsla(227, 69.2%, 56.7%, 0.98)' string 32bit raw hex value. Example: 'fa4496dd'(unformatted output value) int 32bit. Example: '4198799069' (storage value) array() array( [0] => 0-255, // opacity [1],['r'] => 0-255, [2],['g'] => 0-255, [3],['b'] => 0-255, ['rx'] => 00-ff, ['gx'] => 00-ff, ['bx'] => 00-ff, ['ox'] => 00-ff, // opacity ['o'] => 0-1 // opacity ) The Fieldtype includes Spectrum Color Picker by Brian Grinstead SCREENSHOTS Input type=text with changing background and font color (for better contrast) Input type=color (in Firefox) Javascript based input (Spectrum Color Picker) Settings Output Settings Input
    1 point
  9. You shall not objectify people, but you could objectify Textfields!!! Github: https://github.com/owzim/pw-fieldtype-yaml Module page: http://modules.processwire.com/modules/fieldtype-yaml/ Summary Field that stores YAML data and formats it as an object, when requested. Setup After installation create a new field, let's say called "people" and assign it to a template, or just edit an existing text-based field and choose Yaml for the type, save! In the Details-Tab you have an additional option, the Texformatter option is removed, because it does not make sense in this case. Parse as Default is WireArray/WireData, the data can also be parsed as Object or Associative Array. Associative Array is the fastest and the default output by the used Spyc parser, WireArray/WireData might be the slowest, but it's also the most feature rich. You can access properties like you are used to with pages or fields, like $page->person->get('title|name') or $page->people->find('age>30'). Usage Now, in your just created field you can put in some YAML like this: - name: Jane Doe occupation: Product Manager age: 33 hobbies: - running - movies - name: John Doe occupation: Service Worker age: 28 hobbies: - cycling - fishing In your template, or wherever you are accessing the page, you would use it like any other ProcesssWire data (if you set the parse option to either WireData or Object): $out = ''; foreach ($page->people as $person) { $out .= "Name: {$person->name} <br>"; $out .= "Occupation: {$person->occupation} <br>"; $out .= "Age: {$person->age} <br>"; $out .= "Hobbies: <br>"; foreach ($person->hobbies as $hobby) { $out .= "- {$hobby} <br>"; } $out .= "--- <br>"; } echo $out; More info about YAML: Complete idiot's introduction to YAML Specification Wikipedia Acknowledgements I've used a namespaced version of the Autoloader class from Template Data Providers The YAML parser is a namespaced version of Spyc Edit: updated the repo link
    1 point
  10. HELLO! I've been working on a user messaging module which I am nearly ready to release as version 1. Currently I have the below functionality and I'm looking for feedback to what other things may be useful for people looking to add user to user messaging on their sites. compose message to one or more users known to PW js to enable tag based UI display of user names input on compose message form display all message threads with reply forms reply to message thread displaying each user name by each message in the thread display "unread" when a thread has new content that hasnt been seen by current user delete or unpublish message thread (configurable) display total message thread count display total unread threads (threads that have new replies that the current user has not seen) delete all message threads and associated data (not meant for the users to have access to) road map send email to user on new message to a thread they are included in
    1 point
  11. Thanks, these filenames are OK at first sight, but it's the JS workaround that is failing (so it's not horst :)). I wasn't able to entirely duplicate the issue but if I uploaded an image and set a crop without saving the page itself first, there was a JS error that prevented the preview to update (uninitialized tooltip). I've fixed it here, so please try updating this file: https://github.com/rolandtoth/CroppableImage3/blob/master/InputfieldCroppableImage3/InputfieldCroppableImage3.js If this doesn't help, you could hide the preview image until a better fix (eg. with some admin CSS).
    1 point
  12. It is solved finally. Used the multisite by @Soma I did not find in the documentation that I had to add all domains also to site/config.php. When I did that, all worked like a charm.
    1 point
  13. Thanks dragan! and thanks maxf5 you really helped me out! It is working now. I think i mixed your last entries. The code i use now: // find the highest customer number $highest_customer_number = $pages->get("template=user, sort=-id, limit=1, roles=anzeigen-anbieter")->customer_number; // add +1 $customer_number_plus_one = $highest_customer_number + 1; //create user details $user = new User(); $user->of(false); $user->pass = rand_string(8); $user->email = $email; $user->customer_number = $customer_number_plus_one; $user->addRole("anzeigen-anbieter"); $user->save(); $user->of(true);
    1 point
  14. Ah I see. Aha! I never knew this existed, found how to enable here: Gonna give it a whirl.
    1 point
  15. This is possible with the Multi-site module. Read through the whole thread. There is valuable info in it. You may need the restructure your tree a bit.
    1 point
  16. Yeah, it does actually. The screenshots I showed here are for ProcessWire 3.0.41. I just did a fresh install of ProcessWire 3.0.62 and CKEditor looks much better (plus ripped off your wonderful idea of putting the images next to the field...) ...and the RTE button insert image modal: The modal still looks different from your though. This is a fresh install, no AOS or anything.
    1 point
  17. I'm not too sure it is doable or not, just an idea, you can read about multi sites here: https://processwire.com/api/modules/multi-site-support/
    1 point
  18. Thank you for providing this important information regarding PW image filename conventions and a very good explanation of the reason why they exist. It cleared things up for me, at least.
    1 point
  19. CKEditor's inputfield settings -> Details tab -> Markup/HTML (Content type) -> Update image alt attributes: Replace blank alt attributes with image description And this is why hiding the Image inputfield might not be the best idea. If you hide it, how can the editor provide the alt text? Similar to yours but sometimes little things make a big difference: Body -> Body Images Notice the description too. BTW, I could not reproduce your tiny image + caption issue on ProcessWire ProcessWire 3.0.73. My "Select image" modal looks different, see my screenshot in my post above. I have an Upload Image button in the bottom-right corner too, next to cancel. Don't you have those as well? Also, I do not have "Choose File". My "not hacked" upload modal looks like Peter's (+ the buttons in the bottom as well):
    1 point
  20. @flydev: Really I'm not feeling in the right position to give suggestions here. I appreciate all the work and recherche you do here, so you should decide what is lesser work or fits better for you, for what ever reason. - If, at the end, a solution is available that let people login with their twitter account, it would be really great and is much more than there is atm.
    1 point
  21. @teppo have you taken look at this yet?
    1 point
  22. Since I read about the new fieldsets I'm thinking if it would make sense to have some kind of fieldset library. Maybe export jsons in github gists? Or maybe collect them just in a forum thread here... This could make it more easy and more efficient to share common fieldsets, like SEO, person details or the like. What do you guys think?
    1 point
  23. I ended up hiding the "top-left" upload button with CSS: #ProcessPageEditImageSelect > a { display: none; } And "translating" the label of the "bottom-right" button:
    1 point
  24. Hey @ryan loving these fieldset updates, keep them coming. I was holding myself not to start building a website until I can get my hands on these. Now having tried FieldtypeFieldsetPage, I've found it really useful for page meta (tags, categories etc) and SEO (seo title, desc) related fields. I also have a bug to report. ProcessPageEditLink crashes when it tries to get the list of files (when adding a link with CKEditor). It can handle basic repeater and repeater matrix pages properly but not FieldtypeFieldsetPage, and I get this error: Problem comes from this part. $repeaterPage is the id of repeater item, not a fully loaded Page instance. protected function getFilesPage(Page $page, $prefix = '') { $files = array(); foreach($page->template->fieldgroup as $field) { $type = $field->type; // ... } else if(wireInstanceOf($type, 'FieldtypeRepeater')) { $value = $page->get($field->name); if($value) foreach($page->get($field->name) as $repeaterPage){ // repeater page is page id, not a Page instance!! $files = array_merge($this->getFilesPage($repeaterPage, $field->getLabel() . ': '), $files); } } } return $files; } For now, I'm skipping FieldtypeFieldsetPage using: if(wireInstanceOf($type, 'FieldtypeFieldsetPage')) continue;
    1 point
  25. Do you have an admin.php in you site/templates folder?
    1 point
  26. You can download and test from this address: GITHUB-SITE-BS4 and this MODULES - SITE-BS4 And I add a screenshot:
    1 point
  27. Thumbs up for 3.x branch!
    1 point
  28. @Vayu Robins, to be honest I wouldn't be surprised if it wasn't. Repeaters, I believe, are somewhat supported, but Repeater Matrix is a lot more complex, at least as a concept. I'll look into this as soon as possible. @apeisa, I'll look into that image issue too. Unless that's really easy to fix, it might be time to release a 3.x branch of this module though. Could probably solve a bunch of things more cleanly now. API level tests still look good, so I'm thinking that this file issue might have something to do either with the "recent" UI updates, or perhaps the temp file thing..
    1 point
  29. No it's not supported as the Module just renders the page structure. But it can be manipulated/faked in some ways with JS. And that's what I do if it's needed, cause it's a usability feature and something that doesn't really belong there, in the nature of a menu UL structure and the source. So I think it's ok to do that client side. Some example to do it. The "has_children" and "parent" come from the module and need to be removed to avoid false styling/information. $navigation = $('.wrapper .navigation'); // generate "overview links“ for each submenu $navigation.find('li:has(ul)').each(function() { $this = $(this); var classes = $this.attr('class'); var $link = $this.find('>a'); var href = $link.attr('href'); var $item = $('<li class="' + classes + '"><a href="' + href + '">' + $link.text() + '</a></li>'); $item.removeClass("has_children"); $item.removeClass("parent"); $this.find('>ul').prepend($item); }); Edit: this is recursive over all levels. So all li's that has a UL. If you only want for the first level you'd adapt the find() to find(">li:has(ul)").
    1 point
  30. With the latest dev version, you can also now do: $urls->httpRoot
    1 point
  31. $config->urls->httpRoot https://processwire.com/blog/posts/processwire-2.6.18-updates-pagination-and-seo/#new-http-prefix-available-for-all-config-gt-urls-properties
    1 point
  32. Hi, Sorry to dig up a so old topic, but I'm not satisfied with this answer. $config->httpHost return the url without the protocol (example.com) And $pages->get(1)->httpUrl return the page with the language urlSegment (http://example.com/de) Is there no way in Processwire to get a full site url, with protocol and domain name? The only solution I can see for me is to built it my self with $_SERVER values. Thanks.
    1 point
  33. If you need partial matching you'd need to use the %= operator. It's using mysql's LIKE to get matches.
    1 point
×
×
  • Create New...