Title: [Plugin: WPBook] Fatal Error when publishing post
Last modified: August 19, 2016

---

# [Plugin: WPBook] Fatal Error when publishing post

 *  Resolved [efeb](https://wordpress.org/support/users/efeb/)
 * (@efeb)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/plugin-wpbook-fatal-error-when-publishing-post/)
 * when publishing post i’m getting this:
 * Fatal error: Cannot redeclare wpbook_safe_publish_to_facebook() (previously declared
   in /home/krakoff/ftp/krakoff.info/wp-content/plugins/wpbook/publish_to_facebook.
   php:6) in /home/krakoff/ftp/krakoff.info/wp-content/plugins/wpbook/publish_to_facebook.
   php on line 179
 * except that message plugin works.

Viewing 15 replies - 1 through 15 (of 35 total)

1 [2](https://wordpress.org/support/topic/plugin-wpbook-fatal-error-when-publishing-post/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/plugin-wpbook-fatal-error-when-publishing-post/page/3/?output_format=md)
[→](https://wordpress.org/support/topic/plugin-wpbook-fatal-error-when-publishing-post/page/2/?output_format=md)

 *  [HumbleHumans](https://wordpress.org/support/users/humblehumans/)
 * (@humblehumans)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/plugin-wpbook-fatal-error-when-publishing-post/#post-1796071)
 * I am having the same error, line referencet to 179 included. This is just a guess
   and I’m really not sure, but it might have something to do with the Gravatar 
   rating setting.
 * I had the beta version working flawlessly, it wasn’t till I made two changes 
   that I received the error. Change the first was the addition of the “Super Cat
   Listener” plugin. Change the second was selecting a Gravatar rating under commenting
   options which previously remained unselected.
 * I was able to go back and delete the questionable plugin. Unfortunately I am 
   notable to unselect a Gravatar rating and forced to choose one of the radio buttons
   supplied.
 * That said I could be completely wrong… please help!
 *  Plugin Contributor [B.](https://wordpress.org/support/users/bandonrandon/)
 * (@bandonrandon)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/plugin-wpbook-fatal-error-when-publishing-post/#post-1796200)
 * [@efab](https://wordpress.org/support/users/efab/) what verison of WPBook? I 
   think this message is just happening randomly but we’ve had several reports. 
   I expericed it for a breif time then it went away.
 *  Plugin Author [John Eckman](https://wordpress.org/support/users/johneckman/)
 * (@johneckman)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/plugin-wpbook-fatal-error-when-publishing-post/#post-1796201)
 * This is an error with 2.0.10 – not sure why you only see it some times.
 * I just checked into SVN a newer version of 2.0.10 with the duplicate functions
   removed – should show up on the “[other versions](http://wordpress.org/extend/plugins/wpbook/download/)”
   page in the next 30 minutes.
 * Please test and let me know if that solves your problems.
 *  Thread Starter [efeb](https://wordpress.org/support/users/efeb/)
 * (@efeb)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/plugin-wpbook-fatal-error-when-publishing-post/#post-1796206)
 * [@johneckman](https://wordpress.org/support/users/johneckman/)
 * while publishing i’m getting this:
 * Warning: include_once(/home/krakoff/ftp/krakoff.info/wp-content/plugins/wpbook/
   client/facebook.php) [function.include-once]: failed to open stream: No such 
   file or directory in /home/krakoff/ftp/krakoff.info/wp-content/plugins/wpbook/
   includes/publish_to_facebook.php on line 8
 * Warning: include_once() [function.include]: Failed opening ‘/home/krakoff/ftp/
   krakoff.info/wp-content/plugins/wpbook/client/facebook.php’ for inclusion (include_path
   =’.:/usr/local/lib/php’) in /home/krakoff/ftp/krakoff.info/wp-content/plugins/
   wpbook/includes/publish_to_facebook.php on line 8
 * Fatal error: Class ‘Facebook’ not found in /home/krakoff/ftp/krakoff.info/wp-
   content/plugins/wpbook/includes/publish_to_facebook.php on line 26
 * post is published on blog but not on FB, so i moved ‘client’ folder back to root
   directory. after that while publish i’m getting:
    Fatal error: Cannot redeclare
   wpbook_safe_publish_to_facebook() (previously declared in /home/krakoff/ftp/krakoff.
   info/wp-content/plugins/wpbook/includes/publish_to_facebook.php:6) in /home/krakoff/
   ftp/krakoff.info/wp-content/plugins/wpbook/includes/publish_to_facebook.php on
   line 179
 * I checked in taco html editor php syntax and i’ve get:
    Parse error: parse error
   in /wpbook/includes/TacoHTMLEditPHPCheckTemp.php on line 42 Errors parsing /wpbook/
   includes/TacoHTMLEditPHPCheckTemp.php
 *  Plugin Author [John Eckman](https://wordpress.org/support/users/johneckman/)
 * (@johneckman)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/plugin-wpbook-fatal-error-when-publishing-post/#post-1796207)
 * Ah – I see an error that crept in in the 2.0.10 push – just checked in a new 
   version of the file.
 * wpbook/includes/publish_to_facebook.php, line 8, should be:
 *     ```
       include_once(WP_PLUGIN_DIR.'/wpbook/includes/client/facebook.php');
       ```
   
 * (The path includes the “includes” dir between wpbook and “client”).
 * The “cannot redeclare” errors come from a bad copy of 2.0.10 on Brooke’s blog–
   get the version from the wordpress.org/extend/plugins/wpbook/download page.
 * What is Taco HTML Editor?
 *  Thread Starter [efeb](https://wordpress.org/support/users/efeb/)
 * (@efeb)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/plugin-wpbook-fatal-error-when-publishing-post/#post-1796208)
 * I’ve got the newest version of plugin from that location.
    Taco HTML Editor is
   a free Mac software i use for editing php files.
 * I’ve changed line 8 and i’m still getting:
 * Fatal error: Cannot redeclare wpbook_safe_publish_to_facebook() (previously declared
   in /krakoff.info/wp-content/plugins/wpbook/includes/publish_to_facebook.php:6)
   in /krakoff.info/wp-content/plugins/wpbook/includes/publish_to_facebook.php on
   line 179
 *  Plugin Author [John Eckman](https://wordpress.org/support/users/johneckman/)
 * (@johneckman)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/plugin-wpbook-fatal-error-when-publishing-post/#post-1796209)
 * From which location did you pull 2.0.10?
 * The error you’re getting suggests that you do not have the latest from the SVN
   repository as you would not have a line 179.
 * Try the latest “development version” from [http://www.wordpress.org/extend/plugins/wpbook/download/](http://www.wordpress.org/extend/plugins/wpbook/download/)
 * I’ve no idea what’s causing the parse error with Taco HTML Editor but you’d have
   to look to them for support.
 *  Thread Starter [efeb](https://wordpress.org/support/users/efeb/)
 * (@efeb)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/plugin-wpbook-fatal-error-when-publishing-post/#post-1796211)
 * i’ve downloaded version 2.0.10. from ‘development version’ and i’ve got this:
 * Fatal error: Cannot redeclare wpbook_safe_publish_to_facebook() (previously declared
   in /krakoff.info/wp-content/plugins/wpbook/includes/publish_to_facebook.php:6)
   in /krakoff.info/wp-content/plugins/wpbook/includes/publish_to_facebook.php on
   line 182
 *  Plugin Author [John Eckman](https://wordpress.org/support/users/johneckman/)
 * (@johneckman)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/plugin-wpbook-fatal-error-when-publishing-post/#post-1796212)
 * Not sure what’s going on, but line 182 in my version (which is direct from SVN
   trunk and should be the same as the development version) is just this:
    `} //
   end of wpbook_safe_publish_to_facebook`
 * Which is just an end function and comment.
 * How many lines long is your wpbook_safe_publish_to_facebook.php file? Or how 
   many KB is it?
 *  Thread Starter [efeb](https://wordpress.org/support/users/efeb/)
 * (@efeb)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/plugin-wpbook-fatal-error-when-publishing-post/#post-1796213)
 * > How many lines long is your wpbook_safe_publish_to_facebook.php file? Or how
   > many KB is it?
 * it’s 184 line long but the last one is empty
    and it’s 12 KB
 *  Plugin Author [John Eckman](https://wordpress.org/support/users/johneckman/)
 * (@johneckman)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/plugin-wpbook-fatal-error-when-publishing-post/#post-1796215)
 * Hmm. That error just doesn’t make sense to me given that line 182 is just a comment.
 * Have you tried deactivating and deleting the whole plugin directory and reinstalling?
 * Sorry to not be more helpful but the error doesn’t make sense to me here.
 *  [dasfisch](https://wordpress.org/support/users/dasfisch/)
 * (@dasfisch)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/plugin-wpbook-fatal-error-when-publishing-post/#post-1796340)
 * So, I’ve upgraded my version to 2.2.3. This issue still happens: Fatal error:
   Cannot redeclare wpbook_safe_publish_to_facebook() (previously declared in __FILE__/
   publish_to_facebook.php:6) in __FILE__/publish_to_facebook.php on line 403.
 * I’m writing a simple script to get all of the unpublished posts, and publish 
   them. For some reason, when I run wp_publish_post(), that error gets throw. What’s
   stranger is that error gets thrown on the third post. What does WPBook have to
   do with individual posts, especially in reference to publishing a single post?
   Why does that error get thrown when publishing posts?
 *  [dasfisch](https://wordpress.org/support/users/dasfisch/)
 * (@dasfisch)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/plugin-wpbook-fatal-error-when-publishing-post/#post-1796341)
 * To anyone having an issue, I figured out what the problem is.
 * NOTE: I am using WPBook 2.2.3! So any lines I put in here might be incorrect!
 * That said…
 * In the wpbook.php file, there is a function wpbook_publish_to_facebook() on line
   1029. This is the function called through the hook, ‘draft_to_publish.’ This 
   hook was causing the issue we were all seeing. The issue is every time I called
   wp_publish_post, that hook was running the wpbook_publish_to_facebook() function.
   Here’s where the problem lies:
 * `
    if (!version_compare(PHP_VERSION, '5.0.0', '<')) { include(WP_PLUGIN_DIR .'/
   wpbook/includes/publish_to_facebook.php'); }
 * All that code is doing is making sure we are running PHP5.0.0 or higher. This
   means, any time this function is called, we are going to reinclude the publish_to_facebook.
   php file. Ergo, we are going to have redefinition of wpbook_publish_to_facebook().
   This will cause that error to get throw.
 * Here’s what the code should look like to ensure we don’t have redefinition errors:
 * `
    if (!version_compare(PHP_VERSION, '5.0.0', '<')) { if(!function_exists('wpbook_publish_to_facebook')){
   include(WP_PLUGIN_DIR .'/wpbook/includes/publish_to_facebook.php'); } }
 * Please make use of this as you see fit! It will clear up any redefinition errors
   you have with wpbook_publish_to_facebook()!
 * Cheers!
 *  Plugin Author [John Eckman](https://wordpress.org/support/users/johneckman/)
 * (@johneckman)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/plugin-wpbook-fatal-error-when-publishing-post/#post-1796342)
 * The other approach, which is what’s in the current dev version and just hasn’t
   yet been released, is just to use include_once rather than include.
 * Thanks for sharing your troubleshooting, and sorry that we haven’t pushed this
   code change out yet – it’s been sitting on the queue waiting for another release.(
   See the entry in the dev log from 6 weeks ago: [http://plugins.trac.wordpress.org/log/wpbook/](http://plugins.trac.wordpress.org/log/wpbook/)).
   I was waiting to bundle this change in with some others and then got sidetracked.
 * To those following along, this becomes an issue when multiple posts get published
   at the same time, which you often see on imports or syndication style models,
   like autoblogger.
 *  [dasfisch](https://wordpress.org/support/users/dasfisch/)
 * (@dasfisch)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/plugin-wpbook-fatal-error-when-publishing-post/#post-1796343)
 * That definitely be good a start. I would definitely add in the function_exists
   call, as well, in case some one decides to get crazy and ends up redefining the
   function. This will protect both aspects.
 * And not a problem at all. Gives me a chance to delve into the code more. I know
   how it can get maintaining code, especially when there’s a lot on your plate.
 * Thanks for the plugin, by the way!

Viewing 15 replies - 1 through 15 (of 35 total)

1 [2](https://wordpress.org/support/topic/plugin-wpbook-fatal-error-when-publishing-post/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/plugin-wpbook-fatal-error-when-publishing-post/page/3/?output_format=md)
[→](https://wordpress.org/support/topic/plugin-wpbook-fatal-error-when-publishing-post/page/2/?output_format=md)

The topic ‘[Plugin: WPBook] Fatal Error when publishing post’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wpbook_eeeeee.svg)
 * [WPBook](https://wordpress.org/plugins/wpbook/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wpbook/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wpbook/)
 * [Active Topics](https://wordpress.org/support/plugin/wpbook/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wpbook/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wpbook/reviews/)

 * 35 replies
 * 6 participants
 * Last reply from: [TraciBunkers](https://wordpress.org/support/users/tracibunkers/)
 * Last activity: [14 years, 8 months ago](https://wordpress.org/support/topic/plugin-wpbook-fatal-error-when-publishing-post/page/3/#post-1796377)
 * Status: resolved