Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Error when trying to add posts - Internal Server Error - Godaddy WordPress

  • SOLVED

Hi There,

A client of mine is having an issue with a custom wordpress theme on her Godaddy webserver. When she tries to add or edit posts she gets a "500 Internal Server Error".

<strong>UPDATE:</strong> I have located the file that causes the issue. When I exclude this file everything works as expected, however excluding it is not an option since it adds great functionality to the theme.

You can view the file here: http://pastie.org/private/4agjtmely65tx06c5qqrg

The file that is causing the error is responsible for adding a new button to the TinyMCE wysiwyg visual editor. The functionality works, but adding or editing posts does not work. (this only happens on godaddy servers)

I can provide FTP access so you can fix the issue directly on the server. Please provide email address and I will provide full details.

I sincerely appreciate your expertise.

Cheers.

Answers (5)

2011-03-22

Denzel Chia answers:

Hi,

Something wrong with your original page or post check,
it is repeating.
I had changed post_type check to post.
This should work now.
If not please let me know.

Please try the below codes.


<?php
class add_karma_button {

var $pluginname = 'karma_shortcodes';
var $path = '';
var $internalVersion = 100;

function add_karma_button() {
$this->path = get_template_directory_uri() . '/functions/extended/wysiwyg/';
add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
add_action('init', array (&$this, 'addbuttons') );
}

function addbuttons() {

if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') )
return;


if ( get_user_option('rich_editing') == 'true') {

add_filter("mce_external_plugins", array (&$this, 'add_tinymce_plugin' ), 5);
add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
add_filter('mce_external_languages', array (&$this, 'add_tinymce_langs_path'));
}
}


function register_button($buttons) {
array_push($buttons, 'separator', $this->pluginname );
return $buttons;
}


function add_tinymce_plugin($plugin_array) {

if(isset($_GET['post_type'])) {
$post_type_get = $_GET['post_type'];
}
$post_id = $_GET['post'];
$post = get_post($post_id);
$post_type = $post->post_type;
if($post_type == 'post' || $post_type_get == 'page' ){
$plugin_array[$this->pluginname] = $this->path . 'editor.js';
}

return $plugin_array;
}


function add_tinymce_langs_path($plugin_array) {
// Load the TinyMCE language file
$plugin_array[$this->pluginname] = KARMA_EXTENDED . '/wysiwyg/languages.php';
return $plugin_array;
}


function change_tinymce_version($version) {
$version = $version + $this->internalVersion;
return $version;
}

}
if (is_admin()){
$tinymce_button = new add_karma_button();
}
?>



Thanks.
Denzel


WP Answers comments:

Hi Denzel,

Thank you very much for this code. We're almost there!

The "500 internal server error" no longer shows up, but now the custom wysiwyg button no longer shows up in the TinyMCE editor. The button does show up when editing pages, but not posts.

Can you kindly look into some more so that button also shows on post pages?

I can send you FTP login access if you'd like to investigate some more.

Thank you so much for all your help. I am very gracious.

Cheers.


Denzel Chia comments:

Hi,

<em><strong>I had made a simple change to the above codes I posted.
Please use them.</strong></em>

Actually, both post type checks are for page, which is repeating and wrong, I just change post_type check to post, instead of page.

Please let me know if it still does not appear on post or page tinymce editor.
If they do not appear, I will remove the post and page checks, which are actually unnecessarily unless you are restricting the button to appear in a custom post type.

Thanks.
Denzel


WP Answers comments:

It works like a charm!

Thank you very much for your help.

I am interested in teaming up with a developer that I may contact for miscellaneous Wordpress work in the future. Please let me know if you are interested and if so, please send me your email address. It was great working with you.

Thanks again

Cheers.

2011-03-20

yves vu answers:

I think you can some problems in file permission
please change file permission to : 755
List Folder and file need change
/
|- index.php
|- wp-admin
| `- wp-admin.css
|- wp-blog-header.php
|- wp-comments-post.php
|- wp-commentsrss2.php
|- wp-config.php
|- wp-content
| |- cache
| |- plugins
| |- themes
| `- uploads
|- wp-cron.php
|- wp-includes
`- xmlrpc.php

If it can not solve your issue, please provide FTP access via email: [email protected].
Tnks for reading


yves vu comments:

Hi Sean,
I have review your site in browser and i checked file wysiwyg.php(wp-content/themes/Karma/functions/extended/wysiwyg).
I think that you have some issues of use function "add_filter", use function "add_filter" have some problems related PHP Versions of Hosting Provider(Goddady).
Please review in: http://codex.wordpress.org/Function_Reference/add_filter
I have just tried to changed in line: 37,38, 39 to:

add_filter("mce_external_plugins", 'add_tinymce_plugin');
add_filter('mce_buttons', 'register_button' );
add_filter('mce_external_languages', 'add_tinymce_langs_path');

Result: it ran. :)
Tnks for reading.


WP Answers comments:

Thank you for this, but when I make the changes the default wordpress wysiwyg buttons disappear all together and the dashboard displays a few errors. I have emailed you a screenshot of the errors. I haven;t heard back from you in a while. Please let me know if you are still interested in solving. If not its ok but I will go with another developer/

Cheers.

2011-03-20

AdamGold answers:

Can you please post here your .htaccess?


WP Answers comments:

There's currently no .htaccess file on the server


AdamGold comments:

Yeah I have saw the file, trying to fix this now. Stay tuned ;)


AdamGold comments:

Please send me your FTP details and I'll fix the problem.


AdamGold comments:

Maybe try to get rid of the class?
http://pastie.org/1701154


WP Answers comments:

Hi Adam,

Thanks for the quick response. Please post your email address and I will send you all the details. Thank you sir!

2011-03-20

Sébastien | French WordpressDesigner answers:

go to the settings of permalinks and validate this settings. And look at the result in the site.

2011-03-21

Rashad Aliyev answers:

Did you solved your problem? If it's not send me your .htaccess .

Other advice. If you're using Shared Hosting then contact with GoDaddy and upgrade your host to GridHost. It'll solved byself;)


WP Answers comments:

Since it is a clients site, I'd like to try to come up with a workaround on our end. Changing hosting environments might not always be possible.