I'm not fully understanding what you are trying to do and what exactly is not working as intented as your English is very difficult to follow (sorry to say that...). When looking at the code I see one thing that seems maybe not as intended though. You have two indendent if-clauses (which might result in two annotations getting created) that check for logged in user != entity->owner and then logged in user = entity->owner. How about this structure:
if ($entity->annotate('generic_comment',$comment_text,$entity->access_id, $_SESSION['guid'])) {
if ($entity->owner_guid != elgg_get_logged_in_user_guid()) {
...
} else if ($entity->owner_guid == elgg_get_logged_in_user_guid()) {
...
} else
register_error(elgg_echo("generic_comment:failure"));
}
}
Maybe restructuring the code this way will also solve the problem you have.
sorry, because of my english.
I, understood what are you trying to tell. But I tried all of this(mrans restructuring the code)
But I am not able to notify the assigned member when task owner comments .
Please review my notify function and the if condition to check if task owner comments.
if ($entity->annotate('generic_comment',$comment_text,$entity->access_id, $_SESSION['guid'])) {
if ($entity->owner_guid != elgg_get_logged_in_user_guid()) {
notify_user($entity->assigned_to, $_SESSION['user']->getGUID(), elgg_echo('generic_comment:email:subject'),
sprintf(
elgg_echo('generic_comment:email:body'),
$entity->title,
$_SESSION['user']->name,
$comment_text, $entity->getURL(),
$_SESSION['user']->name,
$_SESSION['user']->getURL()
)
);
system_message(elgg_echo("generic_comment:posted")); //add to river add_to_river('annotation/annotate','comment',$_SESSION['user']->guid,$entity->guid);
}
$entity->assigned_to is something I don't know anything about. As I said in your other post assigned_to seems not to be used anywhere in Elgg core. If this attribute is defined and used in your plugin it has to get assigned the correct value before using it within the notify_user() function. This function expects the first parameter to be the GUID of the user that should receive the notification. I don't know what happens in the code before the part you posted or in any other files of this plugin.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.