-
Posts
807 -
Joined
-
Last visited
-
Days Won
10
Everything posted by kixe
-
welcome dsdb, some values are selected but not all? in this case check if each value of the column you have choosen for your option values is unique. If not, some options will be overwritten by the preceding same option value. If this doesn't help, could you please post a part or example of your source database table? and or a screenshot of your field? Which settings did you choose?
-
After running in problems I made some changes in my derivation and I would recommend to do it in yours too. Function format() is deprecated and should be replaced by formatValue(). Especially since TextformatterImageTags uses values from another field of the same page this is very useful. Look at the following example Example: A field using the textformatter are called by the parent page. Assuming you want to get the images of the child and not the parent, textformatter needs to know which page is meant. // template $imagetags = $modules->get('TextformatterImageTags'); foreach ($page->children as $child) { $value = $child->textfield; $imagetags->formatValue($child,$fields->get('name=textfield'),$value); // ... other stuff }
-
To prevent an overflow in the modules directory I will not release it there. If somebody is interested in the module it can be downloaded from this thread. I made the changes to double brackets, because it happens sometimes that I use single brackets in the text, but never double. And I found that square brackets are looking more like an image frame. Have a look in the readme the syntax in my module is slightly different too.
-
@BernhardB and nfil ProcessPageDelete Module works in 2.6. You can configure it to delete pages directly by the green button. (to be confirmed - javascript). The permission could be added to any user. Another solution is to just use trashing option in combination with CronjobEmptyTrash Module which delete trashed pages permantly after a configurable time period.
- 12 replies
-
- 1
-
-
- trash icon
- delete page
-
(and 1 more)
Tagged with:
-
it is already activated under the following conditions: not available for 'home' ($page->id == 1) not available for 'admin' ($page->template == 'admin') page editable status is needed to show lock/unlock current user needs page-lock permission trash/restore button only available for superuser functionality disabled in demo mode If you like to have a deeper view have a look in the script: /wire/modules/Process/ProcessPageList/ProcessPageListActions.php
-
No it is not in the modules directory. Read here: https://processwire.com/talk/topic/8508-page-status-toggler/?p=82345 By the way there exists a built-in functionality, which makes my and the modules of geniestreiche obsolete. if you still want to use it you can download it by clicking the link in the first post. It should work with the newest PW releases.
-
I am not sure if the following will fit your needs. I wrote a module to subscribe/ unsubscribe from mailchimp using a checkbox in the users template + updating mailchimp if the email address has changed. User profile is provided in frontend. All changings are logged by the module. Here the snippet of the template. function hookAfterSave($event) { $modules = wire('modules'); $user = wire('users')->getCurrentUser(); if ($event->arguments('what') == 'newsletter') { if ($event->arguments('new') == 1) $modules->get('ProcessMailchimp')->subscribe($user->email,false); else $modules->get('ProcessMailchimp')->unsubscribe($user->email); } if ($event->arguments('what') == 'email') { if ($event->arguments('old') != $event->arguments('new') && $user->newsletter) $modules->get('ProcessMailchimp')->update($event->arguments('old'),$event->arguments('new')); } } And the module (running on pw 2.5.29, not tested in 2.6 latest devs) ProcessMailchimp.zip
-
$value = trim(preg_replace('/\s+/', ' ', $value)); I use this in some contact forms. Converts all single, multiple or mixed spaces, tabs, linefeeds and carriage-returns in a single space.
-
How to change output markup of images added by editor
kixe replied to Juergen's topic in General Support
Since I am visiting the forum quite unregularly, here a late solution: TextformatterImageTags module by Diogo with class option added. -
Since there are existing many other methods to add images (Markdown, Diogos Textformatter-image-field-markup , CK Editor ...) I am still using this module. I updated my customized version, which is available here. I made the module configurable to define a markup wrapper and/or basic CSS classe/s @Diogo I didn't put it in the modules directory until now. What do you think about merging our stuff? TextformatterImageTags.zip
-
Processwire does provide to add 'page-edit-created' permission. See instructions below (PagePermissions.module is a core module Installed by default) /* Optional special permissions that are optional (by default, not installed): * * 1. page-publish: when installed, editable() returns false, when it would otherwise return true, * on published pages, if user doesn't have page-publish permission in their roles. * * 2. page-edit-created: when installed, editable() returns false, when it would otherwise * return true, if user's role has this permission and they are not the $page->createdUser. * This is a permission that reduces access rather than increasing it. Note that * page-edit-created does nothing if the user doesn't have page-edit permission. * * 3. page-rename: when installed, user must have this permission in their role before they * can change the name of a published page. They can still change the name of an unpublished * page. When not installed, this permission falls back to page-edit. * * 4. page-edit-lang-default: when installed on a multi-language site, user must have this * permission in order edit multi-language fields in "default" language. This permission * is also required to create or delete pages (if user already has other permissions that enable * them to create or delete pages). * * 5. page-edit-lang-[language_name]: when installed on a multi-language site, user must have * this permission to edit multi-language fields in the [language_name] language. * * 6. page-edit-lang-none: when installed on a multi-language site, user must have this * permission to edit non-multi-language fields. They must also have it to create or delete * pages (if user already has other permissions that enable that). * * 7. user-admin-all: when installed, a user must have this permission in order to edit other * users of all roles (except superuser of course). When installed, the regular user-admin * permission only acts as a pre-requisite for editing users, and enables only listing users, * and editing users that have only the 'guest' role. The user-admin-all essentially grants * the same thing as user-admin permission does on a system that has no user-admin-all * permission installed. That's what it does, but why is it here? The entire purpose is to * support user-admin-[role] permissions, as described in the next item below: * * 8. user-admin-[role_name]: when installed on a site that also has user-admin-all permission * installed, a user must have this permission (along with user-admin permission) in order * to edit users in role [role_name], or to grant that role to other guest users, or to * revoke it from them. Think of this permission as granting a user administrative privileges * to just a specific group of users. Note that there would be no reason to combine this * permission with the user-admin-all permission, as user-admin-all permission grants admin * privileges to all roles. * */
-
The module doesn't work with latest PW Version. Please update or remove from directory.
-
@adrian sorry I didn't read all posts of the topic. I fixed the issue in a german translation. There is also a currency missing. ZMK Zambian Kwacha is not in use anymore. It was replaced by ZMW in 2013 (1000:1). Possible to keep ZMK but ZMW should be added.
-
If somebody needs this too. I wrote a Module Fieldtype InputfieldSelect suitable to ServiceCurrencyConversion. It stores the 3-letter code and returns a multiple array value of all corresponding exchange rates. array( 'code' => EUR // selected value 'name' => 'Euros', 'symbol' => '€', 'x' => [USD exhcange rate], 'updated' => 2015-01-14-14:45, 'AED' => array( 'name' => 'UAE Dirham', 'symbol' => '', 'x' => [EUR exchange rate], // source = selected value 'amount' => [your amount in UAE Dirham] ), '[currency code]' => array( ...and so on... ), .. and so on... ); There is a small issue in the currencies.txt file. Module cannot handle double entries like: UYU UYI Peso Uruguayo Uruguay Peso en Unidades Indexadas $U this should be changed to UYU Peso Uruguayo $U UYI Uruguay Peso en Unidades Indexadas Other solution is to make the module able to handle this. Here comes the FieldtypeSelectCurrency. Have fun FieldtypeSelectCurrency.module
-
@teppo I couldn't reproduce this using pw 2.6.10 and Modules Version 1.1.2. The sleep value is always an integer. In the field settings you can only select integer columns with unique values to populate the option values of your selectfield. Could you tell me some more details to reproduce your problem. Maybe an example of your database table (column settings) you took to populate the selectable options and field settings too? Thanks.
-
My developers profile is not editable. Uploaded image not displayed. Any chance to get access to edit area, to see the image within a reasonable timescale? Thanks ...
-
[Solved] Unable to save data in custom field on user profiles
kixe replied to ragnarokkr's topic in General Support
Since a while I notice a problem close to yours. It happens just in case of superuser. Adding some custom fields to the user template results in inability to change the values via Admin->Access->Users as loggedin Superuser (id=41). It works with ProcessProfile. After changing values of a specific field one time in Profile it becomes possible via Admin->Access->Users too. Editing other profiles works all the time. Couldn't find the cause. Edit: 5.07.15 Allowance to edit user fields of the current user is based on the cofiguration in Module settings of ProcessProfile. If you have unchecked a field, you can't edit this field. This is default for custom fields. Change the settings in the module to give edit permission for these fields.- 2 replies
-
- 3
-
-
- custom field
- image
-
(and 2 more)
Tagged with:
-
Fatal Error Page created via API if Template has Filefield
kixe replied to kixe's topic in General Support
I made many changes to the module. savePage method is different in my module. It is working proper with last PW Versions, even with new fields like ProfieldsTable or so. I don't want to render an image or file before page is saved. I know that an id is needed to create the assets-folder. Filefield is not rendered before page is saved. I excluded the field by skipping it in the render method. But no success. If it is part of the template the error occurs anyway. Found a solution by adding a hook to the render method in the module in case of new page. // prevent error if fieldtype file or image is assigned and page has id = 0 $this->addHookBefore('PagefilesManager::path', function ($e) {$e->replace = true;$e->return = null;}); -
Fatal Error Page created via API if Template has Filefield
kixe replied to kixe's topic in General Support
I use a module FormProcessor which is a derivation of Ryans FormTemplateProcessor. This module initialize a page instance, assign a specific template to it. Then a form based on this template will be rendered in frontend. The page will be saved AFTER submission and validation. The problem is the render of the file inputfield if empty and with a page->id = 0, which is default for new page instances (unsaved pages). I am getting the error in the frontendform template. init() and set() method of module /** * Initialize a web form * * */ public function init() { // create a page for holding form fields $this->page = new Page(); $this->page->id = 0; // Template to use for the form fields (required). // must be a Template object, it will be assigned to $this->page. $this->set('template', null); // Optional E-Mail address that form will get submitted to $this->set('email', ''); // E-Mail sender $this->set('fromEmail', 'noreply@example.org'); // Array of field names that are required to complete the submission // if not specified, it will use the admin field settings. $this->set('requiredFields', array()); // Array of field names that should be skipped when drawing AND processing the form, blacklist $this->set('skipFields', array('title')); // Array of field names that will be added to the form when drawing AND processing the form // whitelist. If empty all fields are added $this->set('showFields', array()); // Associated Array of fieldnames and values that should be skipped when drawing the form but will be processed if set via API in the form-template file. Set $fieldname => $value // $form->hiddenFields = array('myHiddenFieldKey'=>'myHiddenFieldValue'); $this->set('hiddenFields', array()); // Subject of the email that will be sent $this->set('emailSubject', 'Web Form Submission'); // Optional parent for the page. // If ommited, the page will not be saved to the DB. $this->set('parent', null); // Status of page which stores submitted form data $this->set('status', 2048); //default unpublished // message output upon successful completion of the form. You have access to all submitted values to use them with sprintf() $this->set('successMessage', 'Thank you, your submission has been sent!'); // field from where the page name is taken $this->set('nameField', null); // submit field name and value $this->set('submitValue', 'submit'); // set to true if email is sent and to page->id if page->save() // also hookable method success() $this->set('success', false); } /** * Set properties to our Page Instance * */ public function set($key, $value) { if($key == 'parent' && $value) { if(!$value instanceof Page) throw new WireException('Parent must be a Page object'); $this->page->parent = $value; } else if($key == 'template' && $value) { if(!$value instanceof Template) throw new WireException('Template must be a Template object'); $this->page->template = $value; } return parent::set($key, $value); } // .... -
Fatal Error Page created via API if Template has Filefield
kixe replied to kixe's topic in General Support
Yes I have read this, but it should be possible to instantiate a page and assign a template to this page, without getting errors. I don't want to access or save any files at the moment. It works proper with all the other fieldtypes. -
Pages are created via API. The assigned template has an Image- or Filefield. PagefilesManager path() method throws Exception if page->id is 0 (which is default in case of instantiation of new Page object). Any ideas for a workaround? For now I changed path() method in PagefilesManager Class. Not sure if this is a good idea ... /** * Get the published path (for use with hooks) * */ public function ___path() { if(is_null($this->path)) { // if(!$this->page->id) throw new WireException("New page '{$this->page->url}' must be saved before files can be accessed from it"); // replacement if($this->page->id === null) throw new WireException("New page '{$this->page->url}' must be saved before files can be accessed from it"); $this->path = self::_path($this->page); } return $this->path; } Error: Exception: New page '/admin/access/users//' must be saved before files can be accessed from it (in [...]/wire/core/PagefilesManager.php line 262) #0 [...]/dev/wire/core/PagefilesManager.php(253): PagefilesManager->___path() #1 [...]/dev/wire/core/PagefilesManager.php(213): PagefilesManager->path() #2 [...]/dev/wire/core/PagefilesManager.php(67): PagefilesManager->createPath() #3 [...]/dev/wire/core/PagefilesManager.php(55): PagefilesManager->init(Object(Page)) #4 [...]/dev/wire/core/Page.php(1921): PagefilesManager->__construct(Object(Page)) #5 [...]/dev/wire/core/Pagefiles.php(74): Page->filesManager() #6 [...]/wire/core/Pagefiles.php(58): Pagefiles->setPage(Object(Page)) #7 [...]/dev/wire/modules/Fieldtype/FieldtypeImage.module(33): Pagefiles->__construct(Object(Page)) #8 [...]/dev/wire/core/Fieldtype.php(479): FieldtypeImage->getBlankValue(Object(Pag Opened an issue here: https://github.com/ryancramerdesign/ProcessWire/issues/1259
-
Imagefild NULL when call from function for current page.
kixe replied to kater's topic in General Support
Corrected my last post. Sorry for this. I tried your code and everything is working like expected using single image. Please check the following: Selectorstring teaser=1 needs field 'teaser' having int value = 1 If you use image arrays you need to use WireArray Api // will match first image of array if ($item->teaserimage) { $thumb = $item->teaserimage->first()->size(480,323); $out .= '<img src="' . $thumb->url . '" alt="' . $thumb->description . '">'; } // will match 4th image in array if ($item->teaserimage) { $thumb = $item->teaserimage->eq(3)->size(480,323); $out .= '<img src="' . $thumb->url . '" alt="' . $thumb->description . '">'; } // will match last image in array if ($item->teaserimage) { $thumb = $item->teaserimage->last(3)->size(480,323); $out .= '<img src="' . $thumb->url . '" alt="' . $thumb->description . '">'; } More about WireArrays: https://processwire.com/api/arrays/ -
Imagefild NULL when call from function for current page.
kixe replied to kater's topic in General Support
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... -
How long does it take to review profiles in developers directory? Cannot find my profile, want to edit ...
-
While testing your module I found out that it doesn't work properly in some cases: //no need to obfuscate, since there is no E-Mail Adress <a href="mailto:?subject=Lorem%20Ipsum&body=Lorem%20Ipsum!">Foo</a> <a href="mailto:?subject=Lorem Ipsum!">Foo</a> //doesn't work with the following examples <a href="mailto:mail@example.org?subject=Lorem Ipsum!">Foo</a> <a href="mailto:mail@example.org?subject=Lorem%20Ipsum&body=Lorem%20Ipsum!">Foo</a> For the 1st Example the module should leave the code untouched. Replacement only necessary if '@' is found. For 2nd Example I can offer a solution REPLACE // urlencode a possible subject $matches[1] = preg_replace_callback("!(.*\?(subject|body)=)([^\?]*)!i", function ($m) { return rawurlencode($m[3]); }, $matches[1]); // the function removes the questionmark, the words 'subject' and 'body' and the equalsign from the querystring WITH // urlencode a possible subject and body, no matter if already urlencoded $_matches = preg_replace_callback("!(^\?*)?((\??subject|\??body)=([^&]+)){1,2}!i", function ($m) { return $m[1].$m[3].'='.rawurlencode(rawurldecode($m[4])); }, $matches[1]); I tested a little bit and it worked well with my solution.