Answer the question
In order to leave comments, you need to log in
Is the person subscribed to such a group and did he leave photos there?
Good day! Is it possible to find out somehow through the VK API whether a person is subscribed to the same groups as me and whether he left photos there? How can this be done in JS? Thanks in advance.
Answer the question
In order to leave comments, you need to log in
The users.getSubscriptions() method returns the user's subscriptions. If user_id is not specified, it will return your subscriptions. Here is such a simple code in the execute() procedure (insert it right on that page and “Execute”) will return two arrays: yours and its group id:
var uid=12345;
return {
"my": API.users.getSubscriptions().groups.items,
"her": API.users.getSubscriptions({"user_id":uid}).groups.items
};
var r =
{"response":.....} // тут целиком ответ из метода execute
; // и точка-с-запятой в конце.
var common = []; // сюда попадут id общих групп
for(var i=0;i<r.response.my.length;i++){
if( !!~r.response.her.indexOf( r.response.my[i]))
common.push(r.response.my[i]);
}
common; // если в Scratchpad Firefox'а нажать Ctrl+L,
// код выполнится а в коммент вставится содержание этого массива
find out if a person is subscribed to the same groups as me
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question