php Processwire登录注册挂钩
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php Processwire登录注册挂钩相关的知识,希望对你有一定的参考价值。
<?php
// Front End hooks use in _init.php
/**
* LoginRegister Module Hook
*
*/
// load LoginRegister module
$modules->get('LoginRegister')->execute();
// hook into LoginRegister module, disable heading and change button text
$wire->addHookAfter('LoginRegister::buildLoginForm', function($event) {
$form = $event->return;
$form->description = false;
$form->login_submit->value = "Login";
$event->return = $form;
});
// login redirect
$wire->addHookBefore('ProcessLogin::execute', function(HookEvent $event) {
$this->session->redirect('/your-login-page/');
});
// hook into register
$wire->addHookAfter('LoginRegister::buildRegisterForm', function($event) {
//get form
$form = $event->return;
// modify description, set to false to disable it
$form->description = "Register";
// modifu fields
$form->register_first_name->attr('required', '1');
$form->register_last_name->attr('required', '1');
// return form
$event->return = $form;
});
以上是关于php Processwire登录注册挂钩的主要内容,如果未能解决你的问题,请参考以下文章
php Processwire用户挂钩
php Processwire页面保存挂钩
php Processwire CKE编辑器挂钩
php Processwire用户登录
php 更改实现挂钩的模块的注册表。
php Processwire clean-files.php