我需要添加字段ID

时间:2017-11-14 01:28:37

标签: javascript php function affiliate

我有非常基本的编码知识。还不足以在我的functions.php中添加第二个代码。开发人员(不再提供帮助)编码如下。我识别字段ID以及他放置的位置( id == 263 )。现在,我需要添加第二个字段ID( id == 359 )。我不知道如何正确编写第二个ID的代码。

/* Deal with link between Affiliate WP plugin and Formidable Forms */
/* First, let's constantly check for URL params that might relate to an Affiliate */
add_action( 'init', 'process_affwp_vals' );
function process_affwp_vals() {
     if( isset( $_GET['v'] ) ) {
          setcookie("affwp_value", urlencode($_GET['v']), time()+86400); //one day expiration
     }
     if( isset( $_GET['ref'] ) ) {
          setcookie("affwp_username", urlencode($_GET['ref']), time()+86400); //one day expiration
     }
}
add_filter('frm_get_default_value', 'my_custom_default_value', 10, 2);
function my_custom_default_value($new_value, $field){
    if($field->id == 236){ //Affiliate Tracking Field ID
        if(isset($_COOKIE['affwp_username'])) {
            $new_value = ($_COOKIE['affwp_username']);
        }
    }
    return $new_value;
}

0 个答案:

没有答案