[wordpress插件] Custom WP Registration Form自定义WP注册表格

wordpress 插件 文章 2020-04-10 09:40 447 0 全屏看文

AI助手支持GPT4.0

评分
0
描述

Create a custom user registration form with an associative array.

使用关联数组创建自定义用户注册表单。

Use HTML form element attributes as array keys to create a form.

使用HTML表单元素属性作为数组键来创建表单。

Any custom array values are automatically added to new area of a user’s profile page in the WordPress admin.

所有自定义数组值都会自动添加到WordPress管理员中用户个人资料页面的新区域。

Arrays containing values that match WordPress user meta syntax will have those input values automatically added to those premade values in the default WordPress profile page.

包含与WordPress用户元语法匹配的值的数组将把这些输入值自动添加到默认WordPress配置文件页面中的那些预制值中。

Custom WP Registration Form comes with built in security and validation such as wp_nonce_field verification and spam honey pot.

自定义WP注册表格带有内置的安全性和验证功能,例如wp_nonce_field验证和垃圾邮件蜜罐。

It also automatically escapes attributes and html outputs and sanitizes user input values.

它还会自动转义属性和html输出并清除用户输入值。

User must create a “CWRF Form” array.

用户必须创建“ CWRF表单”数组。

This array will need to be passed as an argument to the a new ‘CWRF_Form’ object.

该数组将需要作为参数传递给新的“ CWRF_Form”对象。

The CWRF Form array can currently take HTML form types: text, email, file, radio, select, and textarea as values to the key ‘type’.

CWRF表单数组当前可以采用HTML表单类型:文本,电子邮件,文件,单选,选择和文本区域作为键“类型”的值。

More coming soon… also, I always welcome pull requests.

即将推出更多……我也总是欢迎请求请求。

Development of this plugin is done on GitHub.

该插件的开发在GitHub上 完成。

Pull requests welcome.

拉请求欢迎。

Please see issues reported there before going to the plugin forum.

在进入插件论坛之前,请参阅此处报告的问题

>

>

