
Tiny MCE Comments – Problems on iPhone
March 30th, 2010
Today at work we realized that Tiny MCE doesn’t work properly on the iPhone. At least MCEComments for WordPress doesn’t This prevented users from commenting from a mobile device on the MSU blogs. I fixed this pretty simply by doing browser detection in PHP before loading the files for MCEComments. I modified the loaders for the plugin. Only two modifications of the tinyMCEComments.php was neccesary.
// Line 311
function mcecomment_init() {
global $post;
if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), "iphone") === false) {
$loadJS = false;
if (is_plugin_page()) {
$loadJS = true;
} else if (is_singular()) {
if (comments_open() && ( !get_option('comment_registration') || is_user_logged_in() )) {
$loadJS = true;
}
}
if ($loadJS)
mcecomment_getInitJS();
}
}
// Line 350
function mcecomment_loadCoreJS() {
global $post, $mce_locale;
if (is_singular() && (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), "iphone") === false))
{
if (comments_open() && ( !get_option('comment_registration') || is_user_logged_in() )) {
wp_enqueue_script('tiny_mce', get_option('siteurl') .
'/wp-includes/js/tinymce/tiny_mce.js', false, '20081129');
wp_enqueue_script('tiny_mce_lang', get_option('siteurl') .
'/wp-includes/js/tinymce/langs/wp-langs-' . $mce_locale . '.js',
false, '20081129');
wp_deregister_script('comment-reply');
wp_enqueue_script( 'comment-reply', get_option('siteurl') .
'/wp-content/plugins/' . plugin_basename ( dirname ( __FILE__ ) ) .
"/comment-reply.dev.js", false, '20090102');
}
}
}
[ Tags ]: javascript, MCEComments, tincymcecomments, tiny MCE, wordpress
[ Category ]: programming
4 Responses to “Tiny MCE Comments – Problems on iPhone”
Leave a Reply




[...] reason doesn’t work with Tiny MCE preventing users from leaving comments on their iPhone. I talked about how I fixed it in a post on my blog already. This was only a three day week so I feel I made a lot of [...]
How you do it with iPad?
[...] Źródło: BrokenBytes [...]
Hi, I put your code about Tiny MCE iPhone problem in my article with links to your site. I couldn’t find email to write to You so I’m writing here. If its not ok by You let me know so I will remove it from my article http://www.wwit.pl/tiny-mce-comments-–-problemy-na-iphonie .
Cheers.