-
Posts
4,632 -
Joined
-
Last visited
-
Days Won
55
Everything posted by apeisa
-
Modules directory: http://modules.processwire.com/modules/facebook-login/ Github: https://github.com/apeisa/FacebookLogin I didn't have any real reason to build this. I actually started to just browse the documentation of OAuth implementations and discovered that Facebook really does make this easy: http://developers.facebook.com/docs/authentication/server-side/ (header "Example" on bottom of the page) so I decided to implement it. It was also nice way to test the Ryan's method of module that creates page which executes itself (like Ryan's new ServicePages module).
- 26 replies
-
- 10
-
-
Made a little test drive and works fine here too.
-
Awww! Developer love <3
-
Btw: this module has only Soma as author on module directory: http://modules.processwire.com/modules/language-localized-url/ - Ryan, is it possible to support multiple authors for a module?
-
Hi Buddy and welcome! $page = $wire->pages->get("my-page"); Not sure about the context, but I assume you work at template files (/site/templates/*.php), If that is the case, then above line doesn't make a lot of sense. $page variable is already populated with the current page, so you should use different variable there. Also $wire->pages should be just $pages. So this might be more accurate: $p = $pages->get("/my-page/"); // I use $p instead of $page so that I won't override the current page $page->getInputFields() is not needed here at all I think. All the fields are directly accessible from the Page object, like this: echo $page->title; But images are different from norman text fields. This doesn't return url in any case: $page->images Above returns either Pageimage object or Pageimages object (=array), depending on how many images it is allowed to have. If 1 then it is single image, otherwise it is array. So most common way to get first image is this: $page->images->first()->url; Recommended reading: http://processwire.com/api/templates/ and http://processwire.c...in-processwire/
-
Yep, I think it is the best way to go here.
-
It does create a different image, that is not problem. But after initial image resize, when you next time edit the image in TinyMCE, the editor doesn't remember the width anymore and fallbacks to original size. Example: if you want to change left alignment to right, you also need to do resizing again, since TinyMCE doesn't know the size (it reads those from height and width attributes apparently).
-
That method probably loses the image dimensions when you edit image again? Just like this method.
-
Not yet tested, but I will give a little test drive this weekend.
-
True, should be possible with css. I'll go that route for now, thanks!
-
Martin: there are some new security stuff in PW, at least CSRF protection, which might cause this issue with CloudFlare.
-
Redirects module is no good here, since it does redirects without pages. Redirect template would be better here (there are good examples in forum, but in hurry now).
-
Soma: I have used your module in one project and I like it very much. Have worked without any worries. But now I have navigation scenario that I am not sure if it is possible with MarkupSimpleNavigation or should I code snippet for this. Default view works like this (normal two levels deep): LEVEL1 Page a ---LEVEL2 Page aa ---LEVEL2 Page ab ---LEVEL2 Page ac LEVEL1 Page b ---LEVEL2 Page ba ---LEVEL2 Page bc LEVEL1 Page c ---LEVEL2 Page ca But when I go to level2, it should collapse that page and show level3 pages there, but not from other branches. Like this: LEVEL1 Page a ---LEVEL2 Page aa ---LEVEL2 Page ab ------LEVEL3 Page aba ------LEVEL3 Page abb ---LEVEL2 Page ac LEVEL1 Page b ---LEVEL2 Page ba ---LEVEL2 Page bc LEVEL1 Page c ---LEVEL2 Page ca Is this something that is possible with just settings?
-
Oh yes indeed (had already forget about this): http://processwire.com/talk/topic/643-release-thumbnails/page__st__100#entry12815 Need to implement that fix "officially" soon...
-
Interesting blog post on Gadgetopedia: http://gadgetopia.com/post/7901. In the end of the article there is talk about similar tool, but for EpiServer. That kind of approach might nail the issue with migrations also: http://pagetypebuilder.codeplex.com/
-
What is the URL (or the url params only) of the thumbnail link?
-
Seems like something wrong with settings. Probably some cache issue, try saving the field and try again?
-
Have you changed the fieldtype and inputfield both to cropImage?
-
http://postcardsfromtheroad.us/posts/site-update/
-
Sure. I'll put it to github soon. We have few ideas to develop it further. Things like bringing more user details like email, but most importantly map ad groups to roles.
-
This is little different, since you are creating a new page. My comments below with code: public function init() { // now we want to hook after page save, since we are not manipulating the saved page, but creating/removing others $this->pages->addHookAfter('save', $this, 'afterPageSave'); } public function afterPageSave($event) { // $page will keep the page that user has just saved $page = $event->arguments[0]; // you probably want to have some conditions whether or not to do something. If you don't have any conditions here, then you go into a loop. if ($page->id == 12345) { $p = new Page(); $p->template = $this->templates->get("basic-page"); $p->parent = $page; $p->title = "New page under the saved page"; $p->save(); } // Removing of pages, could be in the same if or then some other conditionals. Now we check if field "delete_children" is checked (or has value of 1) if ($page->delete_children == 1) { foreach($page->children() as $p) { $p->delete(); } $this->message("Children removed."); $page->delete_children = 0; $page->save(); } }
-
I tested this in one project and it works great! I implemented the WillyC improvements and added the Session prefix to the name. Code is here: <?php class SessionLdapAuth extends WireData implements Module, ConfigurableModule { public static function getModuleInfo() { return array( "title" => "LDAP Authentication", "version" => 100, "summary" => "Allows uses to be authenticated via LDAP", "permanent" => false, "singular" => true, "autoload" => true ); } public function init() { $this->session->addHookAfter('login', $this, 'login'); } public function login($event) { if ($event->return) return; // they are already in $name = $event->arguments[0]; $pass = $event->arguments[1]; $conn = ldap_connect($this->data['host']); if ($conn) { $bind = @ldap_bind($conn, "$name@{$this->data['accountDomainName']}", $pass); if ($bind) { // success // check if they area lready a user in PW $user = wire('users')->get("name=$name"); if($user->id) { $user->pass = $pass; if($user->isChanged('pass')) $user->save(); $user = wire('session')->login($name, $pass); $event->return = $user; return; } else { // create a new user $user = wire('users')->add($name); $user->pass = $pass; $user->addRole('guest'); $user->save(); wire('users')->setCurrentUser($user); $event->return = $user; return; } } else { // fail $event->return = null; return; } } else { // could not connect throw new WireException($this->_('Could not connect to LDAP')); } } static public function getModuleConfigInputfields(array $data) { $inputfields = new InputfieldWrapper(); $field = wire('modules')->get('InputfieldText'); $field->attr('name', 'host'); $field->label = 'Host'; if (isset($data['host'])) $field->attr('value', $data['host']); $field->description = 'The LDAP server hostname'; $inputfields->append($field); $field = wire('modules')->get('InputfieldText'); $field->attr('name', 'accountDomainName'); $field->label = 'Account Domain Name'; if (isset($data['accountDomainName'])) $field->attr('value', $data['accountDomainName']); $field->description = 'The LDAP server domain'; $inputfields->append($field); $field = wire('modules')->get('InputfieldText'); $field->attr('name', 'accountDomainNameShort'); $field->label = 'LDAP server domain (short)'; if (isset($data['accountDomainNameShort'])) $field->attr('value', $data['accountDomainNameShort']); $field->description = 'The LDAP server hostname'; $inputfields->append($field); $field = wire('modules')->get('InputfieldText'); $field->attr('name', 'baseDn'); $field->label = 'Base DN'; if (isset($data['baseDn'])) $field->attr('value', $data['baseDn']); $field->description = 'The LDAP server DN'; $inputfields->append($field); $field = wire('modules')->get('InputfieldCheckbox'); $field->attr('name', 'startTls'); $field->label = 'Use TLS'; $field->attr('value', 1); if (isset($data['startTls'])) { if ($data['startTls']) $field->attr('checked', true); } $field->description = 'Check this option to enable TLS security'; $inputfields->append($field); return $inputfields; } }
-
Current method has a limit on somewhere of 8mb or so... I think current js solutions don't scale there yet (not entirely sure, but I think so), so doing that big uploads you would need to build SWFUpload inputfield (or some other flash/java based uploader).
-
If that kind of setup is possible, I think it would be great.
-
One solution might be to have two fieldtypes: image and images. Other is always single image and other is always an array. Not sure though that this is something that should be changed now - I love the fact that PW API is not changing all the time. This kind of change is something that I would like to see in version 3.0, not during 2.x branch. Also not sure which would be best solution here, but I think the current way is not ideal.