Title: Passing Values
Last modified: September 22, 2017

---

# Passing Values

 *  Resolved [ksequen](https://wordpress.org/support/users/ksequen/)
 * (@ksequen)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/passing-values/)
 * Hi,
 * I used to pass some values and add them to the admin email, using my_cforms_logic.
   **
   Since it is now deprecated, what should I use?**
 * For example, I passed a var like this:
    [http://aquatec-ecosys.com/contactenos/solicitar-cotizacion/?ref=Producto:%20Bombas%20para%20desechos%20s%C3%B3lidos](http://aquatec-ecosys.com/contactenos/solicitar-cotizacion/?ref=Producto:%20Bombas%20para%20desechos%20s%C3%B3lidos)
 * And used this function:
 * function my_cforms_logic($cformsdata,$oldvalue,$setting) {
 *  ### example: the below code changes a user-variable in both the Text & HTML 
   part of
    ### the admin email & auto confirmation email
 *  if ( $setting == “adminEmailTXT” || $setting == “adminEmailHTML” || $setting
   == “autoConfTXT” || $setting == “autoConfHTML” ||
    $setting == “adminEmailDataTXT”
   || $setting == “adminEmailDataHTML”){
 *  $post_reference = $_POST[“ref”];
    $post_subject = $_POST[“asunto”];
 *  if ($post_reference):
    $cformsdata[‘data’][‘ref’]==$post_reference; else: $cformsdata[‘
   data’][‘ref’]==”N/A”; endif;
 *  if ($post_subject):
    $cformsdata[‘data’][‘asunto’]==$post_asunto; endif;
 *  endif;
    return $oldvalue; }
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fpassing-values%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [bgermann](https://wordpress.org/support/users/bgermann/)
 * (@bgermann)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/passing-values/#post-9524281)
 * Did that code really run? It has a syntax error. The last “endif;” must be replaced
   by “}”.
 * As far as I can see the code has no effect. Changing the three `$cformsdata[‘
   data’][‘...’]==...;` lines to assignments instead of comparisons would make sense.
 * Even if the code runs as intended, you do not use the API call as intended. You
   just abuse it to change `$cformsdata` instead of `$oldvalue`, which you never
   touch.
 * You should just use an arbitrary constant string in the admin email and replace
   it with a filtered value from `$_POST` via the `cforms2_admin_email_filter`.
 *  Thread Starter [ksequen](https://wordpress.org/support/users/ksequen/)
 * (@ksequen)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/passing-values/#post-9574952)
 * OK, the thing is I don’t understand how to use the cforms2_admin_email_filter.
   Where should I use it? in the functions.php file? is there any documentation 
   on how to use this?
 * Can you give me an example of passing the parameter and including the info in
   the admin email?
 *  Plugin Author [bgermann](https://wordpress.org/support/users/bgermann/)
 * (@bgermann)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/passing-values/#post-9845900)
 * Just look at its call in lib_validate.php and you see the passed variables. Please
   read through general WordPress docs on how to use WordPress filters.
    You should
   use a filter in an own plugin. A hacky solution would be writing it in your theme.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Passing Values’ is closed to new replies.

 * ![](https://ps.w.org/cforms2/assets/icon-128x128.png?rev=1010031)
 * [cformsII](https://wordpress.org/plugins/cforms2/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cforms2/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cforms2/)
 * [Active Topics](https://wordpress.org/support/plugin/cforms2/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cforms2/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cforms2/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [bgermann](https://wordpress.org/support/users/bgermann/)
 * Last activity: [8 years, 4 months ago](https://wordpress.org/support/topic/passing-values/#post-9845900)
 * Status: resolved