Answer the question
In order to leave comments, you need to log in
How to check if it is possible to leave a comment on a user's posts?
What am I doing wrong? Or the method doesn't work?
There are two test pages where one user can leave a comment on a post, while the other cannot.
I need to get this information, I try to get it using the users.get method with the fields=wall_comments parameter
In both cases I get wall_comments=1
How can I check if the user's posts are allowed to add comments?
Answer the question
In order to leave comments, you need to log in
The value of the parameter wall_comments
reflects the "Disable commenting on posts" setting in "General":
In addition, there are also privacy settings - “Posts on the page” - “Who can comment on my posts”, where you can set, for example, “Only me”, in fact, prohibiting everyone else from commenting:
This privacy setting does not affect the setting wall_comments
.
So the only option is to create a wall.createComment() comment and see if the 213 error returned.
Request a list of records of the user of interest using the Wall.Get method . In response, you get a list of post objects in the "items" field, and there in the "comments" field you can easily find the " can_post " field, the value of which will indicate whether the current user is allowed to leave comments on the posts on the wall of the requested user (1 - allowed, 0 - forbidden).
Wall.get and the [email protected]@.can_post parameter are responsible for this;
0 is impossible.
1 is possible.
var idgr = хххххххххх;
var com=API.wall.get({owner_id:idgr});
var [email protected]@.can_post;
return b;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question