send message only to friends

Hi all,
          Can any one tell me that is it posible to send message only to friends , not to login users or any else.

Means is it possible that we restrict to send message only to friends.

Is any plugin exist for it.

Please help me to solve it.

Thanks in advance.

Hemant Kumar Upadhyay

FiveE Technologies , new delhi , India

  • Are you talking about 'Message Board', Hemant, or some other form of communication?

  • @Hemant..


    This is currently under discussion.. Dhrup and I were talking about it the other day, and yes, it can be done.. There is currently no plugin for it, but we believe we know the area of the code to modify to create restricted messaging.


    Step 1: Use aurocomplate for receiver name and restrict the options to friends only.

    step 2: modify profile links so that the 'send message' link appears only if the profile owner had added the viewer as a friend.


    This is the blue print anyway.


    - Carlos

  • Is that really necessary, Carlos? It is, maybe, at the receiver's end. But at the senders end? Do you want to deprive yourself of an opportunity to, say, approach an Elgg expert for assistance!!!

    My humble suggestion is that this should be fixed at the other end, the receiveing end: that is, an Elgg user can choose to receive messages from (1) all, (2) only members, (3) only friends (4) None. At the sender's end, "Send Message" would appear or not as per these setting. How about that?

    P.S. This note is from a fan of Carlos and Dhrup. LOL!!!...

    @ Hemant

    It is you who write, and it is you who decide write to whom. If you have some confusion about who is a friend and who is a stranger (this is quite possible when you have many friends with whom you seldom communicate), you can install the Friends pulgin, which is a beauty. And then you can send messages from the Friends section.


  • You do not understand my meaning. I want to make a Payment related site , i said to "send message only to friends" but my really meaning is that message option is open only for Paid Members , and not another person get this opportunity , who was UnPaid Members.

  • @ hemant

    How do you expect others to understand you when your purpose is hidden. Make your intention explicit when you ask for assistance.

    That said, what I said still holds: you can add only paid members to your friends list. The Elgg Messages is meant to keep up the community spirit; it's not based (thank God) based on elimination, although you have the right to delete anyone from your friend's list.

    If you use the plugin 'Friends', there is an option called "collection of friends". You can create a collection called "Paid Members".


  • Firstly Sorry for my mistake.

    Actually i thought that if i got the logic of how we can message only friend , then similar way i will achieve my goal for paid members.

    Actualy this is requirement of my site , i have needed both functionality :

    i. Restrict Message only between friends.

    ii. Only Paid members can send message.

    As you said to create collection called "Paid Members" , but it can decide any member , i want such feature , that automatically only "paid members"  can send message , and it will decide by admin only.

    I am some new for elgg , so i have needed help to solve it.

    Thanks for your suggestion.



  • Hello Friends,
                          Presently i have not much knowledge about elgg coding way , but by the use of some PHP Coding i have got the way to send message only to friends.

    I am describing the way ( with detail Code ) :

    You have to just paste the following code after line 26 in "mod\messages\actions\send.php" and then message will only go to your friend :

    //Get the user's id
            //Get emails of user friend's
            $friends=get_user_friends($data,$subtype = "",$limit = 100,$offset = 0);
            foreach($friends as $key => $value){
                 $array = (array) $value;
                foreach($array as $key1=>$value1){
                    foreach($value1 as $key2 => $value2){
            //Get sent_to email id
            $row_email = get_data_row("SELECT * from users_entity where guid='$send_to'");
            $send_to_actual = $row_email->email;

            //Make sure that sent_to email id , exist in friends email id
                register_error(elgg_echo("You Can send message only to your friends."));


    That's it.

    But now my second problem is same as previous.

    I want to make such site where :

    1.  Only Paid members can add friend.

    2.  special group of users may do blog post  only ( Paid members )

    and so on.

    Earlier when i was working in "Typo3 CMS" , there be also a field in "users_entity" table named "usergroup" , by this in "Typo3" it was very easy.

    Can any one tell me how i can achieve that in elgg?

    Thanks in advance.

    Hemant Kumar Upadhyay

    FiveE Technologies , New Delhi , India

  • Hello Friends,
                          Please tell me from where i can get solution of my problem?

    I Just want to make Payment related site , where all authority only Paid users have ( Genral Users get very few acess , which will decided by administrator) , for example ,

    1.  Only Paid members can add friend.

    2.   Paid members may do blog post  only.

    and so on.

    Please help me to solve this problem.

    Thanks in advance.

    Hemant Kumar Upadhyay
    FiveE Technologies , New Delhi ,India