-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable notifications doesn't work #46
Comments
@andrei90vs same issue here. |
No ... I used existing notification and I positioned where I wanted. |
oh ok... I'm still trying to figure out a way of having all notifications consistent throughout all activity types. |
Any news for notifications? |
I have added a hook that fires when something is liked. I use that hook to send notification on likes. do_action('bp_like_added', $item_id, $user_id); The hook is added in this pull request and the code that adds notifications is: // Add notification for likes
function zombie_like_added($liked_item_id, $user_id) {
global $wpdb;
$statement = 'SELECT * FROM wp_bp_activity WHERE id = ' . $liked_item_id;
$results = $wpdb->get_results( $statement, OBJECT );
// Determin like level
if ($results[0]->item_id == "0" || $results[0]->item_id == "1") {
$root_level = true;
$root_item = $results[0]->id;
}else{
$root_level = false;
$root_item = $results[0]->item_id;
}
$liker_id = $user_id;
$like_owner = $results[0]->user_id;
$args = array(
'user_id' => $like_owner, // Recieves notification
'item_id' => $root_item, // The item that was liked
'secondary_item_id' => $liker_id, // The liker
'component_name' => 'zombie_likes',
'date_notified' => bp_core_current_time(),
'is_new' => 1,
);
// Get root activity
$activity = bp_activity_get_specific(array( 'activity_ids' => $root_item));
$activity = $activity['activities'][0];
$activity->user_id;
// Root or sub level like
switch ($root_level) {
case true:
$args['component_action'] = 'new_zombie_like_' . $liked_item_id . "_" . $liker_id;
break;
case false:
$args['component_action'] = 'new_zombie_sub_like_' . $liked_item_id . "_" . $liker_id;
break;
}
// Do not add notification when liking own item
if ($activity->user_id != $liker_id && $like_owner != $liker_id) {
bp_notifications_add_notification( $args );
}
}
add_action('bp_like_added', 'zombie_like_added', 10, 2); |
Thank you very very very much @fried-eggz ! It works! |
No problem @manu89ft. Glad to share. @darrenmeehan you should really look at getting this fixed. I have submitted a pull request (se above) to add a hook and the code i posted here can be used to make notifications work. |
I forked the plugin and copied the above code in my functions.php file ,still i dint get a notification |
Hi , I tried to use this option but doesn't work and I have installed BuddyPress Live Notification, do you know how can I use both of them ? thx.
The text was updated successfully, but these errors were encountered: