Jump to content

Noel Boss

Members
  • Posts

    170
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Noel Boss

  1. Hi Folks I want to access $user->language inside the init hook because I want to make some access checks; $this->wire()->addHookAfter('Page::viewable', $this, 'checkAccessHook'); – but I get only the default language: $user->language->name > default However, I do have the correct user ID and I would have expected that at least using pages->get I can fetch the correct language via a custom lookup?! $pages->get('id=$user->id, include=all')->language; But nope... still just default. Any ideas? ––– Alternatively, @ryan if you are listening – I think there is a hook missing to inject access restrictions etc. – somewhere deep down (and early) in the system – that also works for find() operations etc. Most everything is there with PW but this has been a major pain-point for our current project with complicated user access restrictions and configurations. If we could hook into somewhere, that would be amazing. Currently it's really tricky and quickly gets messy when we have user dependecies and with the order if init() and ready() and page::viewable()
  2. Hi @Lance O., yes. This is how I did it; I used the LoginRegister module of Ryan on a Page with a "PageUserProfile" template: // Code on the template PageUserProfile $input->get->profile = 1; $loginRegister = $modules->get('LoginRegister'); $user->of(false); echo $loginRegister->execute(); Then I use my own module and inside the init() function, I add two hooks: <?php /** * © ICF Church – <web@icf.ch> */ namespace ProcessWire; class TemplateUser extends WireData implements Module { protected $template = 'user'; public function init() { // handle profile images $this->addHookBefore('Page(template=PageUserProfile)::render', $this, 'profileImageUpload', ['priority' => 6]); $this->addHookAfter('Page(template=PageUserProfile)::render', $this, 'profileImageRemove', ['priority' => 99]); } /** * getModuleInfo is a module required by all modules to tell ProcessWire about them. * * @return array */ public static function getModuleInfo() { return [ 'title' => 'Template User Controller', 'version' => '0.0.1', 'summary' => 'Helps with profile image', 'href' => '', 'singular' => true, 'autoload' => true, 'author' => 'Noël Bossart', 'icon' => 'unlock', ]; } /** * Hock to add profile image to user object. * * @param HookEvent $event */ public function profileImageUpload(HookEvent $event) { $user = wire('user'); $input = wire('input'); if ($input->post->profile_submit) { $upload_path = $user->filesManager->getTempPath(); // name of the inputfield from the LoginRegister Module: $f = new WireUpload('profile_image'); $f->setMaxFiles(1); //$f->setMaxFileSize(1 * 1024 * 1024); $f->setOverwrite(true); $f->setOverwriteFilename('userimage'); $f->setDestinationPath($upload_path); $f->setValidExtensions(['jpg', 'jpeg', 'png', 'gif']); // remove image… if (strpos(implode(array_keys($_POST)), 'delete_profile_image_') !== false) { $user->of(false); $user->image->removeAll(); $user->save(); } $files = $f->execute(); if ($f->getErrors()) { foreach ($files as $filename) { @unlink($upload_path.$filename); } foreach ($f->getErrors() as $e) { echo $e; } } elseif (is_array($files) && count($files)) { $user->of(false); $user->image->removeAll(); // wirearray (line added by @horst: explanation is three posts beneath) foreach ($files as $file) { $user->image->add($upload_path.$file); } $user->save(); foreach ($files as $file) { @unlink($upload_path.$file); } } } } /** * Hock to remove profile image from user * * @param HookEvent $event */ public function profileImageRemove(HookEvent $event) { // remove image… if (strpos(implode(array_keys($_POST)), 'delete_profile_image_') !== false) { $this->user->of(false); $this->user->image->removeAll(); } } }
  3. @flydev I did not use the code as is but changed and extended some of it.
  4. Did you miss the readme or did I mess up and should make anything more clear there? https://github.com/noelboss/AdminThemeBoss/blob/master/README.md#modify-yourself
  5. @maxf5 - fixing it – is an issue with AOS, release 0.5.3 does fix it. And I've also further refined the login screens: Well, I had designed colourful login screens, but did not really like them. If you still want to look at these and maybe give some feedback, you are welcome:
  6. I’ve updated the version number. There is now a shiny new release page where you can subscribe to updates for new releases of AdminThemeBoss!
  7. Hello everybody, I‘ve just released version 0.5.1 with @Chris Bennett‘s toggle checkboxes. a redesigned login screen and many small imrovements and fixes! Check out more screenshots at github. I hope you like the changes...
  8. Thanks @Chris Bennett ! Just integrated it in my latest release: Looks nice!
  9. Thats one aspect I love about how you handle PW and the community! The feeling of beeing left in the dark about the future is common for other nice projects and fules uncertainty about it. The constant high quality updates an Blogposts makes me very comfortable and trustfully in PW! Thanks so much @ryan!!! I totally agree and 100% understand all your explanations above. My hope is that some talented designers and PW enthusiasts can support you on the design an UX side of things like @teppo constantly supports PW with very high quality content trough weekly.pw I myself are not a designer but would love to help in implementing some of the designs and ideas on the frontend side...
  10. Great work @ryan! Especially love the new search!!! I also like the results view of the search alot, clean and with the smart ability to filter by kind. Thanks for listening to our feedback about the skyscraper ornaments. Also, love the API search! What stands out to me is that the screenshots all together (with the exemption of the sites pages) look very uniform – mostly text, headings, lists. Very clean and organised, I like that, but visually there is not much to distinguish. Now I get that you are focusing on the content and structure of the site - so it might just be to early for feedback on this topic: I think that especially on the marketing focused pages, focusing on presenting ProcessWire for new users, stakeholders and designers & marketing departments, more images and specially crafted pages would make sense. But I would even argue that for more developer oriented pages, some images would be helpful. I'm a visual person and nice images for blogs, even modules would go a long way in making the experience on processwire.com a pleasing and joyful experience. Now I totally understand that you probably need support from a few UX and UI gurus but I guess, there are a lot of us from the community who would be more than happy to stepp in and offer support. A few examples from pages I stumbled across the last couple of days: Well crafted homepage with gimmicks (feature-slider): https://ora.pm/home or https://craftcms.com Nice visual blog posts: https://ora.pm/blog Visually appealing modules directory (with a nice touch for developers, the ability to sell your own modules): https://statamic.com/marketplace/addons Presenting many features visually (nice menu on the left): https://craftcms.com/features/all Blog, module and tutorials directory: The new Laracast website probably has a good middle-ground with nice graphical touches while still not to heavily reliant on custom visuals: https://laracasts.com/series One last thought, maybe "features" would be a better title for the "about" page because it's less about an organisation and more about a product. This is by no means negativ criticism, I really like the current progress of our new beloved CMSs home and would only like to offer some inspiration and my thoughts in hope that it helps boost PW. Ps. Sorry for the double post on the blog – from now on I will only post here… did not think about it when reading the blog.
  11. Thank you very much for this great Article and Congrats to the new/old site ? looks fantastic! One question, what do you mean by that; are you talking about a custom checkbox you added on all relevant templates?
  12. As @adrian said – that's why AdminThemeBoss is built just as a CSS Layer on replacing the AdminThemeUikit CSS… But the way to go there is pretty difficult – with the current AdminThemeUikit it's hard to find the relevant LESS variables and use these or override stuff... Also hooking into AdminThemeUikit and replacing or extending stuff is not strait forward. Would love to see more in this regard, a Theme that is built with extensibility in mind.
  13. Yep, I saw that, but its way more (and somehow less) than I need. I just wish there would be an easy way to copy my current setup to a live system without me needing to code stuff and adding more steps to my workflow… auto export would do this but does not cope with pro fields as of now – but I might just go about trying to fix it one day ? I appreciate the work of you @LostKobrakai and can see how one can get used to this workflow, but for me it's overkill – and underkill at the same time ? I know its a complex topic… I wish to find a middle ground.
  14. Hi @HMCB – no, we are still on the "old" C9 before it got acuired by Amazon – but now you can do so, never leave the Amazon ecosystem. Currently we push to git and pull on the live server – all directly from the c9 instance via Shell. We use some little scripts together with wireshell to pull data from our live system back to dev. What we still very much miss is a good (native) way to stage and release DB / Shema / Field / Page updates / Templates. Would be interesting how @ryan does it. Thats one of the only drawbacks to PW, that crucial parts of the system are stored in the db. There is a module that stores fields and template settings in json files – but it does not work with repeater matrix…
  15. Thanks Ryan for the latest update and listening to the voice(s) the community! Congrats to your new iMac! As @HMCB mentioned, it's always nice to work with a tool that you can admire, makes working so much more fun. @ryan Speaking of nice tools, want to share something I came to love very much, would hate to switch back to the old way of having installed my dev-stack locally: I switched to AWS Cloud9 (fully cloud based development stack: IDE, Server, PHP, DB… Amazon…) for basically all of my development and love it, it makes you basically machine (and OS) agnostic. I can continue anywhere in the world with my development with only a decent browser and internet connection. If you've got the time, check it out. For me and working in a team or with collaborators (community) its so convenient! Some of the amazing thins you can do: - Rapid prototyping: Instantly clone a project with all settings etc, try something, throw it away - Share the whole stack with someone, no need for the other person to install anything, simply share a url, everything is there, Server, Shell, IDE, DB… - Collaborate in realtime on a project (google-doc style) - Create a template container and quick-start your project … And since PW basically does not story any urls in the DB, I'm so quick in duplicating Projects with new URLs etc. Ps. If you're new to the Mac, usually what people do is; they know a tool from the windows world and if there is a Mac version of said tool, they install this one – but many times there is a better native Mac App that does not even exist for windows and you'd therefore don't know it. Look out for these. As a simple example: Looking for an FTP Client you could easily end up with some crappy windows/java port – or you'd end up with Transmit… It's worth looking for these quality alternatives. Also, for example for PDF (Adobe Acrobat) handling, or image annotation, or screenshots or screen-capture or… etc > the Mac can already handle it for 95% of the required work with native Tools like the Preview-App or system-wide features…
  16. Would love to, but it's not a priority for me right now and I don't have time. But since I documented how it works, I'm open to implement it if someone finds a way…
  17. @bernhard I agree that would be awesome. I thought about this as well but didn't force it because I'm not sure if this would work since the current process of compiling goes trough npm/yarn > webpack – there's probably a lot of magic going on there… Nothing special happened right now, but it's still a great hormone ?
  18. Hello Friends… New Version 0.4.0 released. I try to answe a few questions. How the theme works: PATHS ARE OUTDATED - THE CONCEPT MORE OR LESS THE SAME. (will update soon) The variations & Ryans work: It uses the built in uikit feature to create themes. Theme variations can be defined in uikit/themes.json. In my case, I define 3(+1) themes: black, blue and vibrant blue. These relate to "entry points" found under ./uikit/custom/antrypoint.less » like uikit/custom/pw.less or black.less or vibrant.less Each one of these basically only defines the custom accent colors and include all other general variables and some overrides: // uikit source @import "../src/less/uikit.theme.less"; // main accent color: // pw color @theme-primary-color: #3584EA; @theme-primary-color-rgba: rgba(53, 132, 234, 0.6); // Original Theme @import "../../AdminThemeUikit/pw/_import.less"; // AdminThemeBoss Custom Styles @import "fonts/fonts.less"; @import "theme/main.less"; In the newest Version (0.4.0) I actually grab ryans code (uikit and other custom stuff) and include my own customizations (variables etc) after that, this should ensure that the theme stays as compatible as possible. Of yourse if ryan changes major stuff, this needs to be addressed sperately. The Main File is uikit/custom/theme/main.less Ryans stuff can be found under ./AdminThemeUikit/ – it's a copy of the custom folder of his Module. There is a new ./upgrade-theme.sh that automates that stepp… Compiling the css Compiling is done using npm or yarn using webpack from the uikit folder. It's easy: $ cd uikit # grab node modules: $ yarn # compile $ yarn compile-less # or for development: $ yarn watch Injecting the css: Before 0.3.0 I search and replaced Ryans CSS in the html using a hook. Since 0.3.0 i only set parameters of AdminThemeUikit: cssURL and logoURL So no messing arround with unstable HTML… Why not an actual Theme? Tldr; For compatibility & flexibility reasons Longer Version: Because if I make AdminThemeBoss an actual standalone theme, I lose compatibility with Ryans AdminThemeUikit … By only working on top of his theme, all new features he includes will still (and instantly) be working with AdminThemeBoss without an upgrade because my theme is mostly only css. Also, I can not hook into his functions for example to extend the breadcrumb if I build my theme as a standalone theme. Why these color variations? Now there are 4 ? » Black: Because I our basic Corporate Design is mostly black and white » Processwire Blue: Because obvious I it would be cool to retain some relation to PW CD » Bright Blue: To have something fresh and because I like it ? » And a new Happy Pink version because of C43H66N12O12S2
  19. Thanks @jmartsch – I am using the theme myself so I should keep it updated… Since the theme just replaces the CSS, this should normaly be no problem… Just released 0.3.0 with uikit 3.0.0-rc.17 and a new way how CSS and the logo is injected (as actual theme config values for AdminThemeUikit instead of rewriting the html output) I will release 0.3.1 soon with the latest AdminThemeUikit Changes incorporated (work in progress)
  20. Love it! This just saved my arse… ? oh man, because of gems like this I love PW so much!
  21. Like @flydev said… # php.ini: short_open_tag=On # or .htaccess php_value short_open_tag 1
  22. Hey @adrian, amazing Module, works like a charm! May I ask why you use two checkboxes for the consent instead of radios which toggle automatically in relation to each other? Imho radios would be a better fit for they transport the notion of having an OR relation better than checkboxes where the user probably assumes its a AND relation… For anyone not wanting to use a module, check out http://cookieconsent.insites.com – pretty easy to integrate, I've included it before as a simple first step, with using page-fields to feed the labels.
  23. Any ideas on how to change the behaviour of the wire('sanitizer')->email ?
×
×
  • Create New...