Parse Error in Custom Dashboard Widget

I'm getting this error in the custom dashboard widget:

Parse error: syntax error, unexpected '<' in /home/orgsprin/public_html/wp-content/plugins/custom-content-dashboard-widget/custom-content-dashboard-widget.php(116) : eval()'d code on line 1

It doesn't seem to be anything new as it's posted several times on these forums, but I have yet to find a spot where it has been resolved.

I've tried simple html and various php from simple echos to wordpress tags and nothing works other than plain text. I've uninstalled and reinstalled, and cleared my cache - still the same error.

Am i missing a known issue, or should I be prefacing my code with a special character(s) needed by this plugin?

here's what I've tried:

Hello - this is the only thing that works - plain text

<?php echo 'Hello';?> - parse error

<?php the_date():?> - parse error

ANy ideas?

  • aecnu

    Greetings craiggrella,

    Thank you for this great question and bringing this significant issue to our attention.

    If I recall this issue correctly there was never a posted cure to this issue because there are a myriad of possibly plugin conflicts and once they disabled the problem plugin which fixed their site we never hear from them again concerning the issue.

    Therefore I think now it is time to go into full blown trouble shooting mode because it appears there may be some conflict here and one way to find out conclusively.

    Standard plugin trouble shooting protocol - first to switch to the Twenty Eleven theme just long enough to check for the problem - if the problem still exists next involves deactivating all plugins except the plugin in question and then see if the issue still exists.

    If it does not, then you want to activate plugins one at a time testing in between to see if the issue returns. Even when you find one plugin, it may be in your interest to deactivate the problem plugin and continue testing the rest of the plugins to insure no others are also conflicting. You will know the conflict when the issue returns and which plugin(s) you activated that cause the issue.

    Please advise if there are any plugin conflicts and if so what the plugins are that are conflicting.

    Cheers, Joe

  • Craig Grella

    OK I got it. It's not a plugin error, it's just POOR documentation for this plugin.

    The parse error comes from line 116 in the plugin, which is this:
    eval(stripcslashes($widget_options['custom_content_dashboard']['content']));

    The eval command requires no leading or trailing php tags '<' so code in the content box in the plugin admin area has to be passed without them. You can use the standard php tags in the middle of the code to escape and re-enter php, but not at beginning or end of total code - otherwise parse error.

    For instance; here's what I have in mine:

    ?><strong>
    <?echo "Welcome, today is ";
    echo date("F j, Y");
    ?></strong>
    <br />
    <a href="http://orgspring.org" target="_blank" alt="OrgSpring Home Page">OrgSpring Home Page</a>

    Since it's expecting valid php to start, but stripping out the php opening tag, it is ok to start by closing php and going straight into html as I did above.

    Hope that helps. And someone should take a minute or two to document this in the plugin usage page.

    Craig

  • Zoltan Madai

    Craig definitely deserves some points for this and it should come from staff, but I will show my appreciation anyway. I don't have much as yet, but I'm giving you 2 points which is 25% of my total wealth :slight_smile:

    Seriously guys (staff), this is not the first time I have to look for help in the forums, which is great by the way, but you should put more effort into documenting these solutions maybe in a new section on every plugin page. You could call this "Examples" and place it next to "Usage".

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.