I’d like to update this function so that it also imports a link to the status and the time it was posted.
Here’s the original
function do_tweet_post($tweet) {
global $wpdb;
remove_action('publish_post', 'aktt_notify_twitter', 99);
$data = array(
'post_content' => $wpdb->escape(aktt_make_clickable($tweet-> tw_text))
, 'post_title' => $wpdb->escape(trim_add_elipsis($tweet->tw_text, 30))
, 'post_date' => get_date_from_gmt(date('Y-m-d H:i:s', $tweet->tw_created_at))
, 'post_category' => array($this->blog_post_category)
, 'post_status' => 'publish'
, 'post_author' => $wpdb->escape($this->blog_post_author)
);
}
The element that I’m trying to edit is 'post_content'. Here’s what I’ve tried so far:
...
'post_content' => $wpdb->escape(aktt_make_clickable(
$tweet-> tw_text.' from '.
'<a href="http://www.twitter.com/1beb/statuses/"'.
tw_id.'>Twitter</a> '.
tw_created_at
))
...
I’m not very familiar with PHP so I don’t know if my syntax is correct, or how to deal with this particular type of referencing (->). I recall that you can concatenate strings using ''.''.''. etc, but not sure if it’s valid for a case like this.
I apologize for the lack of context, if there’s something else I can add to make it clearer, please advise.
TIA
UPDATE
Here is aktt_make_clickable for passerby:
function aktt_make_clickable($tweet) {
$tweet .= ' ';
$tweet = preg_replace_callback(
'/(^|\s)@([a-zA-Z0-9_]{1,})(\W)/'
, create_function(
'$matches'
, 'return aktt_profile_link($matches[2], \' @\', $matches[3]);'
)
, $tweet
);
$tweet = preg_replace_callback(
'/(^|\s)#([a-zA-Z0-9_]{1,})(\W)/'
, create_function(
'$matches'
, 'return aktt_hashtag_link($matches[2], \' #\', \'\');'
)
, $tweet
);
if (function_exists('make_chunky')) {
return make_chunky($tweet);
}
else {
return make_clickable($tweet);
}
}
I believe you missed out the
$tweetobject on your code.Try this:
Updated after seeing the
aktt_make_clickable()code update from original poster:Since you are hacking the plugin to make it display your own text, I guess you should be able to enter the link directly:
(I noticed that you wish to insert author as well but from your code I cannot tell what’s the proper variable name for author).