Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/25/2015 in all areas

  1. One more solution: https://github.com/teppokoivula/LoginScheduler. This has been on my todo list for a while, this topic just gave me a reason to put it together. Should work, but not 100% guaranteed
    7 points
  2. Quick overview of some updates I'll be sending to Ryan tomorrow. New Features: Sidebar saves open/closed state. Sidebar opens/closes with arrow keys. Sidebar toggle icon moved. Search input is now a masthead overlay. It's takes the same number of clicks as before (one) since the input is focused on click. The overlay can be closed with the (x) icon, or the up arrow key. User information is now customizable to any text fields associated with the user template. So you can use fields like a first_name last_name. Custom color schemes can be set in /site/modules/AdminTheme/AdminThemeReno/styles/. These files survive PW updates, so you can easily create custom variations on the theme without having to reinstall it after an update. (Thanks Pete!) Top navigation items are now hookable, so you can add additional single or nested items. Top navigation has quicklinks to ProcessWire resources for Superusers. (forums, docs, github, cheat sheet, etc..) There are other tweaks and fixes here and there, but these are all I can think of right now... Changes to masthead and top navigation Superuser Quicklinks User Information Search Overlay
    5 points
  3. Another approach: You could add a checkbox "inactive" to the users template. Then hook after login and if this checkbox is checked, return false.
    3 points
  4. Want to use Mandrill for sending emails using their HTTP API rather than SMTP? Read on! I've been working on a WireMailMandrill module for a site I'm currently adding some features to. So far, the module has been tested for simple mail sending, with basic options, and attachments. I haven't tested the full range of things that are possible with the official Mandrill PHP library, but I think I've implemented the ability to set most, if not all, of them. This should be considered beta and not entirely relied upon for sites in production. Testing and feedback welcome. I'm sorry about the lack of code comments at the moment as well, I was just throwing this together as I went along so I could move onto the next part of what I was building... This was originally mentioned in a discussion about SendGrid and Mandrill options in a thread in the Form Builder support area. Not everyone has access to that, which is why I'm putting this here WireMailMandrill on GitHub Quick example (taken directly from a site I'm working on): $mail = wireMail(); $mail->from('info@example.com', 'ExampleCOM Enterprises'); $mail->to($toMail, $toName); $mail->subject('Entry confirmation'); $mail->bodyHTML($bodyHTML); $mail->attachment($myPage->files->first()->filename); $count = $mail->send();
    1 point
  5. I've been using the checkbox method and a simple hook for a while. Works quite well.
    1 point
  6. I was going to say same as Martin - unpublish them in the page tree would be easiest. A quick module could add similar functionality to the normal user profile page for superusers maybe as I don't think you can do it there (can't check quickly as on mobile).
    1 point
  7. 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.
    1 point
  8. Yes, you can specify the GET vars that should be cached or bypassed. In addition, ProCache can also cache url segments.
    1 point
  9. to put it simply, you only want descendants of the current page, $allChildren = new PageArray(); foreach($page->children() as $parent) { foreach($parent->children() as $child) $allChildren->add($child); } $assignments_find = $allChildren->find("template=quiz|challenge|assignment, course_name_from_list=$page, sort=assignment_due_date");
    1 point
  10. 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.
    1 point
  11. 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 ); } }
    1 point
  12. Turn off sessionFingerprint in config.php. I'll record this, so I don't need to write it every other week the same.
    1 point
  13. Have to agree Pierre-Luc, mandrill is pretty sharp. I've been using it for about four weeks with this module and it's been 100% reliable (which I can't say for my previous SMTP setup. The API is sweet and the dashboard is pretty bloody good to boot. This is one system I'll use again and again. Cheers Craig for getting me onto this.
    1 point
  14. I see some things that i would change, for one, i don't get this: course_name_from_list.title=$page->title is course_name_from_list a page select? if so you should be able to do course_name_from_list=$page i would also research these selectors: has_parent (=$page for example) $page->children($selector)
    1 point
  15. if ($item->teaserimage) { $thumb = $item->teaserimage->size(480,323); $out .= '<img src="' . $thumb->url . '" alt="' . $item->teaserimage->description . '">'; } $thumb is the size of the image not the image itself. Corrected code above. Edit bullshit: Everything fine in your code except description. Too late yesterday night...
    1 point
  16. This could come in handy, thanks. My only concern is the client's behaviour - they are rarely able to perform such a "complex" operation. For me as a dev perhaps it is easier to copy-paste and edit the source.
    1 point
  17. One way can be to not set an default icon to the template(s) but set it manually like here with other things: https://processwire.com/talk/topic/5609-display-a-template-icon-base-on-date-field/ I use this in a project where I need to show the workflow states and the current authors shortcut. There are used 3 different icons and 3 different colors. public function addHookAfter_ProcessPageListRender_getPageLabel($event) { $page = $event->arguments('page'); if ('aki-faq' == $page->template) { $iconTpl = $iconTpl1 = '<i class="icon fa fa-fw fa-file-text [_STATUS_]"> </i>'; $iconTpl2 = '<i class="icon fa fa-fw fa-check-circle-o [_STATUS_]"> </i>'; $iconTpl3 = '<i class="icon fa fa-fw fa-newspaper-o [_STATUS_]"> </i>'; if ($page->editStatus > 2) $iconTpl = $iconTpl2; if ($page->editStatus > 5) $iconTpl = $iconTpl3; $icon = str_replace('[_STATUS_]', 'editStatus' . $page->editStatus, $iconTpl); $kuerzel = str_pad($page->aki_bearbeiter->kuerzel, 3, ' ', STR_PAD_RIGHT); $bearbeiter = (0 == $page->aki_bearbeiter->id || false === $page->aki_bearbeiter) ? ' <span class="akiPageListItem kuerzel warning">---</span> ' : ' <span class="akiPageListItem kuerzel">' . $kuerzel . '</span> '; $event->return = $icon . $bearbeiter . $event->return; } }
    1 point
  18. At my job I was forced to use Wordpress for a recent project (wasn't my decision of course). We had to use ACF Pro, and let me tell you - in terms of rendering time / flexibility, and performance, ACF is a mess. In a debug report, I found that 2/3 of the performance loss was created by the ACF plugin. Some pages use over 130 queries and take up to 2 seconds to render. The whole WP architecture is just not made for custom-tailored sites, and I still don't agree when some people actually call it a CMS; to me, it's an article management system. (but maybe I digress - there's a big WP thread elsewhere that covers all of that) oh - also.... ACF created a whopping 40k records in the wp_postmeta table. For a relatively small website (local business). wtf?
    1 point
  19. Greetings, Yes, it's true that custom fields is often cited as a top advantage of ProcessWire, and having this capability does make ProcessWire better than most other CMSs right from the start. However, custom fields is just the surface of what makes ProcessWire so special. Honestly, superficially, you can get custom fields with a plugin for WordPress or Joomla or Drupal. But with ProcessWire there's more to it than just creating fields: A crystal-clear API for deep querying of data (your fields) in almost any way you can imagine. It allows you to advance your core knowledge of PHP, then use that knowledge directly. You don't have to learn a weird way to implement PHP (i.e., make use of those fields). The system handles the above two points with impressive speed. There are numerous other advantages to using ProcessWire. These are just a few that are directly related to custom fields. Thanks, Matthew
    1 point
  20. I don't know if you read the documentation for "Allowed Content Rules", but there it states that [] are for attributes, {} for styles and () for classes. Therefore you need to use *[id] to allow id's. You can only allow/disallow specific contents for the style and class attribute. All the other attributes (including id) are either allowed in any form or not. Edit: Your version would allow for this: <a centre="something" gras="green" noir="dark" credit="given">I'm a link</a>
    1 point
  21. Nice one! That makes three of us at least working on calendar modules ...I have been working on one myself but it is not yet ready for public consumption...
    1 point
  22. Updated module today to 1.0.3 with a small fix - where the markup would break if there's not encoded single quotes in title or texts for linkedin and twitter. It's now using htmlspecialchars_decode() and rawurlencode().
    1 point
  23. Why isn't there a option for semicolons as seperators?
    1 point
×
×
  • Create New...