-
Posts
991 -
Joined
-
Last visited
-
Days Won
3
PWaddict last won the day on May 1
PWaddict had the most liked content!
Profile Information
-
Gender
Not Telling
Recent Profile Visitors
5,888 profile views
PWaddict's Achievements

Hero Member (6/6)
483
Reputation
-
[SOLVED] Creating user from api causes a weird issue
PWaddict replied to PWaddict's topic in General Support
Ok found why this is happening. The code is fine as I was I able to create a user from a different template and there was no problem. I'm creating a user when order through Padloper (v1) is completed. Few days ago I've renamed the page name "padloper" from the related admin page that displays the orders and since that name is hardcoded on Padloper module that's why I was getting that weird issue. -
[SOLVED] Creating user from api causes a weird issue
PWaddict replied to PWaddict's topic in General Support
It's on localhost with ProcessWire 3.0.251 and PHP 8.3.9. I've imported yesterday's db backup and the problem is gone. I did 2 things today, creating a custom process module and creating a user from api. The module doesn't cause any issue so I repeated the process of creating a user from the api and it seems that is causing the issue. Why the following code is causing that weird issue??? // Check if order is paid if($order->pad_paid) { // Save new user if($user->isGuest()) { $u = $users->add($order->email); $u->email = $order->email; $u->pass = $order->pass; $u->ip_address = $order->pad_ip_address; $u->addRole("login-register"); $u->save(); // Save user to the order page $order->setAndSave([ 'pad_user' => $u->id ]); } } -
Hello! I'm suddenly getting the following error on my first login to admin, when installing/uninstalling a module and when checking for new module updates through ProcessWireUpgrade module. PHP Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in C:\laragon\www\mysite\wire\core\LanguageFunctions.php on line 232 The line 232 of wire\core\LanguageFunctions.php has this: if($encode) $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8', $encode === true); And when this error happens, the main admin menu links Pages, Setup, Modules, Access are gone. EDIT: The following code on my template for creating user is causing that weird issue: // Check if order is paid if($order->pad_paid) { // Save new user if($user->isGuest()) { $u = $users->add($order->email); $u->email = $order->email; $u->pass = $order->pass; $u->ip_address = $order->pad_ip_address; $u->addRole("login-register"); $u->save(); // Save user to the order page $order->setAndSave([ 'pad_user' => $u->id ]); } }
-
@ryan @diogo @jploch are you planning to upgrade also the font awesome icons? They haven't been upgraded for over a decade... Few days ago the v7 was released. Last year I've created a module that upgrades backend with the latest Font Awesome free icons (solid + brands) but I think a core upgrade would be much better integration.
- 178 replies
-
- 11
-
-
Btw, if there are modules or hooks that send only plain text emails like for example some notifications on LoginRegisterPro with the following hook you can force HTML on all outgoing emails and forget about those ugly emails 😎 /** * Force HTML on all outgoing emails * */ $wire->addHookBefore('WireMail::send', function(HookEvent $event) { $wireMail = $event->object; if($wireMail->body && !$wireMail->bodyHTML) { $forceHTML = nl2br($wireMail->body); // nl2br — Inserts HTML line breaks before all newlines in a string $wireMail->bodyHTML($forceHTML); } }); I guess this can get combined with your hook but for now I'm using it as separate.
-
Thank you @bernhard for this! What if I have a LazyCron hook to send emails about expirations and want to display a call to action button on those? Should I create the button on a .mjml file then convert it to html and copy ONLY the HTML part of the button and paste it on BodyHTML of the LazyCron hook or there is a better way?
-
Here is the solution. First, on the checkbox field (let's call it terms_privacy_checkbox) settings leave empty the "Checkbox label". On the field "Label" you can either write something for example "Terms - Privacy Policy" or leave empty (it will output field name) doesn't matter cause we gonna remove it with the following hook. $wire->addHookAfter('Page::render', function(HookEvent $event) { if($this->wire('page')->template->name != 'checkout') return; $event->return = str_replace("<span class='pw-no-select'>Terms - Privacy Policy</span>","", $event->return); }); Then with the following hook where we customize our form we can change the markup for the checkbox field too and split it to 2 divs using for example UIkit. $wire->addHookBefore('InputfieldWrapper::render', function($event) { if ($this->wire('page')->template->name != "checkout") return; $wrapper = $event->object; $terms = wire('pages')->get("template=terms"); $privacy = wire('pages')->get("template=privacy"); $defaultMarkup = array( // Check wire\core\InputfieldWrapper.php for the $defaultMarkup 'list' => "<ul {attrs}>{out}</ul>", 'item' => "<li {attrs}>{out}</li>", 'item_label' => "<label class='InputfieldHeader ui-widget-header{class}' for='{for}'>{out}</label>", 'item_label_hidden' => "<label class='InputfieldHeader InputfieldHeaderHidden ui-widget-header{class}'><span>{out}</span></label>", 'item_content' => "<div class='InputfieldContent ui-widget-content{class}'>{out}</div>", 'item_error' => "<p class='InputfieldError ui-state-error'><i class='fa fa-fw fa-flash'></i><span>{out}</span></p>", 'item_description' => "<p class='description'>{out}</p>", 'item_head' => "<h2>{out}</h2>", 'item_notes' => "<p class='notes'>{out}</p>", 'item_detail' => "<p class='detail'>{out}</p>", 'item_icon' => "<i class='fa fa-fw fa-{name}'></i> ", 'item_toggle' => "<i class='toggle-icon fa fa-fw fa-angle-down' data-to='fa-angle-down fa-angle-right'></i>", // ALSO: // InputfieldAnything => array(any of the properties above to override on a per-Inputfield basis) // Here we override the default markup for checkbox field by targeting it's name 'name=terms_privacy_checkbox' => [ 'item_label' => "", 'item_label_hidden' => "", 'item_content' => " <div class='uk-grid-collapse{class}' uk-grid> <div class='uk-width-auto'> {out} </div> <div class='uk-width-expand'> <label class='uk-form-label' for='Inputfield_terms_privacy_checkbox'> <span class='uk-text-normal'>I agree with the <a href='{$terms->url}' rel='noopener' target='_blank'>{$terms->title}</a> and the <a href='{$privacy->url}' rel='noopener' target='_blank'>{$privacy->title}</a>.</span> </label> </div> {error} </div>", ], ); $defaultClasses = array( // Check wire\core\InputfieldWrapper.php for the $defaultClasses 'form' => '', // additional clases for InputfieldForm (optional) 'list' => 'Inputfields', 'list_clearfix' => 'ui-helper-clearfix', 'item' => 'Inputfield {class} Inputfield_{name} ui-widget', 'item_label' => '', // additional classes for InputfieldHeader (optional) 'item_content' => '', // additional classes for InputfieldContent (optional) 'item_required' => 'InputfieldStateRequired', // class is for Inputfield 'item_error' => 'ui-state-error InputfieldStateError', // note: not the same as markup[item_error], class is for Inputfield 'item_collapsed' => 'InputfieldStateCollapsed', 'item_column_width' => 'InputfieldColumnWidth', 'item_column_width_first' => 'InputfieldColumnWidthFirst', 'item_show_if' => 'InputfieldStateShowIf', 'item_required_if' => 'InputfieldStateRequiredIf' // ALSO: // InputfieldAnything => array(any of the properties above to override on a per-Inputfield basis) ); $wrapper->setMarkup($defaultMarkup); $wrapper->setClasses($defaultClasses); foreach ($wrapper->children as $in) { switch ($in->name) { case 'email': $in->wrapAttr('class', 'uk-width-1-1'); $in->addClass('uk-input'); $in->attr('required', 'required'); break; case 'pad_paymentmodule': $in->wrapAttr('class', 'uk-width-1-1 uk-margin-small-top'); $in->addClass('uk-radio'); break; case 'terms_privacy_checkbox': $in->wrapAttr('class', 'uk-width-1-1'); $in->addClass('uk-checkbox'); $in->attr('required', 'required'); break; case 'customerForm': $in->wrapAttr('class', 'uk-width-1-1 uk-margin-medium-top'); $in->addClass('uk-button uk-button-primary uk-button-large'); break; default: $in->wrapAttr('class', 'uk-width-1-1'); $in->addClass('uk-width-1-1'); break; } } });
-
Anyone knows how to split the checkbox's input and label in 2 divs with Inputfield Markup to look like in the following screenshot? I'm using UIkit so this can be achieved like below but I can't figured out how to do this with Inputfield Markup. <div class="uk-grid-small" uk-grid> <div class="uk-width-auto"> <input id="checkbox" class="uk-checkbox" type="checkbox"> </div> <div class="uk-width-expand"> <label for="checkbox">Checkbox Label</label> </div> </div>
-
Hello @Mikel I'm testing the module and noticed 2 issues. I'm getting the following Warning x2 times when viewing the User Data Table page: Warning: Attempt to read property "type" on null in C:\laragon\www\mysite\site\modules\ProcessUserDataTable\ProcessUserDataTable.module on line 595 The Settings link on User Data Table page is broken as it has a hardcoded admin page name as "cms".
-
@ryan On ProcessWireUpgradeCheck module I'm getting a 500 Internal Server Error and I can ONLY see the updates for the PW dev and master version. No info about the 3rd-party modules.