[wordpress插件] Bin Opt-In启用本箱

wordpress 插件 文章 2020-03-05 07:20 551 0 全屏看文

AI助手支持GPT4.0

评分
0
描述

Provides features and functions to create an opt-in or double-opt in with contact form 7 (cf7) and other form plugins.

提供了使用联系表格7(cf7)和其他表格插件来创建选择加入或双重选择加入的功能。

Save contacts

保存联系人

To store your contacts, please install the additional plugin called bin contact.

要存储您的联系人,请安装名为bin contact的附加插件。

This plugin assists you installing all the necessary dependencies.

此插件可帮助您安装所有必需的依赖项。

Opt-In Function

启用功能

BinOptIn::optIn($postdata, [    

 BinOptIn :: optIn($ postdata,[    

'opt_in_admin_message' => false,    

'opt_in_admin_message'=>否,    

'double_opt_in' => false,    

'double_opt_in'=>否,    

'admin_unlock' => false,    

'admin_unlock'=>否,    

'unlock_message' => false

'unlock_message'=>否

]);

]);

    • opt_in_admin_message

      opt_in_admin_message

      (bool) Notify the site owner of any new contact, regardless of whether or not he has confirmed his e-mail address.

      (布尔)通知任何新联系人的网站所有者,无论他是否已确认其电子邮件地址。

      Default false.

      默认为false。

    • double_opt_in

      double_opt_in

      (bool) The contact must confirm the e-mail address by clicking on a confirmation link.

      (布尔)联系人必须通过单击确认链接来确认电子邮件地址。

      Default false.

      默认为false。

    • admin_unlock

      admin_unlock

      (bool) The site owner has to confirm every new contact by clicking on a confirmation link.

      (布尔)网站所有者必须通过单击确认链接来确认每个新联系人。

      This is useful if you want to show a list of contacts (like a committee or a list of supporters).

      如果要显示联系人列表(例如委员会或支持者列表),此功能很有用。

      Default false.

      默认为false。

    • unlock_message

      解锁消息

      (bool) This option allows you to specify whether the contact should receive a notification once the site owner has confirmed the committee subscription.

      (布尔)此选项使您可以指定网站所有者确认委员会订阅后,联系人是否应收到通知。

      Default false.

      默认为false。

    Accepted postdata

    接受的数据

      • salutation

        称呼

        (int) Default empty.

        (int)默认为空。

          • 0 (Mister)
          • 0(先生)

          • 1 (Miss)
          • 1(小姐)

          • 2 (Other)
          • 2(其他)

        • polite_form

          polite_form

          (int) Default empty.

          (int)默认为空。

            • 0 (Personally)
            • 0(个人)

            • 1 (Formally)
            • 1(正式)

          • language_of_correspondence

            通信语言

            (int) Check this functions to see a list of all available languages: BinContact::formLanguage() and BinContact::formLanguageValue()

            (int)检查此功能以查看所有可用语言的列表:BinContact :: formLanguage()和BinContact :: formLanguageValue()

          • name_suffix

            名称后缀

            (string) Default empty.

            (字符串)默认为空。

          • first_name

            名字

            (string) Default empty.

            (字符串)默认为空。

          • last_name

            姓氏

            (string) Default empty.

            (字符串)默认为空。

          • designation

            名称

            (string) Default empty.

            (字符串)默认为空。

          • mobile

            移动

            (string) Default empty.

            (字符串)默认为空。

          • phone_private

            phone_private

            (string) Default empty.

            (字符串)默认为空。

          • phone_work

            电话工作

            (string) Default empty.

            (字符串)默认为空。

          • street_and_number

            街道号

            (string) Default empty.

            (字符串)默认为空。

          • zip

            zip

            (string) Default empty.

            (字符串)默认为空。

          • city

            城市

            (string) Default empty.

            (字符串)默认为空。

          • country

            国家/地区

            (string) Default empty.

            (字符串)默认为空。

          • website

            网站

            (string) Default empty.

            (字符串)默认为空。

          • facebook

            facebook

            (string) Default empty.

            (字符串)默认为空。

          • twitter

            推特

            (string) Default empty.

            (字符串)默认为空。

          • instagram

            instagram

            (string) Default empty.

            (字符串)默认为空。

          • flickr

            flickr

            (string) Default empty.

            (字符串)默认为空。

          • linkedin

            linkedin

            (string) Default empty.

            (字符串)默认为空。

          • xing

            xing

            (string) Default empty.

            (字符串)默认为空。

          • youtube

            youtube

            (string) Default empty.

            (字符串)默认为空。

          • socialmedia_other1

            socialmedia_other1

            (string) Default empty.

            (字符串)默认为空。

          • socialmedia_other2

            socialmedia_other2

            (string) Default empty.

            (字符串)默认为空。

          • socialmedia_other3

            socialmedia_other3

            (string) Default empty.

            (字符串)默认为空。

          • terms_and_conditions_accepted

            已接受条款和条件

            (string) Default empty.

            (字符串)默认为空。

              • empty (Not filled)
              • 空(未填充)

              • no (No)
              • 否(否)

              • yes (Yes)
              • 是(是)

            • privacy_policy_accepted

              privacy_policy_accepted

              (string) Default empty.

              (字符串)默认为空。

                • empty (Not filled)
                • 空(未填充)

                • no (No)
                • 否(否)

                • yes (Yes)
                • 是(是)

              Integrate with Contact Form 7

              与联系表格7集成

              Bin Opt-In works best with contact form seven.

              Bin Opt-In最适用于联系表七。

              To integrate it into your contact forms, you need to add custom code like this to your theme functions.php.

              要将其集成到您的联系表单中,您需要向主题函数.php中添加这样的自定义代码。

              add_action('wpcf7_before_send_mail', 'bin_opt_in_contact');

               add_action('wpcf7_before_send_mail','bin_opt_in_contact');

              function bin_opt_in_contact($cf7)

              函数bin_opt_in_contact($ cf7)

              {    

              {    

              // Get current form id    

              //获取当前表单ID    

              $formId = $cf7->id;    

              $ formId = $ cf7-> id;    

              // Array of form ids    

              //表单ID的数组    

              $forms = [159, 454];    

              $ forms = [159,454];    

              // Only apply to certain forms    

              //仅适用于某些表格    

              if(in_array($formId, $forms))    

              if(in_array($ formId,$ forms))    

              {        

              {        

              // Dont do anything if class is missing        

              //如果缺少课程,请不要做任何事情        

              if(class_exists('BinOptIn'))        

              如果(class_exists('BinOptIn'))        

              {            

              {            

              // At least, the email must be present            

              //至少必须存在该电子邮件            

              if(is_email($_POST['email']))            

              if(is_email($ _ POST ['email']))            

              {                

              {                

              // map salutation                

              //地图称呼                

              $salutationMap = [                    

              $ salutationMap = [                    

              'Frau' => 0,                    

              'Frau'=> 0,                    

              'Madame' => 0,                    

              '女士'=> 0,                    

              'Mrs' => 0,                    

              '太太'=> 0,                    

              'Herr' => 1,                    

              'Herr'=> 1,                    

              'Monsieur' => 1,                    

              '先生'=> 1,                    

              'Mr' => 1,                    

              '先生'=> 1,                    

              '*' => 2                

              '*'=> 2                

              ];                

              ];                

              // assign form data with corresponding meta fields                

              //为表单数据分配相应的元字段                

              $postdata = [];                

              $ postdata = [];                

              $postdata['email'] = sanitize_email($_POST['email']);                

              $ postdata ['email'] = sanitize_email($ _ POST ['email']);                

              $postdata['first_name'] = sanitize_text_field($_POST['first_name']);                

              $ postdata ['first_name'] = sanitize_text_field($ _ POST ['first_name']);                

              $postdata['last_name'] = sanitize_text_field($_POST['last_name']);                

              $ postdata ['last_name'] = sanitize_text_field($ _ POST ['last_name']);                

              $postdata['salutation'] = $salutationMap[$_POST['salutation']];                

              $ postdata ['salutation'] = $ salutationMap [$ _ POST ['salutation']];                

              $postdata['terms_and_conditions_accepted'] = isset($_POST['terms_and_conditions_accepted']) ?

              $ postdata ['terms_and_conditions_accepted'] = isset($ _ POST ['terms_and_conditions_accepted'])吗?

              'yes' : '';                

              '是':'';                

              // save contact                

              //保存联系人                

              BinOptIn::optIn($postdata, [                    

              BinOptIn :: optIn($ postdata,[                    

              'opt_in_admin_message' => false,                    

              'opt_in_admin_message'=>否,                    

              'double_opt_in' => false,                    

              'double_opt_in'=>否,                    

              'admin_unlock' => false,                    

              'admin_unlock'=>否,                    

              'unlock_message' => false                

              'unlock_message'=>否                

              ]);            

              ]);            

              }        

              }        

              }    

              }    

              }

              }

              }

              }

              Integrate with Contact Form 7 Multi-Step Pro

              与Contact Form 7 Multi-Step Pro集成

              Save form data at every step by using the filter wpcf7_validate.

              使用过滤器 wpcf7_validate 在每一步保存表单数据。

              add_filter('wpcf7_validate', 'save_contact_step', 10, 2);

              add_filter('wpcf7_validate','save_contact_step',10,2);

              function save_contact_step($result, $tags)

              函数save_contact_step($ result,$ tags)

              {    

              {    

              // Get current form id    

              //获取当前表单ID    

              $formId = $_POST['_wpcf7'];    

              $ formId = $ _POST ['_ wpcf7'];    

              // Array of form ids    

              //表单ID的数组    

              $forms = [159, 454];    

              $ forms = [159,454];    

              // Only apply to certain forms    

              //仅适用于某些表格    

              if(in_array($formId, $forms))    

              if(in_array($ formId,$ forms))    

              {        

              {        

              // Dont do anything if class is missing        

              //如果缺少课程,请不要做任何事情        

              if(class_exists('BinOptIn'))        

              如果(class_exists('BinOptIn'))        

              {            

              {            

              // save contact info here            

              //在此处保存联系信息            

              // BinOptIn::optIn()        

              // BinOptIn :: optIn()        

              }    

              }    

              }    

              }    

              return $result;

              返回$ result;

              }

              }

安装步骤

    1. Download, unzip and upload to your WordPress plugins directory
    2. 下载,解压缩并上传到您的WordPress插件目录

    3. Activate the plugin within you WordPress Administration Backend
    4. 在您的WordPress管理后端中激活插件

下载地址
https://downloads.wordpress.org/plugin/bin-opt-in.1.0.1.zip
-EOF-

AI助手支持GPT4.0