Have you tried using get_comment_link( $post_comment_id );
?
Hi Shane,
Thanks for your reply. Would $post_comment_id be passed into the wp_insert_comment actioner function?
As an example, when I add a comment to a BP activity, I get a comment object like the one below passed into the wp_insert_comment handler.
[comment_ID] => 108
[comment_post_ID] => 1385
[comment_author] => SW
[comment_author_email] =>
[comment_author_url] =>
[comment_author_IP] =>
[comment_date] => 2015-04-15 06:23:01
[comment_date_gmt] => 2015-04-15 13:23:01
[comment_content] => test comment
[comment_karma] => 0
[comment_approved] => 1
[comment_agent] =>
[comment_type] =>
[comment_parent] => 0
[user_id] => 34
if I get_comment_link(108) or get_permalink($comment->comment_post_ID), I get URLs returned, but both give 404 errors. If I go into the WordPress admin panel and go into ‘Comments’ I can see the comment and the URL given is the same as the one given by get_comment_link, but when I try to access it I get the 404. If I go into the admin panel and select Activities, I can see the same comment, but “View Activity” takes me to the activity panel, were I can see the parent activity and the post successfully.
So I’m struggle to tie in the comment object I’m getting above and its URL, with the BP activity/comment URL.
Any assistance would be greatly appreciated,
Thanks,
Stuart
Please use the code
button when posting code.
If I go into the admin panel and select Activities, I can see the same comment, but “View Activity” takes me to the activity panel, were I can see the parent activity and the post successfully.
As you can see, the url is being rewritten when you click on ‘view activity’.
You can either figure how the url is being rewritten.
Or create your own url using the fields from the comment object.
Something like:
$url = bp_core_get_userlink( comment[user_id] ) . '/activity/' . comment[comment_ID] . '/';
bp_core_get_userlink()
Hi Shane,
Thank you for your help.
I can see two comments in the Activity screen, with IDs 105 & 109. Both have the same “View Activity” URL http://oursite.com/activity-stream/p/362. I’m not clear yet how 105 and 109 are mapped to activity 362, but I’ll do some digging.
Thank you,
Stuart