小编ard*_*dev的帖子

联系表格7:使用wpcf7_before_send_mail创建的钩子仅用于id的一个联系表格

我正在使用Contact Form 7创建多个表单的站点上工作.对于其中一个表单,我使用表单中的隐藏输入字段传递我收集的变量.我使用wpcf7_before_send_mail钩子将这些变量传递到电子邮件中,但是这些值传递到每个电子邮件中(我添加了动态变量以及静态文本)以下是代码:

add_action( 'wpcf7_before_send_mail', 'wpcf7_add_text_to_mail_body' );

 function wpcf7_add_text_to_mail_body($contact_form){
     $values_list = $_POST['valsitems'];
     $values_str = implode(", ", $values_list);

     // get mail property
     $mail = $contact_form->prop( 'mail' ); // returns array 

     // add content to email body
     $mail['body'] .= 'INDUSTRIES SELECTED';
     $mail['body'] .= $values_list;


     // set mail property with changed value(s)
     $contact_form->set_properties( array( 'mail' => $mail ) );

 }
Run Code Online (Sandbox Code Playgroud)

我试图弄清楚如何只将这些值传递给联系表单电子邮件模板之一,可能通过表单ID.

php forms wordpress wordpress-plugin contact-form-7

10
推荐指数
3
解决办法
2万
查看次数

我是否必须在需要使用 npm 命令的 bitbucket 管道的每个步骤中进行 npm install

我有一个 bitbucket 管道 yml,我有运行测试脚本的步骤和运行无服务器部署脚本的步骤。我是否需要在每一步进行 npm install 或者第一个 npm install 是否会继续执行并足以满足后续的每个步骤。除此之外,引擎盖下发生了什么?我知道 Docker 容器已创建;每一步都只是更新容器吗?

- step:
        name: Test and Build
        script: 
          - npm install --no-package-lock
          - npm run test
    - step:
        name: Deploy Serverless
        script:
          - npm i serverless -g
          - npm install --no-package-lock
          - npm run deploy
Run Code Online (Sandbox Code Playgroud)

node.js npm docker aws-lambda bitbucket-pipelines

8
推荐指数
2
解决办法
4632
查看次数

为什么我的 bitbucket-pipelines.yml 对于拉取请求脚本无效

我有一个用于我正在处理的项目的 bitbucket pipeline yaml 文件。当它设置为在推送上运行时,我让它运行良好,但由于我将其切换为在拉取请求上运行,我收到了无效的 yml 错误。

我找到了如何配置文件的描述:https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html

验证器中,我在第一步收到一个错误,提示Expected a string but found a mapping.

当我通过拉取请求运行它时,出现以下错误:

Configuration error
There is an error in your bitbucket-pipelines.yml at [pipelines > pull-requests]. 
To be precise: This section should be a map (it is currently defined as a list).
Run Code Online (Sandbox Code Playgroud)

我不确定如何修复它,因为它似乎与示例相匹配。

下面是我的 yml 文件

image: node:8.10
pipelines:
  pull-requests:
    - step: 
        name: Push repo to CodeCommit
        script:
          - echo $CodeCommitKey > ~/.ssh/codecommit_rsa.tmp
          - base64 -di ~/.ssh/codecommit_rsa.tmp > ~/.ssh/codecommit_rsa
          - chmod 400 …
Run Code Online (Sandbox Code Playgroud)

continuous-integration bitbucket bitbucket-pipelines

5
推荐指数
1
解决办法
4817
查看次数