Support » Plugin: cformsII » my-functions: How to manipulate AdminTo with action or filter

  • Resolved videomike

    (@videomike)


    Hi

    As AdminTo has been removed from the my-functions logic I am at a loss now as I don’t know how to manipulate the receiver any more.
    Can anyone point me in the right direction?

    Michael

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author bgermann

    (@bgermann)

    You can use cforms2_admin_email_filter from the (currently stable) development version.

    Thank you Bastian!
    Now I can access the email admin again – unfortunately what I did before is not working nevertheless.
    I have a forms contact form that is embedded on quite a few pages. there is a custom meta value on each of these pages where the admin address is stored.
    I used to read that value and if it was set replace the email address like so:

    function my_cforms_logic($cformsdata,$oldvalue,$setting) {
    if ( $setting == “adminTO” ){
    if ( $oldvalue==’generalcontact@somedomain’ ) {
    global $Ajaxpid;
    $contact = get_post_meta($Ajaxpid, ‘contactaddress’, true);
    if (isset($contact)) { return $contact;}
    }
    }
    return $oldvalue;
    }

    Now it seems $Ajaxpid is not populated – how can I access my post_meta from within the filter?

    Michael

    Plugin Author bgermann

    (@bgermann)

    Why not use get_the_ID()?

    I have AJAX activated, so the form posts to the Ajax handler and thus get_the_ID() does not return the post ID of the sending page but is empty…

    It seems the post id is posted as a hidden variable and probably this was where the global $Ajaxpid was formerly filled from…
    I could use the {PostID} Variable and extract it from the mail body… although that is not very elegant and might confuse the people getting the user message in the mail…

    Plugin Author bgermann

    (@bgermann)

    I added form id and post id to the filter.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘my-functions: How to manipulate AdminTo with action or filter’ is closed to new replies.