i am trying to display comments by specific users at a custom area. i am successful to do that, but the problem is the permalink structure . this code gets the url as permalinks disabled, if i enable the permalinks from my settings , then these urls starts giving a 404.
here is the code im using :
<?
if(get_query_var('author_name')) :
$curauth = get_userdatabylogin(get_query_var('author_name'));
else :
$curauth = get_userdata(get_query_var('author'));
endif;
$querystr = "
SELECT comment_ID, comment_post_ID, post_title, comment_content
FROM $wpdb->comments, $wpdb->posts
WHERE user_id = $uid
AND comment_post_id = ID
AND comment_approved = 1
ORDER BY comment_ID DESC LIMIT 5
";
$comments_array = $wpdb->get_results($querystr, OBJECT);
if ($comments_array): ?>
<ul>
<? foreach ($comments_array as $comment):
setup_postdata($comment);
echo "<li><a href='". get_bloginfo('url') ."/?p=".$comment->comment_ID."'>Comment on ". $comment->post_title. "</a><br />". $comment->comment_content . "</li>";
endforeach; ?>
</ul>
<? endif; ?>
So this gets the url as www.mysite.com/p?=xxxx .. if permalinks are enabled as mysite.com/post-perma-links/ it starts giving 404 on these links generated via the above code. rest of the function is workign fine,
SO possible to get the permalink url in this case instead of the p?=xxx ? help is appreciated cheers