WordPress.org

Ready to get started?Download WordPress

Forums

DJD Site Post
[resolved] error (17 posts)

  1. osoru
    Member
    Posted 1 year ago #

    hi, i am having this error trying to activate your plugin

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

    Parse error: syntax error, unexpected ':' in /home/sitename/public_html/wp-content/plugins/djd-site-post/djd-site-post.php on line 634

    http://wordpress.org/extend/plugins/djd-site-post/

  2. djarzyna
    Member
    Plugin Author

    Posted 1 year ago #

    Hi, nothing fancy in that line. Care to tell me what version of php and WordPress you are running?

    If you are able to please replace line 634.

    Old line 634:

    throw new Exception( $djd_options['djd-post-fail'] ?: __('We were unable to accept your post at this time. Please try again. If the problem persists tell the site owner.', 'djd-site-post'));

    New line 634:

    throw new Exception(__('We were unable to accept your post at this time. Please try again. If the problem persists tell the site owner.', 'djd-site-post'));

    This way the plugin won't use the Failure message specified in the settings panel. It will always use the one specified in that line of code instead. But for now it will help narrow the error down.

    Wondering why this specific error is raised during plugin activation...

  3. osoru
    Member
    Posted 1 year ago #

    thank you for taking a look.

    i am using the WordPress Version 3.5.1

    i installed the plugin without any problems but when i try to activate, it report error.

  4. djarzyna
    Member
    Plugin Author

    Posted 1 year ago #

    Did you try to change line 634 in djd-site-post.php as I recommended before?

    Or, just to see if it can be activated this way, comment out line 634 (just put two slashes at tghe beginning of the line: // throw new ..

  5. kossut
    Member
    Posted 1 year ago #

    Here is another:

    Parse error: syntax error, unexpected ':' in /home/.../wp-content/plugins/djd-site-post/views/display.php on line 43

    I think, you should rewrite all lines which contains that ':'

    The idea of the plugin sounds nice. I can't wait to try it!

    Regards from Poland!

  6. djarzyna
    Member
    Plugin Author

    Posted 1 year ago #

    Thank you Kossut for the hint that there is more. Did you (or Osuru) try to change the code as I advised above? Would be helpful to know if it works after that change since I have difficulties to reproduce the error - on my installs it just works.

  7. djarzyna
    Member
    Plugin Author

    Posted 1 year ago #

    Ok, got it now. You guys are running a php version prior 5.3, right? From php 5.3 on you can skip the middle part when using the ternary operator ?: when constructing if-then-else expressions. Prior 5.3 you wrote

    a ? a : c

    Beginning with 5.3 for the same result you can write

    a ?: c

    This is what I've done in my code and obviously this causes a syntax error on php prior 5.3.

    I think tomorrow or the day after I will have some time to fix this in my code for the sake of backwards compatibility. So look for an update coming during the next couple of days. Otherwise you can fix the error by changing the lines in question the way I described above.

  8. kossut
    Member
    Posted 1 year ago #

    Yes. I've changed the line, and it started work. But I found that second error, I mentioned above.

  9. kossut
    Member
    Posted 1 year ago #

    In other words - your solution is right, but there is porbably more places to change.

  10. djarzyna
    Member
    Plugin Author

    Posted 1 year ago #

    Yeah, Kossut. That is no surprise for me anymore. As I said just five minutes before I've found what causes this error and I will fix it. Thanks for your participation.

  11. kossut
    Member
    Posted 1 year ago #

    I run PHP 5.2.17

  12. djarzyna
    Member
    Plugin Author

    Posted 1 year ago #

    Yes, that's right. There are a couple more places. Basically all lines where you find an expression containing the ternary operator ?:

    Another solution of course would be to upgrade php to at least 5.3.

  13. djarzyna
    Member
    Plugin Author

    Posted 1 year ago #

    Guys, stay tuned. Right now I don't have the opportunity to change the code but I will do it asap. So most probably tomorrow this issue will be fixed.

  14. kossut
    Member
    Posted 1 year ago #

    I can only ask hosting provider for that. And I'll do it.

  15. kossut
    Member
    Posted 1 year ago #

    Ok. The provider allowed me to change PHP versions. Now it works. The plugin looks very nice! The only thing I would like to ask in next release is ability to upload photos by guest authors.

  16. djarzyna
    Member
    Plugin Author

    Posted 1 year ago #

    Ok, should work now even with php prior version 5.3.

  17. djarzyna
    Member
    Plugin Author

    Posted 1 year ago #

    I mark it as resolved.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.