A
A
ArtemEfremov2019-07-02 17:45:10
PHP
ArtemEfremov, 2019-07-02 17:45:10

How to determine the admin(s) of a Vk conversation in Php?

I know this question has already been asked. Was in Node.js but I need to know how to do it in PHP? (How to determine the admin(s) of a Vk conversation in Php?) I will not write the code, because I know how to set the rights.
I will be grateful for the answer!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita, 2019-07-02
@ArtemEfremov

Through the messages.getConversationMembers method , for example. The is_admin
flag is attached to admins , if the person is the admin of the conversation, then is_admin = true, and if not, then the flag will either be false or simply hidden. In any case, this must be done through an array, for example, I have a bot and it determines the admins among all participants. But this is a small difference. We make a request to the method, make an array and take the data from the response in the array, which will return the request to the method to us. In the array, we check users with the is_admin flag. If you need a specific user, then set the condition: An example of an array with a condition:

//определение админа
     UsersChatInfo($peer_id, $group_id_plus, $token, $v); // функция, где вызывается метод
     foreach ($user_chat_Info['response']['items'] as $users) { 
      if ($from_id == $users['member_id']) if ($users['is_admin'] == 1) $adm = true;  //проверяем админа

member_id is the id of the user being searched for.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question