Support » Plugin: Simple Links » [Plugin: Simple Links] Fatal Errors on Install (Syntax Errors…)

  • Resolved daveshine (David Decker)


    Hi there!

    I tried to install the plugin and on activation I got the following syntax errors, which I fixed manually (and then got your plugin to work 🙂

    Parse error: syntax error, unexpected T_FUNCTION in /my-path/wp-content/plugins/simple-links/classes/simple-links.admin.class.php on line 445

    This code has wrong syntax:

    //Remove the Add link in the admin bar
    	    add_action( 'wp_before_admin_bar_render', function(){
    	    	global $wp_admin_bar;

    has to be changed to:

    //Remove the Add link in the admin bar
    		add_action( 'wp_before_admin_bar_render', 'simple_links_remove_new_link_menu' );
    		function simple_links_remove_new_link_menu() {
    			global $wp_admin_bar;
    			$wp_admin_bar->remove_menu( 'new-link' );

    The next one was:

    Parse error: syntax error, unexpected T_FUNCTION in /my-path/wp-content/plugins/simple-links/widgets/init.php on line 22

    this is the wrong syntax:

    add_action( 'widgets_init', function(){

    has to be changed to:

    add_action( 'widgets_init', 'simple_links_register_widget_replica' );
    		function simple_links_register_widget_replica() {
    			register_widget( 'SL_links_replica' );

    I’m running: WP 3.4.1 and PHP 5.2.17

    Otherwise a great plugin, really well done!

    I also wish you’d add full internationalization to it as that would even more users bring to switch from the old system to your’s. 🙂

    Thanks again for your great work!

    -Dave from Germany 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Mat Lipe


    Hello daveshine.

    Thanks for your feedback.
    This must be an issue with that particular version of PHP. We have been unable to recreate the issue on any of our servers.

    I will make the fix right now and release an update.

    I like your idea for internationalization as well. It is one the list for future additions/updates.

    Thanks again for your feedback!

    Plugin Author Mat Lipe


    The New version 1.0.2 has been released.

    Please let me know if you have any issue with it.


    Hi there!

    Thanks for the update it seems now resolved 🙂

    The syntax I suggested as solution is the default – see WordPress Core, the Codex, plugins and themes — all use this syntax.

    I assume your version is new PHP 5.3 ??
    But as WP itself requires PHP 5.2.4+ it’s best to be compatible still with all that.

    Thanks, Dave 🙂

    Plugin Author Mat Lipe


    Hi Daveshine,
    If you look at the codex at about half way down the page you will find these lines.

    You can also pass the callback parameter as a anonymous function, for example:
    <?php add_action(‘wp_head’, function() { echo ‘something’;}) ?>

    This is a huge oversight considering from what I can tell, you could not pass an anonymous function as an argument before PHP 5.3.0. I will have to keep this in mind in my future plugins/themes.

    Seems like this codex should be updated with a note about this php requirement.

    The Codex here only shows what is possible and not what should be used!

    There’s so many users still with 5.2 so we should support it!

    Also, anonymous functions have the problem that they cannot be removed via “remove_action” (only in a very difficult way).

    So if it comes down to compatibility and modularity of code (modular plugins) we should use the “old” way for all public functions, hooks and filters!

    See also this on anonymous functions:
    (it’s actually in German, but I hope you still get the code examples…)

    And this for modular plugins:

    Thanks, Dave 🙂

    Plugin Author Mat Lipe


    I agree with you that 5.2 must be supported. Many of us have already moved on to 5.4, but there are still too many servers running 5.2 to ignore.

    If you are interested in extending this modular plugin, please see the summarized documentation. ( I know daveshine has most likely already seen this but for those who haven’t ).

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Simple Links] Fatal Errors on Install (Syntax Errors…)’ is closed to new replies.