Adham Mohamed
asked 5 years ago


I wanna ask about how can i speed up the Ajax request when creating a custom notifications?

My site for multi Artists, They can submit their art work.

I’m using another two plugins “User Following System” and “Post like system“.

So far I have create an custom notifications using ” DW Notifications ” for those plugins.

One when a user follow another users, and one when a user liked another users posts.

They are working but the response time takes more time to send the notification for the logged in users, and I don’t know why.

Kindly check our site at and take a look.

Thanks & Regards.

Adham Mohamed
replied 5 years ago

Hello brother,
I don’t mean to bother you, But I’m still waiting to fix that, I saw you was online on our site, and I think you checked that.
Kindly help me, Thank you!

1 Answers
answered 5 years ago

I sent and notified to our technical team about this question, we will check and discuss about it.

Adham Mohamed
replied 5 years ago

Thanks so much, I just need you to create an account on our site and try to follow some user or like any users post, You will see the button loading too much for the success response!
And if I deactivated the notifications var with ” //dwnotif_add_notification($user_to_follow, $notif); ” the buttons working so fast!
So I think something went wrong.
Kindly check what I have done.

function pwuf_follow_user_notifications( $user_id, $user_to_follow ) {

$user_id = get_current_user_id();

$follower = get_userdata($user_id);
$follower_url = get_author_posts_url( $user_id );
$recipient = get_userdata($user_to_follow);
$recipient_email = $recipient->user_email;
$body = sprintf(‘%s followed your work!’. “\n\n”, $follower->display_name );
$body .= sprintf( ‘Visit Artist Page: %s’, $follower_url );

$title = ‘‘.$follower->display_name.’ ‘ . __(‘followed your work’, ‘dw-notifications’);
$image = get_avatar( get_the_author_meta( ‘ID’, $follower->ID ), 60 );
$avatar_arr = test_avatar();
$notif = array(‘title’=>$title, ‘link’ => $follower_url, ‘image’ => $avatar_arr );

$headers = array(‘Content-Type: text/html; charset=UTF-8’);
ob_start(); ?>

New follower at

<a style="text-decoration: none; color: #191919; font-weight: 700;" href="”>display_name; ?> followed your work

<a class="btn" style="color: #222222; border-radius: 3px; text-decoration: none; background-color: #ffc526; padding: 7px 20px; font-size: 14px; font-family: Helvetica Neue, Helvetica, Arial, sans-serif;" href="”>Follow Back →


$message = ob_get_contents();


dwnotif_add_notification($user_to_follow, $notif);
wp_mail( $recipient_email , 'New follower!', $message, $headers, $body );

add_action('pwuf_post_follow_user', 'pwuf_follow_user_notifications', 10, 2 );

Powered by DW Question & Answer Pro