Objective: only approved buddies may send messages via a user's personal contact form.
Note: buddies require approval.

I think to start with a borrowed function like:

function _buddylistext_is_buddy($uid, $bid) {
  $isbuddy = db_result(db_query("SELECT * FROM {buddylist} WHERE uid = %d AND buddy = %d",$uid, $bid));
  return $isbuddy;
} 

to generate an $isbuddy value and something like

    if (!$isbuddy) {
	  $output = t('The user %name is not a buddy. You may only contact people in your buddylist.', array('%name' => $account->name));
    }

in "function contact_user_page()" but I don't know how to proceed without hacking the contact module which I think is best left untouched.

How to approach?

Comments

bobdalob’s picture

Sorry - that's borrowed from here