-
Posts
4,956 -
Joined
-
Last visited
-
Days Won
100
Everything posted by LostKobrakai
-
It's really hard to tell which page you're working from and what that "course_name_from_list.title" is supposed to be. But if $page is the "All things media" page then use this: $assignments_find = $pages->find("has_parent=$page, template=quiz|challenge|assignment, sort=assignment_due_date"); If you need it from a child page of "All things media" then use this: $assignments_find = $pages->find("has_parent=$page->parent, template=quiz|challenge|assignment, sort=assignment_due_date"); or even $assignments_find = $pages->find("has_parent=".$page->parent($selectorForFindingTheRightParent).", template=quiz|challenge|assignment, sort=assignment_due_date"); This will always give you just the pages in the "All things media" branch you're on.
-
To clarify the facts. It seems you're not actually using a repeater, which is a special field in processwire, but you want to filter the pages you're looping over. Is that impression right? In each case you should take a look at the selector docs, which will enable you to filter both repeater field values as well as other lists of pages, like in your loop: http://processwire.com/api/selectors/.
-
I'll never understand google's marketing. First they announce to shut down google code, leaving an angry mob of people using the service and now they bring up this thing. Why didn't they just wait and suggest all those google code users moving to their new service.
-
Not tested, but should be a sufficient blueprint. <?php /** * Add own PageList actions * * ProcessWire 2.x * Copyright (C) 2014 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * * http://processwire.com * */ class AddPageActionsToPageList extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Page Actions to Page List', 'version' => 1, 'summary' => 'Adds PageActions to Page List actions', 'singular' => true, // Limit the module to a single instance 'autoload' => true, // Load the module with every call to ProcessWire ); } public function init() { $this->addHookAfter('ProcessPageListActions::getExtraActions', $this, 'addActions'); $this->addHookBefore('ProcessPageListActions::processAction', $this, 'exeActions'); } /** * Add the new actions */ public function addActions($event) { $page = $event->arguments[0]; $actions = $event->return; // We do not overwrite existing core actions $actions = array_merge($this->createActions($page), $actions); // $event->return = $actions // Shouldn't be needed } /** * Create the actions */ protected function createActions($page){ $actions = array(); if($page->id == 1 || $page->template == 'admin') return $actions; if($page->template->noSettings || !$page->editable('status', false)) return $actions; $adminUrl = $this->wire('config')->urls->admin . 'page/'; if($this->wire('user')->hasPermission('action-email', $page) && !$page->isTrash()) { $actions['action-email'] = array( 'cn' => 'Email', 'name' => 'Email', 'url' => "$adminUrl?action=PageActionEmail&id=$page->id", 'ajax' => true, ); } return $actions; } /** * This is run when an action is initiated * * This can only been called if a page is editable. */ public function exeActions($event) { list($page, $action) = $event->arguments; $actions = $this->createActions($page); // This way checking for roles or other access rules is not duplicated. // If the action is still created, it's also actionable. if(!isset($actions[$action]) || !$page->editable()) return; $success = false; $needSave = true; $message = ''; $remove = false; $refreshChildren = 0; // If $action is the name of the module if(strpos($action, "PageAction") === 0){ $module = $this->modules->get($action); if($module){ $module->action($page); $success = true; $message = $this->_("Email sent"); } } // If no module was supplied select manually if(!$success){ switch($action){ case "SomeOtherAction" // Do stuff break; } } // Return if success, otherwise move on to the hook function if(!$success) return; else $event->replace = true; // Return information $event->return = array( 'action' => $action, 'success' => true, // Fails are managed later by hooked function 'message' => $message, 'updateItem' => $page->id, // id of page to update in output 'remove' => $remove, 'refreshChildren' => $refreshChildren, // also available: 'appendItem' => $page->id, which adds a new item below the existing ); } }
-
I'm just curious why this seems to happen so randomly for people. One just doesn't get a ultra dynamic ip address all the sudden.
-
max image dimensions - "not a recognized image" [bug?]
LostKobrakai replied to bernhard's topic in General Support
That's most likely because a file field does not handle thumbnails, which is special to images. -
Polymer/html-imports blocked by .htaccess?
LostKobrakai replied to Osorio's topic in General Support
Nothing should break the pw bootstrap process, this topic is about the security issues of skipping it. The .htaccess line which prevents the polymer loading is blocking access to .php/.tpl/.inc and .html (see first post). The first three file extentions do have the potential to be dependent on processwire runtime variables, therefore accessing them should be handled by processwire. The last extention is in that rule, because before polymer nobody needed to access .html files directly from the client. They were only used by the .php files internally. So it was in the best interest to block access to them, too, so users cannot access those html chunks. Now with polymer that's not the case anymore, so just remove the .html from the rule to use them with polymer. Allowing more subfolders is also possible by editing the .htaccess rules and as long as there are only static files (js/css/html/img/…) it should not matter from a security standpoint. -
Twig PageTableExtended (Flexible Content)
LostKobrakai replied to ferraky's topic in General Support
The lack of response is most likely because there are most likely just a few people, who are using the same or similar combination of module you're using. Also this seems to be an issue with PageTableExtended and it's rendering mechanism, so you could maybe post in the support thread of the module. -
The above issue was due to the session, so as soon as the user relogs it's gone, but I noticed that api created pages where not initially visible. I fixed it by adding this, but I don't know if this will trigger the rebuild trice if pages are added in the backend: https://github.com/LostKobrakai/DynamicRoles/commit/5548722a566f7e4e23d326bd64a0783098b67108
-
Is there a field datefield named "date" in that page? If not you either need to create it or use one of these, depending on your usecase: "created" or "modified".
-
That would disallow all attributes (id/class/src/href) as well. Disallowing *{*} should be enough because it's preventing everything besides an empty style tag.
-
The syntax allows things in ckeditor. Your example would allow all possible combinations of tags. *{} could work, because it's stating no allowed style values for each element, but because of the empty brackets it could be that it's ignored and therefore any defaults are used.
-
I'm using dynamic roles to let users have access to client specific parts of a website depending on a pagefield in their user page. Now I just retracted access for one of those users, but the page was still accessable. Not until saving the dynamic role again the access was gone. Is this by design?
-
Replicating existing site on Wamp throws errors
LostKobrakai replied to Pretobrazza's topic in General Support
You're missing the <?php inside the foreach, Bernhard. -
Replicating existing site on Wamp throws errors
LostKobrakai replied to Pretobrazza's topic in General Support
If you split your foreach by html segments then it may be saver to use this syntax: <?php foreach($array as $item) : ?> … <?php endforeach; ?> -
image upload issue on MAMP Pro for Windows
LostKobrakai replied to ctrick's topic in Getting Started
The error shows single slashes and your example does use double slashes, so firstly it's not the same and secondly the double slashes do not seem right to me even for a windows environment. -
Well, using CroppableImage or fixing bugs on your own would be the two options.
-
Thumbnails is no longer actively maintained, so maybe there wheren't any fixes. But I've a page running 2.6.1 with Thumbnails and no problems.
-
Make sure to "open" the new parent page before moving stuff there. It needs to be highlighted to receive a page as child no matter if there are already children or not.
-
There's already a big pull request regarding various .htaccess settings over at github: https://github.com/ryancramerdesign/ProcessWire/pull/1128
- 1 reply
-
- 1