How to disable specific message displayed by contrib/core? I am using the Disable Messages module to disable one of the message which is being displayed to the end user. The message is:


  Anonymous (not verified) has requested to be your Friend. View your
  pending friend requests to approve or decline.


To achieve this I have configured the module and written a regular expression to match a word from the message, But it seems to not be working.

Here is the code:

str.matches("(?i)(^|\\s+)(Anonymous (not verified))(\\s+|[.?!]$)");
Once a user has been deleted, The User relationships module have to delete all relationships associated to deleted user but it doesn't work correctly. I implemented hook_user_delete() in a custom module and delete non-approved relationships associated to the deleted user. like this:

/**
 * Implements hook_user_delete().
 */

function YOUR_MODULE_NAME_user_delete($account) {
  //user_relationships_delete_relationship($relationship, $user);
  db_delete('user_relationships')-&gt;condition('approved', 0 , '=')-&gt;condition(db_or()-&gt;condition('requester_id', $account-&gt;uid)-&gt;condition('requestee_id', $account-&gt;uid))-&gt;execute();
}