Add Users To PostType
Triggers fatal error on activation (2 posts)

  1. Ethan Shaw
    Posted 4 years ago #

    In WP 3.3RC1 the plugin cannot be activated. This error notice is given:

    Plugin could not be activated because it triggered a fatal error.

    Parse error: syntax error, unexpected ':' in wp-content/plugins/add-users-to-posttype/add-users-to-posttype.php on line 145


  2. bigredpimp
    Posted 4 years ago #

    This seems to be due to a feature that exists in PHP 5.3 but will cause failure in older versions. For PHP 5.3, they added the ability to omit the 2nd expression in a ternary operator ("var1 ?: var3" vs "var1 ? var2 : var3") in order to return the result of the first expression. This is helpful for some but only when the server is using 5.3 and beyond.

    This should probably be changed in order to provide better functionality. I've noticed that there are various things in place to handle previous PHP versions but this single oversight will cause it to fail in anything but 5.3. Hopefully that helps both your issue and the author.

    Here's a temporary fix for that line:
    $autp_posttypes = ($checkPostTypeSet = isset($this->options['autp_posttypes'])) ? $checkPostTypeSet : null;

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Add Users To PostType
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic