get_post_meta() problem again

So many issues here…

First, I’m not sure what this line is doing:

add_action('admin_menu', 'tweet_fetch1');

If you don’t actually have a function called tweet_fetch1 that runs when the admin loads, you should remove this add_action. And if you do have such a function, why is your add_action in this location? The first step to avoiding problems is clean, readable, commented code the groups functions and hooks them logically.

Second, in both of your functions, you’re trying to reference $post->ID where no post object is available. You can usually make it available by globalizing it.

global $post;

Third, your function called “tweet” accepts no arguments, yet when you call it from inside your append_the_content1() function, you’re trying to pass it the meta value for dbt_Username.

$content .= "<div class="post"><p>".tweet(get_post_meta($post->ID, 'dbt_Username', true))."</p></div>";

This is incorrect…and unnecessary, as you then grab the same meta value (again) from inside the tweet() function using get_post_meta. You need to remove the argument (the stuff between the parentheses) when you call the tweet() funciton. Like so:

$content .= "<div class="post"><p>".tweet()."</p></div>";

Lastly–though this is just a suggestion, and isn’t strictly something wrong with your code–I don’t know what all that preg replacing is for. If you’re trying to link to the original tweet, you can pull the URI right out of the twitter feed. Also, you can make links inside tweets clickable with WordPress’ handy make_clickable() function.

Your problem here isn’t with get_post_meta–it’s with PHP. No disrespect, but it would help you out tremendously to brush up on the basics so that you can better understand the code you’re writing, and the answers people are giving you.