• Resolved pmerr

    (@pmerr)


    This is a great plugin: I’ve been using it on an intranet page for the people whom I teach in a long-distance training course, as it’s a good way to share information in real-time without having to send out a whole bunch of emails.

    One suggestion though: it’d be great if there were more custom options on the Twitter side of things.

    For example, I would love to be able to overwrite the automatic tweet and put in a more informative sentence. Having the first 140 characters of a live blog post is often very meaningless, unfortunately, and there’s no way to click through directly to the live blog page either so that a student can quickly see what it was all about.

    I’m not well-versed in the nitty gritty of working with WordPress, but perhaps we should be able to type a custom tweet in a textbox, and the plugin could test whether the post author has typed in a value. If there is a value, the plugin could send that as the tweet instead of the automatic 140-character string.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author chrisnorthwood

    (@chrisnorthwood)

    Hi,

    That’s a good suggestion. Unfortunately I don’t have the free time to work on this plugin any more, but if someone wants to code this functionality (it doesn’t sound too difficult) I’d be more than welcome to integrate it

    Chris

    Thread Starter pmerr

    (@pmerr)

    No problems Chris. ??

    Opening this up to people more competent than me… with my rather miserable grasp of PHP and plugin coding knowledge, I have composed the following:

    Adding a “meta box”:

    add_meta_box('custom_tweet_box', __('Custom Tweet', 'live-blogging'), 'custom_tweet', 'liveblog_entry', 'side');

    and…

    function custom_tweet(){
         global $post;
         $metac = get_post_meta($post->ID, 'custom_tweet', true);
         echo '<textarea name="custom_tweet">' . $metac . '</textarea>';
    }
    
    add_action("save_post", "save_details");
    
    function save_details($post_id) {
         global $post;
    
         if(isset($_POST['post_type']) && ($_POST['post_type'] == "liveblog_entry")) {
              $data = $_POST['custom_tweet'];
              update_post_meta($post_id, 'custom_tweet', $data);
         }
    }

    Anyone have ideas how to modify the Tweet settings so that it takes this instead of the post entry? The box itself works – it saves the “Custom Tweet” entry whenever I save the entry as a draft – but I can’t get the plugin to use $data instead of $content to generate the Tweet.

    Plugin Author chrisnorthwood

    (@chrisnorthwood)

    The ‘live_blogging_tweet’ function is your friend, there’s a line which is $content = filter_var($post->post_content, FILTER_SANITIZE_STRING);, if you change that to $content = filter_var(get_post_meta($id, 'custom_tweet', true), FILTER_SANITIZE_STRING);, then that should sort it. Of course, you probably want to then check if it’s empty, and if so, default to the other one, but that should do!

    Thread Starter pmerr

    (@pmerr)

    Excellent, that now works! I’ll need to do one or two tweaks (it only seems to store the custom tweet if I save the entry as a draft first) but otherwise it’s working smoothly. Thanks Chris.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Live Blogging] Suggestion: more Twitter customizability’ is closed to new replies.