Plugin stopped working
-
Since I upgraded to 2.9, a plugin I wrote (for internal use) stopped working. I’ve been trying to look at any parameters which might have changed names, but couldn’t resolve any possibility. Can anyone have a quick look, and tell why it doesn’t work? I tried outputting statements to log-files in several parts, but plugin doesn’t even seem to be called…
function shorten_url() { global $post_ID, $wpdb, $table_name; $table_name = 'wp_5c4ujq_shorturl'; $post = get_post($post_ID); if (get_post_meta($post_ID, "short_url") != "") { return true; } $max_short = $wpdb->get_var("SELECT short FROM $table_name WHERE id = (SELECT MAX(id) FROM $table_name)"); $new_short = alphaincr($max_short); add_post_meta($post_ID, "short_url", "http://nwt.rs/" . $new_short, true); $link = get_permalink($post_ID); $title = $post->post_title; $content = $post->post_excerpt; $stamp = date(); $wpdb->insert($table_name, array('short' => $new_short, 'url' => $link , 'title' => $title), array('%s','%s','%s')); $length = strlen('http://nwt.rs/' . $new_short) + strlen('Nieuw artikel: '); if (strcmp($title, substr($title, 0, 140 - $length)) == 0) { $twitter_title = $title; } else { $twitter_title = substr($title, 0, 140 - $length - 3) . '...'; } to_twitter('Nieuw artikel: ' . $twitter_title . ' - http://nwt.rs/' . $new_short); to_facebook($title, 'http://nwt.rs/' . $new_short, $content); } add_action('publish_post', 'shorten_url');
The other functions that are called, have nothing to do with WP, and should work fine. I know code isn’t all that clean, but this is for internal use only.
All help is more than welcome !
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Plugin stopped working’ is closed to new replies.