0

Sorry, not a coder just trying to figure out an issue on a WP site.

Using 3rd party integrations from CF7 plugin to pull forms into a Salesforce instance, making some new forms up and suddenly stopped being able to edit the integration entries. Save function at bottom of page is no longer there replaced by a text box I've not seen before

3rd party integration list ends with this

which lead me to the plugin.ui php file with code

<?php
//only print the 'add another' button for the last one
$numPairs = count($entity['mapping']);

// make sure we have at least one
if( $numPairs == 0 ) {
    $entity['mapping'] = array(array(
        'val'=>'', 
        self::PARAM_LBL => '', 
        self::PARAM_SRC => '', 
        self::PARAM_3RD => ''
    ));
}

$pairNum = 0;   //always increments correctly?
foreach($entity['mapping'] as $k => $pair)
?>

The error apparently appearing in the 3rd line here ($numPairs = ....) , left the rest of the expression for context. Just in case its relevant, running a rather deprecated v8.0.30 of php

As mentioned not a coder, first time using overflow, basically 100% uninformed, so i'm pretty much stumped from the word go and want expert advice before i try anything. Any and all solutions welcomed.

2
  • You should try figuring out these 1. Using $_POST directly -> CF7 sanitizes and processes data internally, so you should always use WPCF7_Submission 2. running integration inside Init or template_redirect , this is wrong place, so instead of this you should use CF7 hooks 3. and lastly if you are returning custom responses , remember to return them in JSON. Hope it helps Commented Sep 11 at 11:38
  • 1
    You should be able to make these error messages go away, if you change it to $numPairs = count($entity['mapping'] ?? []); - if $entity['mapping'] does not exist, then an empty array will be used as argument for count instead. Whether the rest of it will then still work as intended, we can not tell you though, you'd have to test it. Commented Sep 12 at 7:23

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.