-
Posts
1,554 -
Joined
-
Last visited
-
Days Won
48
Everything posted by gebeer
-
This looks like a great module, thank you! I came here searching for dependent select options with PW. Now I'm reading that the video demo uses dependent selects. That is exactly what I need. But I can't seem to find a fieldtype "dependent selects". Is this part of some other fieldtype that I need to install first or how do I set up 2 dependent select fields in the backend?
-
Bootstrap 3 SASS Fontawesome Blank Site Profile
gebeer replied to gebeer's topic in Themes and Profiles
You can install the profile first and then open a terminal in site/templates and do "bower install". Sorry, I now see that my instructions are not clear about the sequence of steps here. I amended that.- 6 replies
-
- Fontawesome
- Blank Site Profile
-
(and 2 more)
Tagged with:
-
Since I've been working on a few projects where I used Bootstrap 3 and will be using it for future projects, I put together a blank site profile with Bootstrap 3 Sass, Fontawesome and a few markup render functions for Bootstrap dropdown menu, image carousel and accordion. You can find it at https://github.com/gebeer/site-pwbs Features bootstrap-sass-official font-awesome SASS version jquery modernizr render functions for:BS3 dropdown menu BS3 accordion from PageArray BS3 carousel from PW images array Prerequisites compass bower How to install from zip: download the zip extract the folder "site-pwbs" into a clean ProcessWire install's root folder during install of ProcessWire choose the profile "bootstrap-sass-official fontawesome blank profile" After installation The last step after installing the profile is to install all assets with bower: open a terminal in site/templates and execute "bower install" How it works The profile is based on the blank site profile that comes with PW 2.5 and uses the delegate template approach. It comes with a top navbar, a main container and a footer section. Rest is up to you. CSS gets compiled through compass. You can easily override BS variables and exclude BS components that you don't need. I intentionally did not add structure to the sass folder so you can structure your partials yourself as you please. There is only one folder "generic" with _mixins.scss whith a very lean and flexible breakpoint mixin that I discovered here. JS Since I only use the BS javascript plugins I really need, I usually copy them over to my plugins.js file. I use bower to install bootstrap-sass-original and fontawesome because it gives more flexibility than requiring them through ruby gems. This way you can tweak the BS and FA partials to your liking (of course only if you don't intend to do "bower update" further down the road) Enjoy!
- 6 replies
-
- 8
-
-
- Fontawesome
- Blank Site Profile
-
(and 2 more)
Tagged with:
-
@adrian Yes, that is the one. Info also at http://webcomponents.org/polyfills/ @LostKobrakai Your idea with custom .htaccess rule to allow access of html in bower_components is great I'll see if I can put one together...
-
This might be a dumb question. But what would be the solution to work with web components import links in a PW template and still maintain good security? I guess that rewrite condition is there for a good reason. But also the use of polymers imports is probably going to increase in future. So it would be great to find a secure way of making them work together smoothly with PW.
-
Thank you guys, I did a search for webcomponents import instead of polymer. That's why that thread didn't come up.
- 3 replies
-
- webcomponents
- polyfill
-
(and 3 more)
Tagged with:
-
Hello all, on a new project I want to use https://github.com/stevenrskelton/flag-icon which implements svg icons for country flags via webcomponents import. In the <head> I import the webcomponents polyfill js and the flag icons html with <script src="<?php echo $config->urls->templates; ?>bower_components/webcomponentsjs/webcomponents.min.js"></script> <link rel="import" href="<?php echo $config->urls->templates; ?>bower_components/flag-icon/flag-icon.html"> But I get a 403 error: NetworkError: 403 Forbidden - http://dev/pwtest/site/templates/bower_components/flag-icon/flag-icon.html For testing I did: 1. a clean install of html5-boilerplate (not in PW), added flag-icons through bower and linked the resources as above. Here I don't get the 403 error. 2. a clean install of processwire with the blank profile, added flag-icon through bower and linked the resources as above. And here I get the error again. I did this on 2 different servers. Same result. I also checked permission of the import file and they are fine (644). Then I tried to make a demo install on lightning.pw but the service exits with "We're sorry, but something went wrong." To me this seems to be a ProcessWire related problem. Maybe somebody can confirm this or has an idea what is happening? Thank you.
- 3 replies
-
- webcomponents
- polyfill
-
(and 3 more)
Tagged with:
-
[SOLVED] Pass data to custom user method
gebeer replied to gebeer's topic in Module/Plugin Development
I would like to mark this as solved. But the "Mark Solved" Button is missing. I just used it on another thread of mine. But here it is not available. I opened the thread, so I should see this button? -
Thanks clsource! This really helps me for better understanding the whole hooking thing in PW. Instead of messing with cookies, I decided to better use token based authentication instead of sessions. Cheers Gerhard
-
Thank you! I am now going with the token approach. That is much cleaner and more REST like.
- 32 replies
-
- helper
- processwire
-
(and 2 more)
Tagged with:
-
I usually make clear in my offer/cost estimate whether I am responsible for the wording or the client. This helps to avoid problems at a later stage. Also to make clear that time I put into wording review and improvement will be charged extra. PS: maybe this should be moved to the dev talk thread?
-
Hello, part of my new project is providing a RESTful webservice through PW. I am using clsource's REST Helper for ProcessWire which is working great. For the REST service part of the site I would like to suppress the setting of session cookie for $session->login and $session->logout because I don't need sessions and I don't want to have Set-Cookie in my response header. For user authentication in a PUT request I use $session->login() to verify username and password: $uId = $input->urlSegment1; $u = $users->get($uId); if ($session->login($u->name, $params["upass"])) { $session->logout(); //update user data } In the response header for that request I get: Set-Cookie: wire=ha6io723mkfc9v4scdib3oe8g7; path=/; HttpOnly wire=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT wire=1n8faeiva3vg7u13ijsrs24bt1; path=/; HttpOnly wire_challenge=YK0WRw0Wrd2ZAhKEUCLPOHd9iSySEPb91; expires=Tue, 07-Apr-2015 14:11:24 GMT; path=/; httponly wire=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT wire=u9m41s8b87d3ca1jp1jbl0r6k3; path=/; HttpOnly wire=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT wire=oidcbmht561qnvts2fjnq4b7p3; path=/; HttpOnly persist=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/ At the moment I get rid of it by doing header_remove("Set-Cookie"); But I would like to avoid setting of that cookie in the first place. I found the relevant methods ___login and ___logout in /wire/core/Session.php But searching Captain Hook for "logout" doesn't bring up those methods. I assume they should be hookable because they start with 3 underscores. Now how would I hook into those methods from my template file (not as an autoload module)? The webservice endpoint url is .../api/users/ and my temlate file for that is users.php What I've tried so far is wire()->addHookBefore('Session::logout', null, 'logoutNoCookie'); function logoutNoCookie($event) { $event->replace = true; $sessionName = session_name(); $_SESSION = array(); // if(isset($_COOKIE[$sessionName])) setcookie($sessionName, '', time()-42000, '/'); // if(isset($_COOKIE[$sessionName . "_challenge"])) setcookie($sessionName . "_challenge", '', time()-42000, '/'); session_destroy(); session_name($sessionName); $this->init(); session_regenerate_id(true); $_SESSION[$this->className()] = array(); $user = $this->wire('user'); $guest = $this->wire('users')->getGuestUser(); $this->wire('users')->setCurrentUser($guest); $this->trackChange('logout', $user, $guest); if($user) $this->logoutSuccess($user); $event->return = $this; } But this gives me an error: Fatal error: Using $this when not in object context because I'm placing my hook function outside the class context. What would be the correct way for calling the hook and placing my hook function?
-
header_remove("Set-Cookie"); did the trick. I guess this is not the cleanest way of doing it. I opened a new thread to find out how I can suppress cookies in the first place as this is somewhat beyond the scope of this thread here.
- 32 replies
-
- helper
- processwire
-
(and 2 more)
Tagged with:
-
Thanks again for your help. I will give header_remove a try when I'm back at my office and report back here. Cheers Gerhard
- 32 replies
-
- helper
- processwire
-
(and 2 more)
Tagged with:
-
Thank you clsource! I would like to use PW built in functionality for authenticating my users rather than implementing my own. I am aware though, that the RESTful approach is supposed to work without server side session handling. That is why I only login the user to check if the correct password was sent and then logout of the session instantly. If there is a way to avoid the Cookie info in the response header, that would be what I'm looking for. If there is none, I will have to rethink my approach and use a token along with the password in the Authentication header. Also I'm a bit confused about the cookie data in the response header. wire cookies expire 1970 and there are several of them? So if anybody can think of a PW API method to suppress cookies, that would be great.
- 32 replies
-
- helper
- processwire
-
(and 2 more)
Tagged with:
-
@clsource Thank you for your REST helper. I'm using it for a project and it is working fine. For my project I'm using basic HTTP Authetication. I added some code to the params method to fetch username and password and merge it into the $params array. The altered code is here: https://gist.github.com/gebeer/5d1447ff76e17931d944#file-rest-php-L265 For a PUT request I use $session->login() to verify username and password. $uId = $input->urlSegment1; $u = $users->get($uId); if ($session->login($u->name, $params["upass"])) { $session->logout(); //update user data } In the response header of that request I get some PW cookie data: Set-Cookie: wire=ha6io723mkfc9v4scdib3oe8g7; path=/; HttpOnly wire=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT wire=1n8faeiva3vg7u13ijsrs24bt1; path=/; HttpOnly wire_challenge=YK0WRw0Wrd2ZAhKEUCLPOHd9iSySEPb91; expires=Tue, 07-Apr-2015 14:11:24 GMT; path=/; httponly wire=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT wire=u9m41s8b87d3ca1jp1jbl0r6k3; path=/; HttpOnly wire=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT wire=oidcbmht561qnvts2fjnq4b7p3; path=/; HttpOnly persist=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/ Can I avoid that somehow other than not using session? In the PW cheatsheet I couldn't find anything related to cookies.
- 32 replies
-
- 2
-
-
- helper
- processwire
-
(and 2 more)
Tagged with:
-
[SOLVED] Pass data to custom user method
gebeer replied to gebeer's topic in Module/Plugin Development
Thank you both, LostKobrakai and Soma ! I call my custom method with $user->saveprofile($params) and can access the data in my method with $userData = $event->arguments(0); PS: Missing the Solved Button -
Hello, I want to add a custom method to the user object and need to pass some data ( an array called $params) to the method when I call it. I will call the method like this $user->saveprofile($params); The method takes that data and saves it to a user profile page. Only I don't know how to pass that data to my custom method. This might be a silly question. Please forgive me, but I am fairly new to OOP and PW modules/hooks development. This is what I have so far (taken off examples from here): public function init() { // init() is called when the module is loaded. $this->addHook('User::saveprofile', $this, 'UserSaveProfile'); } public function UserSaveProfile($event) { //how to pass my $params array to this method // Get the user object $user = $event->object; // get user data - this is where I am stuck $userData = // condition and actions if($user->hasRole("frontend")) { //create and save user profile page $this->message("Userprofile page for user " . $user->name . "has been created"); } } I tried to find examples of how to do that but could not find anything related in the forum. Any help would be appreciated. Thank you.
-
You define $tagnames as an empty string with $tagnames = ""; Later in your foreach loop you treat $tagnames as an array and add items to it in $tagnames[] = $tag->id; Maybe you should declare $tagnames as empty array in the first place, like $tagnames = array(); not sure though if this solves your problem... EDIT: Sorry, I just read in the PHP documentation So forget about what I said above...
-
Looks great, thank you!
-
Hello, this looks exactly like what I need for a new project. Before I go and buy ProFields I'd like to know if it fits for what I want to do. In my case the multiplier field will be used on a frontend form. Is it possible through the API to show a fixed number of fields, depending on the context? Example: I have a template for servers. Depending on the server model, each server can have different number of channels. So I need to render a frontend form via the API that has either 4, 8, 10, 20 or 40 multipliers of the channel field depending on the server model. Is this possible and is there some documentation on how to save/retrieve values through the API? Thanks
-
SOLVED It was a role/permission issue. ProcessExportProfile didn't export the permissions correctly for a custom role in my system that got assigned a custom permission. After reassigning those, I can finally access the page.
-
Thanks for sharing. This looks interesting for putting together prototypes. Only thing that would keep me from using it is that I got used to a SASS workflow. Pinegrow automatically saves scss files along with css and less version, when you edit. But how do these scss files look like, just plain css with scss file extension? Maybe you have tried that already and could report back here. Thank you. PS: your cutegrid looks appealing. Will definitely have a look...
-
Hello, I exported a profile of a running live site (PW 2.5.2) with ProcessExportProfile module. Then cloned latest stable branch 2.5.3 to my local vagrant box dev server, copied the exported profile folder into PW root and installed. Everything went smoothly so far. All my templates, fields, modules and template files are there. I can access all but one specific page of my site. That page always throws a 404 error. The page sits under /profile and has template userprofile assigned. It is published and not hidden. The template file site/templates/userprofile.php is there. Only difference to the working pages is that this /profile page requires login before it can be accessed. After successful login the user is redirected to the /profile page with if($user->isLoggedin()) $session->redirect($pages->get('/profile')->url); But also if I enter the URL path manually, I get the 404 error. On the live site /profile only throws a 404 if you enter the URL path manually and are not logged in. So on my local install the /profile page acts as if the user was not logged in even if the user is logged in. I checked that the user really is logged in with if($user->isLoggedin()) echo "LOGGEDIN"; and has the correct roles with if($user->isLoggedin()) echo $user->roles; I haven't made any changes to my userprofile.php or any other files in the fresh install. And the code in there is working perfectly fine on the live site and on a copy of the live site that runs in the same dev environment as the site I'm having problems with. Now I'm really lost and don't know which steps to take for debugging this (debug is set to true in config.php - no messages or errors). Any help would be greatly appreciated. EDIT: I also installed the site on a different non local server to be able to rule out server environment issues. But same behaviour. Still get 404 for profile site