CubePoints - Configure ERROR

Hi guys!

Now I try to setup with Cube Points. But, I’ve got message below.


Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\sweetlife\wp-content\plugins\rtmedia-pro\app\main\controllers\media\RTMediaProPoints.php on line 195

It mean Null by get_site_option(“rtmedia_points”). So, I think It doesn’t set “rtmedia_points”.

Does anyone know this issue and how to right way?

regards, Yoshi

Hi @Yoshi_Sakai,

That’s really strange. Try removing rtmedia_points from options table and check again by deactivating and activating the rtMedia module for cubepoints.

Hi Riteshoatel,

It seems multi-site switching issue. I added error recovery flow if we can’t get $rtmedia_points. It seems working good now. Thanks!

Regards, Yoshi

+    /*
+     * 2014/11/22: add cp_rtmedia_install by Yoshi.Sakai @ bluemooninc
+     */
     function cp_rtmedia_config()
     {
 	$rtmedia_points = maybe_unserialize(get_site_option("rtmedia_points"));
+        if (!$rtmedia_points) {
+            $this->cp_rtmedia_install();
+        }
     ?>
 	<br />
 	<h3 id="rtmedia-cp"><?php _e( 'Points for rtMedia','cp' ); ?></h3>
Add a comment to this line
 	</table>
     <?php
     }
-
+    /*
+     * 2014/11/22: add cp_rtmedia_install by Yoshi.Sakai @ bluemooninc
+     */
     function cp_rtmedia_config_process()
     {
 	$rtmedia_points = maybe_unserialize(get_site_option("rtmedia_points"));
-	foreach ($rtmedia_points as $key => $val) {
-	    $rtmedia_points[$key]['points']['cp_points'] = (int)$_POST['rtmedia_points'][$key];
-	}
-	rtmedia_update_site_option( 'rtmedia_points', $rtmedia_points );
+	if (!$rtmedia_points) {
+            $this->cp_rtmedia_install();
+        }
+	if ($rtmedia_points) {
+            foreach ($rtmedia_points as $key => $val) {
+                $rtmedia_points[$key]['points']['cp_points'] = (int)$_POST['rtmedia_points'][$key];
+            }
+            rtmedia_update_site_option( 'rtmedia_points', $rtmedia_points );
+        }
    }