S
S
Stanislav2017-08-02 21:34:36
In contact with
Stanislav, 2017-08-02 21:34:36

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

3 answer(s)
S
Sergey Sokolov, 2017-08-02
@ms-dred

The value of the parameter wall_commentsreflects 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.

D
Daniel, 2017-08-03
@Dyaminigo

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).

U
userfordownload, 2017-08-04
@userfordownload

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;

1f28fa6e79b940268fecdb7a4cbe11b5.JPG

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question