Is it possible to block users from sending messages?


This would be really helpful, as people would be able to stop a conversation if someone is being really annoying, especially if they get one email per message.
Just a simple button like for favorites, to block/unblock an user, directly in messages and or on the user page, next to the message icon.

1 Like



Unfortunately, there’s no such feature; it would require a custom implementation.

Also, please check this topic How to ban users - #5 by sergii

​I hope this is helpful to you.

Ok, well I wouldn’t be against a paid plugin for managing blocking/unblocking user, it would be very similar to the favorite plugin, without any new pages to render, just an icon and block/unblock in the message (if the message plugin is installed).

In the meantime, I will have to write something, I think I’ll just do as you did with favorites and messages: adding blocked users in the comment table, with comment_post_ID as the blocked_user_id, comment_type as hp_blocked, and user_id as current_user_id . I guess it won’t break anything adding a new comment_type?

Then if I get results from the database, I show ‘unblock user’, else 'block user".

And activate Block and unblock button using some jquery and a single php page that would insert or delete the line using wp_insert_comment(), with some conditions to prevent people accessing the page without permission.

It won’t be as clean as what you did, but I guess this should work. I didn’t get my head into coding for a while. Wish me luck.

Sure, if you use a separate comment meta field for storing the blocked user ID it should be ok. You can use the Development forum here if you need some general guidance. Good luck :slightly_smiling_face:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.