安装步骤

    1. Upload the plugin files to the /wp-content/plugins/custom-wp-registration-form directory, or install the plugin through the WordPress plugins screen directly.
    2. 将插件文件上传到 / wp-content / plugins / custom-wp-registration-form 目录,或直接通过WordPress插件屏幕安装插件。

    3. Activate the plugin through the ‘Plugins’ screen in WordPress
    4. 通过WordPress中的“插件”屏幕激活插件

    5. Create a form object in a .php file where you would like the form to appear.

      在.php文件中创建一个表单对象,您希望在其中显示表单。

      Example: page-register.php

      示例:page-register.php

      A. the CWRF_Form object takes three arguments
          

      A. CWRF_Form对象带有三个参数
          

      1. string $form_name – default is “”.
          

      1.字符串 $ form_name –默认为“”。
          

      2. array $fields – pass your array of input fields
          

      2. array $ fields –传递您的输入字段数组
          

      3. string $submit_text – This is the text that appears on the submit button.

      3.字符串 $ submit_text –这是显示在“提交”按钮上的文本。

      Default is ‘Submit’.

      默认值为“提交”。

      Example : `$form = new CWRF_Form( $form_name, $fields, $submit_text );`

       示例:`$ form = new CWRF_Form($ form_name,$ fields,$ submit_text);`

      B.

      B。

      Build the array.

      构建数组。

      Here is the array used to build the form in the screenshots section.
          

      这是屏幕截图部分中用于构建表单的数组。
          

      1. assign classes and ID’s to retain full style control of all inputs.
          

      1.分配类别和ID,以保留对所有输入的完全样式控制。
          

      2. each input field and textarea is wrapped in a

      .

      2.每个输入字段和文本区域都包装在

      中。

      ID’s are assigned to the input and textarea tags themselves.

      ID分别分配给input和textarea标签。

              $fields = array(                        

        $ fields = array(                        

      'First Name' => array(                            

      '名字'=> array(                            

      'name' => 'first_name',                            

      '名称'=>'名字_',                            

      'type' => 'text',                            

      '类型'=>'文本',                            

      'id' => 'first_name',                            

      'id'=>'first_name',                            

      'class' => '',                            

      'class'=>'',                            

      'minlength' => 1,                            

      'minlength'=> 1,                            

      'maxlength' => 50,                            

      'maxlength'=> 50,                            

      'placeholder' => 'First Name',                            

      '占位符'=>'名字',                            

      'required' => true                        

      '必需'=> true                        

      ),                        

      ),                        

      'Last Name' => array(                            

      '姓氏'=>数组(                            

      'name' => 'last_name',                            

      '名称'=>'姓氏',                            

      'type' => 'text',                            

      '类型'=>'文本',                            

      'id' => 'last_name',                            

      'id'=>'姓氏',                            

      'class' => '',                            

      'class'=>'',                            

      'minlength' => 1,                            

      'minlength'=> 1,                            

      'maxlength' => 50,                            

      'maxlength'=> 50,                            

      'placeholder' => 'Last Name',                            

      '占位符'=>'姓氏',                            

      'required' => true                        

      '必需'=> true                        

      ),                        

      ),                        

      'Username' => array(                            

      '用户名'=>数组(                            

      'name' => 'user_login',                            

      '名称'=>'用户登录',                            

      'type' => 'text',                            

      '类型'=>'文本',                            

      'id' => 'user_login',                            

      'id'=>'user_login',                            

      'class' => '',                            

      'class'=>'',                            

      'minlength' => 1,                            

      'minlength'=> 1,                            

      'maxlength' => 50,                            

      'maxlength'=> 50,                            

      'placeholder' => 'User Login',                            

      '占位符'=>'用户登录名',                            

      'rows' => '',                            

      '行'=>'',                            

      'cols' => '',                            

      'cols'=>'',                            

      'required' => true                        

      '必需'=> true                        

      ),                        

      ),                        

      'Password' => array(                            

      '密码'=>数组(                            

      'name' => 'user_pass',                            

      '名称'=>'用户密码',                            

      'type' => 'password',                            

      '类型'=>'密码',                            

      'id' => 'user_pass',                            

      'id'=>'user_pass',                            

      'class' => '',                            

      'class'=>'',                            

      'minlength' => 1,                            

      'minlength'=> 1,                            

      'maxlength' => 50,                            

      'maxlength'=> 50,                            

      'placeholder' => 'Password',                            

      '占位符'=>'密码',                            

      'rows' => '',                            

      '行'=>'',                            

      'cols' => '',                            

      'cols'=>'',                            

      'required' => true                        

      '必需'=> true                        

      ),                        

      ),                        

      'Email Address' => array(                            

      '电子邮件地址'=> array(                            

      'name' => 'user_email',                            

      '名称'=>'用户_电子邮件',                            

      'type' => 'email',                            

      '类型'=>'电子邮件',                            

      'id' => 'user_email',                            

      'id'=>'user_email',                            

      'class' => '',                            

      'class'=>'',                            

      'minlength' => 1,                            

      'minlength'=> 1,                            

      'maxlength' => 50,                            

      'maxlength'=> 50,                            

      'placeholder' => 'jon@mail.com',                            

      '占位符'=>'jon@mail.com',                            

      'required' => false                        

      '必需'=>否                        

      ),                        

      ),                        

      'Options' => array(                            

      '选项'=>数组(                            

      'name' => 'favorite_fruit',                            

      '名称'=>'收藏夹水果',                            

      'type' => 'select',                            

      '类型'=>'选择',                            

      'id' => 'favorite_fruit',                            

      'id'=>'favorite_fruit',                            

      'class' => '',                            

      'class'=>'',                            

      'options' => array( 'apple', 'cherry', 'pear' ),                            

      'options'=> array('apple','cherry','pear'),                            

      'required' => false                        

      '必需'=>否                        

      ),                        

      ),                        

      'Gender' => array(                            

      '性别'=>数组(                            

      'name' => 'gender',                            

      '名称'=>'性别',                            

      'type' => 'radio',                            

      'type'=>'radio',                            

      'id' => 'gender',                            

      'id'=>'性别',                            

      'class' => '',                            

      'class'=>'',                            

      'value' => array( 'male', 'female' ),                            

      'value'=> array('male','female'),                            

      'required' => false                        

      '必需'=>否                        

      ),                        

      ),                        

      'Bio' => array(                            

      '生物'=>数组(                            

      'name' => 'description',                            

      '名称'=>'描述',                            

      'type' => 'textarea',                            

      'type'=>'textarea',                            

      'id' => 'description',                            

      'id'=>'描述',                            

      'class' => '',                            

      'class'=>'',                            

      'minlength' => 1,                            

      'minlength'=> 1,                            

      'maxlength' => 500,                            

      'maxlength'=> 500,                            

      'placeholder' => 'Add your bio',                            

      '占位符'=>'添加您的生物',                            

      'rows' => 5,                            

      '行'=> 5,                            

      'cols' => 50,                            

      'cols'=> 50,                            

      'required' => false                        

      '必需'=>否                        

      )                    

      )                    

      );                    

      );                    

      $form = new CWRF_Form( 'Test Form', $fields, 'Sign Up!' );

      $ form = new CWRF_Form('Test Form',$ fields,'Sign Up!');

      C.

      C。

      Note, the array values that match the WordPress syntax for insertion to the default WordPress profile page in the admin panel.

      请注意,与WordPress语法匹配的数组值可插入到管理面板中的默认WordPress配置文件页面。

      When you don’t use this syntax, values will be added below the premade profile meta section.

      如果您不使用此语法,则会将值添加到预制的配置文件元部分下方。

      Refer to screenshots to see how this form is rendered in the default WordPress user profile page.

      请参阅屏幕截图,以查看如何在默认的WordPress用户个人资料页面中呈现此表单。

      D.

      D。

      Form is set to method = 'POST'

      表单设置为 method ='POST'

下载地址
https://downloads.wordpress.org/plugin/custom-wp-registration-form.zip
-EOF-

AI助手支持GPT4.0