Jump to content


  • Posts

  • Joined

  • Last visited

Posts posted by valan

  1. I'd like to create custom ajax-driven inputfield. Ajax-driven inpufields where introduced here: http://processwire.com/blog/posts/new-ajax-driven-inputs-conditional-hooks-template-family-settings-and-more/#new-ajax-driven-inputfields-system-wide, but since that time I haven't seen any "how-to" tutorials. I'd like to learn from core code, but can't understand which files to check.

    Can someone suggest which core/module files I have to check in order to learn from code and be able to create custom ajax-driven inputfields?


    • Like 1
  2. This issue appeared after upgrade from 2.7.2 to 2.8.35

    There are two hooks:

    - One triggers on ProcessPageEdit::buildFormContent where I add custom fields, e.g. like $form->insertBefore($virtualfield, $realfield);.

    - Another triggers on saveReady where I get and process values entered in these 'virtual' fields (e.g. $page->virtualfield).

    Before upgrade it worked. After upgrade, my custom 'virtual' fields are always empty in saveReady hook.

    Please advice what could be a reason and how to fix it.

  3. That was legacy... Changed code to to static, error disappeared. Getting now another error in ProDrafts module. It says "Class 'ProDrafts' not found in /var/www/pw/mechanics/modules/ProDrafts/ProcessProDrafts.module:28". It's here:

        public static function getModuleInfo() {
            return array(
                'title' => 'ProDrafts',
                'version' => 2,
                'summary' => 'List, manage and compare draft pages.',
                'icon' => ProDrafts::defaultIcon, // error here

    Edit: issue is fixed by reinstalling the module.

  4. I'm upgrading from 2.7.2 to 2.8.35

    As usual I've replaced /wire and index.php, but this time upgrade failed.

    During bootstrap system generates "Call to a member function get() on null" on this code in my custom module

    class ProcessCustom extends Process {
        public static function getModuleInfo() {
            $permission = wire('permissions')->get(self::someId); // error occures here

    I have few thoughts:

    - either wire('permissions') is not supported in 2.8.35

    - or error caused by index.php which significantly changed. In 2.7.2 I've used index.config.php (multi-domain config) and now I'm not sure that bootstrap uses it...

    Please advice where could be a source of the problem. 

  5. 28 minutes ago, Robin S said:

    There's no such setting is there? I think you mean "Blank and 0 have different meanings", which doesn't promise anything about blank and null being treated differently. I guess PW treats these as equivalent, which explains issue 2 also.

    Yes, Blank and 0 have different meaning. I guess Blank for float = Null. Anyway, hiding field if it's value is null is not expected behavior I think.

  6. There is FieldtypeFleat field "my_float_field" with setting "Blank and Null have different meanings". I have few (strange) issues with it.

    (1) Issue number 1

    When I want to store null in this field, it doesn't save (or return) null. I want to get null back when I save null and 0 when I save integer 0. What's wrong here?

    $value = null;
    echo 'Type=' . gettype($value) . ' Value=' . print_r($value, true));
    $page->setAndSave('my_float_field', $value);
    echo 'Type=' . gettype($page->my_float_field) . ' Value=' . print_r($page->my_float_field, true));
    echo 'Type=' . gettype($page->my_float_field) . ' Value=' . print_r($page->getUnformatted('my_float_field'), true));
    // Result:
    Type=NULL Value =
    Type=double Value = 0
    Type=double Value = 0

    (2) Issue number 2

    This field has Visibility=Open+Closed when blank+Locked

    If I save null in this field, it disappearas from page edit admin. If there is some value - it shows it normally... If I change setting "Blank and Null have different meanings" to "... equivalent" it also does not help. This looks like either bug or some db issue. I've checked field settings in db and didn't find any strange things there... so tend to think that it is bug. Or I don't understand smth... Please help.



  7. I guess this question has been already addressed in some thread(s), but I fail to find complete answer, so posting it here.

    I know 3 options of accessing API variables from Wire-derived class (see below).

    Can someone give an in-depth/developer level answer on their relative performance difference and possible limitations (cases when one of these versions might not work as expected - may be PW3 multi-instance related or may be some hook-related issues, etc). 

    1. $this->pages
    2. $this->wire('pages')
    3. wire(pages)


  8. Today I've experienced interface issue - input fields were hidden (address, etc). After some inspection, I found that reason was in css - map has changed its relative position. I guess Google has changed smth in script that draws map as there were no changes in css locally. Do you have the same issue?

    To fix the issue I had to add custom style clear tag to InputfieldMapMarker.module

    line 161            "style='height: {$height}px;clear:left;' " .


    • Like 6
  9. I'm developing single-page application (SPA) which interacts with PW site only with help of ajax post/get calls to custom site API.

    Initially guest (non-loggeding) user opens page with SPA. Then he logins via ajax call to custom API (requests key, supplying email and pass) and as soon as key is available, makes other ajax calls to custom API with this key. e.g. update own email, phone, etc.

    Instead of developing custom authorization system, I'd like to use PW built-in authorization. So, my questions are:

    1. How to generate key which PW uses to set cookie that is uses to identify session/logged-in user. I guess in my custom API login handler I should create new user session and return some token/key? E.g. how to do that using PW API?

    2. Assumed SPA got this key and makes next ajax request to API with this key included in query - how to authorize request / identify user with help of PW API?

    In sum - I need some guidance on PW API authorization methods that may help me to enable user authorization and access control in custom API from SPA ajax calls.

    • Like 2
  10. 1. Is PW 3.x compatible with PHP 7?

    2. Would you recommend PW 3.0.18+ in production? E.g. is it too "dev" or already "prd"?)

    3. Any known PW-related issues with migration from myisam to innodb?

    4. Pros/cons of switching to nginx + mysql + php-fpm? (apart of lack of support, e.g. need to maintain config manually with each upgrade)

    P.S. Currently site is running on PW 2.7.2, MySQL 5.6.29, db by default myisam, PHP5.5, Apache 2.2.22, OS Debian 7

  11. Few days ago I've discovered that some specific template pages can't be opened in admin page edit. Browser returns HTTP ERROR 500.

    At the same time it looks like all these pages are accessible from API, and there is Lister that correctly shows all pages with this template.

    I've debugged down to core and found that script fails in ProcessPageEdit.module at 220 line: $out .= $this->form->render()

    My PW core knowledge is not enough to dig further so I need help to find root cause and fix problem. Thanks for any advice.

    PW 2.7.2, PHP 5.5

  12. to @Ryan and dev team.

    It has happened that I've started development of notification system for users and found that there is already SystemNotifications module and related classes in core. Before development of own bicycle I've decided to check if it is required) and/or use a chance to add few wishes at moment when this module is under development.

    Please could you share thoughts/plans on the following:

    1. currently flags in Notification are protected static. It limits possibilities to extend class by adding custom flags and handlers for these flags in FieldtypeNotifications. For example, notification flags for SMS or messengers, like Telegram. They can (and probably should) be handled in FieldtypeNotifications in the same manner as emails. At my site I use both SMS and Telegram notifications. Also, I think preferred notification methods should be set by (or for) user.

    2. emails (as well as other "contacts" like cellphone number for SMS, etc) could be taken from different user fields, depending on some condition. In my system for example, sales managers roles need to get internal emails to corporate emails while being users, they get emails from system email field. E.g. "contact fields" should be customizable and/or hookable.

    3. currently notifications are removed as soon as user closes them. There could be notifications that require action(s) (e.g. changes at some page); while these actions are not performed, notification should remain. E.g. it is some form of "todo" notification controlled by the system. Also there could be actions which can not be controlled by system, e.g. user should either confirm "done" or "cancel" or "postpone" them manually. Do you consider such "to-do" notifications as something that should be developed separately OR you think that they may be realized in the scope of SystemNotifications? 

    4. currently at UI level notifications are injected through predefined core js/css and predefined admin DOM structure. This limits possibilities to make notifications UI different. For example, I'd prefer to give my users "Facebook style" icon & attached notifications menu. Is it possible to leave hooks and/or module config params that opens a space for js/css replacement/adjustment and possibly more admin DOM extras (like adding menu items)?

    Thank you!

    • Like 7
  13. Failed to switch to Reno. After installation - no any changes, the same default theme. Uninstalled/cleared cache/reinstalled - same(=no) result.

    PW 2.7 PHP 5.5

    EDIT: Well, it works. Occasionally found that theme should be set in user settings. I'd suggest to drop few words about user settings in module config.

  14. How to fix admin header (e.g. where menu is) on top of the page, making it unscrollable?

    Admin menu is one of most frequently used elements of UI at my site, so original header scrollability is a bit annoying.

    It would also be better for notifications behavior as currently it breaks workflow by scrolling to the top as new notification event occurs.

    • Like 1
  15. It should return array [user_id => [order_id1, order_id2, ...], ...] where both users and order pages should be initially (but in the same query) filtered based on some PW $users_selector and $orders_selector. Each order page has field $order_user (e.g. it links order and user). How SQL query should look like? After few hours of own experiments I probably need help to combine SQL and PW selectors. Thanks!

  • Create New...