Problems with WP plugin error message

4 replies
Hi,

I recently installed a WP plug in called widlink but it showed on my log 2 error message as follows:

Warning: Invalid argument supplied for foreach() in
/home2/imjason/public_html/wp-content/plugins/widlink.php on line 60

Warning: Invalid argument supplied for foreach() in /home2/imjason/public_html/wp-content/plugins/widlink.php on line
72



The 2 "foreach" line are as in red as follows:



$q = @file($remoteURL);$a=array();$b=array();
$l = @file($myLinksUrl);

//removing $ignore from $q
$new_q=array();
foreach($q as $_u)
{
$_p=explode("|", $_u);
$_name = trim($_p[0]);
if( ($_name) && ($_name != $ignore) )
$new_q[]=$_u;
}
$q=$new_q; unset($new_q);
$n=count($q);

//removing $ignore from $l
$new_l=array();
foreach($l as $_u)
{
$_p=explode("|", $_u);
$_name = trim($_p[0]);
if( ($_name) && ($_name != $ignore) )
$new_l[]=$_u;
}
$l=$new_l; unset($new_l);
$mylinks_count=count($l);

srand(time());
$addmylink = (empty($l)) ? "" : $l[array_rand($l)];

if(empty($l)) {

if(empty($q)) {

echo "";
echo $after_widget;
return;

}


}

I am not a programmer, please advise .

Cheers
Jason Ser
#error #message #plugin #problems
  • Profile picture of the author mywebwork
    Are you sure that the Plugin is designed and compliant with your version of WordPress? A lot of plugins for earlier versions broke after version 2.7 was introduced.

    I can't find any reference to this plugin on the WordPress site, what does it actually do? At the risk of asking the obvious, have you contacted the developer about the problem?

    Bill
    {{ DiscussionBoard.errors[1598219].message }}
  • Profile picture of the author chaos69
    It looks like the plugin is expecting to read in pipe delimited list from these;

    $q = @file($remoteURL);
    $l = @file($myLinksUrl);

    At a guess, the foreach is failing because they are blank or empty; Where is it mean to source the $remoteURL and $myLinksUrl from?

    If the plugin 'includes' or 'requires' any other files, they may be set there.

    You should also check the plugin docs or contact the author for support, after all, they'd know best how to fix it.
    Signature
    Best Ways To Make Money Online

    Eight bytes walk into a bar. The bartender asks, “Can I get you anything?”
    “Yeah,” reply the bytes. “Make us a double.”
    {{ DiscussionBoard.errors[1598848].message }}
  • Profile picture of the author mrjasonser
    Thanks Guy, I Think That's what I will do
    Signature
    I Don't Speak The Queen's English, But I Say What I Mean and Mean What I Say.

    Here is where I work now: www.LohasDigital.com

    {{ DiscussionBoard.errors[1601075].message }}
  • Profile picture of the author n7 Studios
    I've had this error with other plugins in the past.

    You'll need to:
    1. Disable (not uninstall) all plugins
    2. Activate each plugin, one by one, until you activate the plugin that produces the error.
    3. Delete the plugin that produces the error
    4. Download the plugin from the author's site, and install it again.

    When I've encountered this issue it's because the plugin's PHP file isn't a complete file i.e. it cuts off before the end - I'm not sure whether this happens due to a failed download of the plugin or failed FTP / upload of the plugin to your site. The error itself is a little erronous, as the code line it points to is typically fine.
    {{ DiscussionBoard.errors[1601617].message }}

Trending Topics