-
Posts
394 -
Joined
-
Last visited
-
Days Won
12
Everything posted by Gadgetto
-
Hello, here is my next question while starting module development in ProcessWire: I have created a new process module skeleton which installs fine. My process module directory looks like this: The problem is, that the .config.php file doesn't seem to be recognized by the installer. The config fields aren't displayed. Here is the code of the ProcessGoodNews.config.php file: class ProcessGoodNewsConfig extends ModuleConfig { public function __construct() { $this->add(array( array( 'name' => 'test', // name of field 'type' => 'text', // type of field (any Inputfield module name) 'label' => $this->_('Test'), // field label 'description' => $this->_('My test description'), 'required' => true, 'value' => $this->_('abc'), // default value ), )); } } I exactly followed the ProcessHello module sample which works as expected. Could it be that the name of my module is the problem? GoodNews (camel case). The .module.php class starts like this: class ProcessGoodNews extends Process { ... .. } Thanks in advance, Martin
-
[SOLVED] Module error (first steps) - what's wrong?
Gadgetto replied to Gadgetto's topic in Module/Plugin Development
Thanks a lot, @bernhard I'll have a look at your hints + I'll for sure come back with more questions. ? As I wrote my GoodNews add-on for MODX I also jumped into cold water and started development immediately. The problem is not so much in the API as in how to do things in ProcessWire. -
[SOLVED] Module error (first steps) - what's wrong?
Gadgetto replied to Gadgetto's topic in Module/Plugin Development
I have now tried to get more information about different module types and when to use what. So, I try to port my MODX add-on - a complete newsletter system with subscriber management and registration. As far as I understand, ProcessWire has "Regular" modules and "Process" modules. Process modules, if I understand correctly, are used to create custom admin areas in the backend. "Regular" modules for all other things, like output in frontend, hooks, services, mail dispatch etc. Therefore I will probably need several different modules to implement my project: 1) Process module for the admin part of the newsletter add-ons (newsletter creation, mailing, subscriber management etc.) 2) Regular modules for mail handling / sending engine etc. 3) Regular modules for subscription forms and user profile editing by subscribers Am I right about that? @bernhard, @teppo, @horst -
[SOLVED] Module error (first steps) - what's wrong?
Gadgetto replied to Gadgetto's topic in Module/Plugin Development
Hello @bernhard ragarding my other post: I'm starting the port of my MODX add-on GoodNews - a integrated group and newsletter mailing system - to Processwire. The add-on will be a full featured app which willl have custom admin pages, modules for sending mails, and so on ... As I'm just scratching the surface of Processwire, I can't say which module types I will need. -
[SOLVED] Module error (first steps) - what's wrong?
Gadgetto replied to Gadgetto's topic in Module/Plugin Development
Is there an overview in which case a module should use which class and which implementation model? Samples: class ProcessWireUpgrade extends Process { // extends Process class Helloworld extends WireData implements Module { // extends WireDate class CustomAdminPage extends Process { // without prefix "Process" class ProcessCustomAdminPage extends Process { // prefixed with "Process" -
[SOLVED] Module error (first steps) - what's wrong?
Gadgetto replied to Gadgetto's topic in Module/Plugin Development
Below is part of the source from the pre-installed Helloworld module which comes with Processwire 3.x: It has no prefixed class name and no prefixed file name. It also extends WireData and implements Module. I built my module exactly like this but it won't work. <?php namespace ProcessWire; /** * ProcessWire 'Hello world' demonstration module * * Demonstrates the Module interface and how to add hooks. * * See README file for further links regarding module development. * * This file is licensed under the MIT license * https://processwire.com/about/license/mit/ * * ProcessWire 3.x, Copyright 2016 by Ryan Cramer * https://processwire.com * */ class Helloworld extends WireData implements Module { /** * getModuleInfo is a module required by all modules to tell ProcessWire about them * * @return array * */ public static function getModuleInfo() { return array( // The module's title, typically a little more descriptive than the class name 'title' => 'Hello World', // version number 'version' => 3, // summary is brief description of what this module is 'summary' => 'An example module used for demonstration purposes.', // Optional URL to more information about the module 'href' => 'https://processwire.com', // singular=true: indicates that only one instance of the module is allowed. // This is usually what you want for modules that attach hooks. 'singular' => true, // autoload=true: indicates the module should be started with ProcessWire. // This is necessary for any modules that attach runtime hooks, otherwise those // hooks won't get attached unless some other code calls the module on it's own. // Note that autoload modules are almost always also 'singular' (seen above). 'autoload' => true, // Optional font-awesome icon name, minus the 'fa-' part 'icon' => 'smile-o', ); } /** * Initialize the module * * ProcessWire calls this when the module is loaded. For 'autoload' modules, this will be called * when ProcessWire's API is ready. As a result, this is a good place to attach hooks. * */ public function init() { // add a hook after the $pages->save, to issue a notice every time a page is saved $this->pages->addHookAfter('save', $this, 'example1'); // add a hook after each page is rendered and modify the output $this->addHookAfter('Page::render', $this, 'example2'); // add a 'hello' method to every page that returns "Hello World" // use "echo $page->hello();" in your template file to display output $this->addHook('Page::hello', $this, 'example3'); // add a 'hello_world' property to every page that returns "Hello [user]" // use "echo $page->hello_world;" in your template file to display output $this->addHookProperty('Page::hello_world', $this, 'example4'); } ..... ... . } -
Porting my MODX add-on to Processwire - basic questions
Gadgetto replied to Gadgetto's topic in Module/Plugin Development
Our sending engine is capable of running multiple parallel send-processes. Therefore the time needed to send out such number of mails can be drastically reduced (of course if your sever can handle the load). I already had a look at the implementation of WireMail. I'll definitely use existing modules as dependencies wherever applicable. -
Porting my MODX add-on to Processwire - basic questions
Gadgetto replied to Gadgetto's topic in Module/Plugin Development
Yes I did read the announcement from Ryan regarding the Mail module. I don’t know what features Ryan’s module will provide (it will be for sure a very pro tool), but we have an extremely strong sending engine with multi-processing which can handle a huge set of mails. We tested with about 100.000 subscribers without any problems. Mailings can be sent in a reasonable time. Plus GoodNews will be free. -
Porting my MODX add-on to Processwire - basic questions
Gadgetto replied to Gadgetto's topic in Module/Plugin Development
My last MODX project was an online shop with newsletter system. Registered shop users could also subscribe to a newsletters. So subscribers being MODX users was a big benefit. Otherwise I’d have to create a subscriber user + a MOX user and combine the data. When a user is logged in into his shop account, he could also edit his newsletter subscriptions. Logged in users could also have access to their newsletters history. -
I followed some sample modules to start my first project. The module installs/uninstalls fine but when I click the module's page I get the following error: Fatal Error: Uncaught TypeError: Argument 1 passed to ProcessWire\ProcessController::getProcessMethodName() must be an instance of ProcessWire\Process, instance of ProcessWire\GoodNews given, called in /Users/mgartner/ProjekteWEB/processwire/wire/core/ProcessController.php on line 324 and defined in /Users/mgartner/ProjekteWEB/processwire/wire/core/ProcessController.php:260 Stack trace: #0 /Users/mgartner/ProjekteWEB/processwire/wire/core/ProcessController.php(324): ProcessWire\ProcessController->getProcessMethodName(Object(ProcessWire\GoodNews)) #1 /Users/mgartner/ProjekteWEB/processwire/wire/core/Wire.php(380): ProcessWire\ProcessController->___execute() #2 /Users/mgartner/ProjekteWEB/processwire/wire/core/WireHooks.php(723): ProcessWire\Wire->_callMethod('___execute', Array) #3 /Users/mgartner/ProjekteWEB/processwire/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\ProcessController), 'execute', Array) #4 /Users/mgartner/ProjekteWEB/processwire/wire/core/admin.php(135): ProcessWire\Wire->__ca (line 260 of /Users/mgartner/ProjekteWEB/processwire/wire/core/ProcessController.php) This error message was shown because: you are logged in as a Superuser. Error has been logged. Here is the full source: <?php namespace ProcessWire; /** * GoodNews module * * An integrated group and newsletter mailing system for Processwire. * * This file is licensed under the MIT license * https://processwire.com/about/license/mit/ * * ProcessWire 3.x, Copyright 2016 by Ryan Cramer * https://processwire.com * */ class GoodNews extends WireData implements Module { const debug = false; const pageName = 'goodnews'; const minVersionPHP = '5.6.37'; /** * Required by all modules to tell ProcessWire about them * * @return array */ public static function getModuleinfo() { return array( // The module's title, typically a little more descriptive than the class name 'title' => 'GoodNews', // A brief description of what this module is 'summary' => 'An integrated group and newsletter mailing system.', // Module version number: use 1 for 0.0.1 or 100 for 1.0.0, and so on 'version' => 1, // Name of module author 'author' => 'Martin Gartner, bitego', // Optional URL to more information about the module 'href' => 'http://modules.processwire.com/goodnews', // singular=true: indicates that only one instance of the module is allowed. // This is usually what you want for modules that attach hooks. //'singular' => true, // autoload=true: indicates the module should be started with ProcessWire. // This is necessary for any modules that attach runtime hooks, otherwise those // hooks won't get attached unless some other code calls the module on it's own. // Note that autoload modules are almost always also 'singular' (seen above). //'autoload' => true, // For more options that you may specify here, see the file: /wire/core/Process.php // and the file: /wire/core/Module.php ); } public function execute() { if (version_compare(PHP_VERSION, self::minVersionPHP) >= 0) { // good } else { $this->error("Please note that your current PHP version (" . PHP_VERSION . ") is not adequate to run this module."); } $out = 'Test'; return $out; } /** * Executed on install */ public function ___install() { // Create the page the module will be assigned to $page = new Page(); $page->template = 'admin'; $page->name = self::pageName; // Installs to the admin main menu $page->parent = $this->pages->get($this->config->adminRootPageID); //->child('name=setup'); $page->process = $this; // Page title is the same as our module title $info = self::getModuleInfo(); $page->title = $info['title']; // Save the page $page->save(); // Tell the user we created this page $this->message("Created Page: {$page->path}"); } /** * Executed on uninstall */ public function ___uninstall() { // Find the page we installed, locating it by the process field (which has the module ID) // It would probably be sufficient just to locate by name, but this is just to be extra sure. $moduleID = $this->modules->getModuleID($this); $page = $this->pages->get("template=admin, process=$moduleID, name=" . self::pageName); if($page->id) { // If we found the page, let the user know and delete it $this->message("Deleting Page: {$page->path}"); $page->delete(); } } } Any hints? Thanks, Martin
-
Hi, I'm starting the port of my MODX add-on GoodNews - a powerful integrated group and newsletter mailing system - to Processwire: http://www.bitego.com/extras/goodnews/ I know I'll have a long and hard way to go... ? In order to plan the basic principles for my module in advance, here is my first question (more will come, that's for sure): GoodNews Subscribers are basically MODX users extended with the necessary meta informations to handle subscriptions and other mailing related stuff. The benefit for a subscriber being a MODX user is that it I also can use the permission system of MODX. How should I handle this in Processwire? Should subscribers also be Processwire users? Or is it better to use a custom user type? How will processwire handle lists of thousands of users? Thanks in advance for your help! Greetings, Martin
-
Detailed changelog for ProcessWire versions?
Gadgetto replied to Gadgetto's topic in General Support
Please don't misunderstand - the blog posts and newsletters that precede or follow an update are brilliant! The problem is, sometimes even small changes could break things. The trigger for my posting was the last update. It wasn't clear if e.g. the .htaccess changes will be applied. If a changelog had been available - best displayed before the update process - this would not have been a problem. So I had to compare the .htaccess first. But I'll follow the processwire/processwire-issues" at Github to keep track of all changes. -
Hi there, is there a detailed changelog for new PW versions other than in the blog post announcing the updates? Or do we have to look into the PW repo on Github to see which changes have been made to the new version? Greets, Martin
-
@jmartsch you are right! -again ... ? Corrected! This was the wrong attachment version. The forum software doesn't make it easy to exchange screenshots or to choose the right attachment.
-
Hey, no one has to apologize for their criticism! I am very grateful for it and have learned something new again! Thanks all for your help! I have revised the tutorial and hope that others can learn something too. Greetings, Martin
-
CKEditor - syntax highlighting in Source and/or Sourcedialog?
Gadgetto replied to Gadgetto's topic in General Support
@szabesz thanks for info! AdminOnStroids seems a bit oversized for just adding a CKEditor plugin? simply too mighty for what I need... ? -
CKEditor - syntax highlighting in Source and/or Sourcedialog?
Gadgetto replied to Gadgetto's topic in General Support
Thanks @dragan and @louisstephens I'll have a look at this plugin! -
Thanks @kongondo, you are one of the first to say something positive! Had only critics so far (probably fair) ... ? Already thought that with my basic knowledge it was a bit too early to write a tutorial. It was more a lesson for myself because I searched the forum on how to implement a language switcher for front-end. The clues I found were all a little unclear and incomplete. Especially the hints about getting the correct ISO code using php conditions although we have the wonderful custom fields to our disposal were not exactly satisfying.
-
As I said, update is on its way...
-
I think he's already involved.
-
Hi @bernhard, I have already an update available for my tutorial, but still can't edit my posts.
-
CKEditor - syntax highlighting in Source and/or Sourcedialog?
Gadgetto replied to Gadgetto's topic in General Support
Here is a screen recording to show what I mean (the WYSIWYG editor is Redactor and the syntax highlighter is Ace)