Forum Replies Created

Viewing 8 replies - 16 through 23 (of 23 total)
  • +1

    I woudl like this ability too – I have the paid version.

    Thread Starter daybo

    (@daybo)

    Sorry – just found an explanation of why this is doing it. So please ignore this post.

    David

    Thread Starter daybo

    (@daybo)

    Sorry I missed that bit, that’s brilliant! Thank you ??

    Was there a resolution to this? I am having the same problem. I can switch to the desktop version only if I refresh the page after having clicked the link.

    Thanks
    David

    same issue here. It would appear that the wpcf7_before_send_mail hook isn’t being triggered for some reason.

    I’ll post back if I find the answer.

    Hi,

    I’m having the same issue. I’m not using any additional CF7 add-ons though.

    Any help greatly appreciated.
    Thanks

    Thread Starter daybo

    (@daybo)

    I think I have found the problem.
    I’m no expert…but in the file CF7DBPlugin.php there is a function called public function saveFormData($cf7), looking at this it would seem that the $cf7->title is examined before the call to cfdb_form_data where we can alter the contents of the submission (see code above).

    I don’t know what the knock on repercussions of this may be – maybe Michael could comment on this code change?

    So, this is what I did….it would appear that all we need do is move the test.

    $title = stripslashes($cf7->title);
     if ($this->fieldMatches($title, $this->getNoSaveForms())) {
        return; // Don't save in DB
     }

    to a point after the call to cfdb_form_data like so:

    public function saveFormData($cf7) {
         try {
    // moved by David 9.9.13
    //          $title = stripslashes($cf7->title);
    //          if ($this->fieldMatches($title, $this->getNoSaveForms())) {
    //          return; // Don't save in DB
    //            }
    
        $time = function_exists('microtime') ? microtime(true) : time();
        $ip = (isset($_SERVER['X_FORWARDED_FOR'])) ? $_SERVER['X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
    
       // Set up to allow all this data to be filtered
            $cf7->submit_time = $time;
            $cf7->ip = $ip;
            $user = null;
              if (is_user_logged_in()) {
                  $current_user = wp_get_current_user(); // WP_User
                  $user = $current_user->user_login;
                }
                $cf7->user = $user;
                try {
                    $newCf7 = apply_filters('cfdb_form_data', $cf7);
                    if ($newCf7 && is_object($newCf7)) {
                        $cf7 = $newCf7;
                        $time = $cf7->submit_time;
                        $ip = $cf7->ip;
                        $user = $cf7->user;
                    }
                  else {
                        error_log('CFDB Error: No or invalid value returned from "cfdb_form_data" filter: ' .
                                print_r($newCf7, true));
                    }
                }
                catch (Exception $ex) {
                    error_log(sprintf('CFDB Error: %s:%s %s  %s', $ex->getFile(), $ex->getLine(), $ex->getMessage(), $ex->getTraceAsString()));
                }
    // David - 9.9.2013 inserted code here
       $title = stripslashes($cf7->title);
          if ($this->fieldMatches($title, $this->getNoSaveForms())) {
             return; // Don't save in DB
          }
    
                $tableName = $this->getSubmitsTableName();
                $parametrizedQuery = "INSERT INTO <code>$tableName</code> (<code>submit_time</code>, <code>form_name</code>, <code>field_name</code>, <code>field_value</code>, <code>field_order</code>) VALUES (%s, %s, %s, %s, %s)";
                $parametrizedFileQuery = "INSERT INTO <code>$tableName</code> (<code>submit_time</code>, <code>form_name</code>, <code>field_name</code>, <code>field_value</code>, <code>field_order</code>, <code>file</code>) VALUES (%s, %s, %s, %s, %s, %s)";
                $order = 0;
                $noSaveFields = $this->getNoSaveFields();
                $foundUploadFiles = array();
                global $wpdb;
                ...

    Hi bgentry!
    Just came across your post – I am looking for a similar thing – although in my case nothing to do with facebook.
    What I am after is the ability to assign a custom target to a particular menu item. For example target=”contentFrame”.
    I’m going to have a good look at your first attempt to see if I can adapt it to my purposes.
    Thanks!

Viewing 8 replies - 16 through 23 (of 23 total)