Hello.
I have installed WordPress plugin “Cybozu WP to kintone” on my WordPress site and get the error message when published.
I used Product Survey app from kintone marketplace as the test case but I get the following error.
Warning : Invalid argument supplied for foreach() in /home/fujibiz/public_html/wp-content/plugins/cybozu-wp-to-kintone/includes/class-kintone-api.php on line 218
This same plugin works on Japanese account.
Any idea to fix this?
The following is the screenshot to show where the error occurred.
/*
* Exclude controls
* @param string $control controls
* @param string $exclude code name for exclude
* @return array $controls
* @since 0.1
*/
public static function exclude_controls( $controls, $exclude = null )
{
$excludes = array_filter( preg_split( ‘/,/’, $exclude ), ‘trim’ );
$c = array();
/* This is where the error has thrown */
foreach ( $controls as $control ) {
/**/
if ( isset( $control[‘code’] ) && preg_match( ‘/^__/’, $control[‘code’] ) ) {
continue;
}
if ( isset( $control[‘code’] ) && in_array( $control[‘code’], $excludes ) ) {
continue;
}
$c[] = $control;
}
return $c;
}
Update:
According to the developer at Digicube Inc., US account is out of support.
I have resolved it by myself.
You need to change REST API URL according to your account country.
For example:
For US account, you need change URL domain from cybozu to kintone.
The code is in class-kintone-api.php.
Here is the sample.
function get_form_js():
/* Change kintone API url by country */
$uri = $_SERVER[‘REQUEST_URI’];
if (stripos($uri,‘jp’)){
$url = sprintf(
‘https://%s.cybozu.com/k/v1/form.json?app=%d’,
$sub_domain,
$app_id
);
}
else {
$url = sprintf(
‘https://%s.kintone.com/k/v1/form.json?app=%d’,
$sub_domain,
$app_id
);
}
/* End*/
function sava_data():
/* Change kintone API url by country */
$uri = $_SERVER[‘REQUEST_URI’];
if (stripos($uri,‘jp’)){
$url = sprintf(
‘https://%s.cybozu.com/k/v1/form.json?app=%d’,
$sub_domain,
$app_id
);
}
else {
$url = sprintf(
‘https://%s.kintone.com/k/v1/form.json?app=%d’,
$sub_domain,
$app_id
);
}
/* End*/
Hi Mo, did this work in the end?
As you’ve stated, there were around 4 lines in the class-kintone-api.php code that included a call to " https://%s. cybozu.com/k/v1 " that would only work for kintone for the Japanese region.
For US region kintone, this should be " https://%s. kintone.com/k/v1 ", and that should be all of the change that would be needed.
Hope they fix it on the plug-in side though
Yes. It works. I contacted the developer with this solutions but no response so far. I hope the fix will be released next update, too.