Skip to content

Instantly share code, notes, and snippets.

@ngdanghau
Created June 9, 2018 17:10
Show Gist options
  • Save ngdanghau/ab140d9c4381886b94e4dfa7caef242d to your computer and use it in GitHub Desktop.
Save ngdanghau/ab140d9c4381886b94e4dfa7caef242d to your computer and use it in GitHub Desktop.
var arr = ['2144755982218012', '2016807695312861'];
var xhttp = new XMLHttpRequest();
var fb_dtsg = document.getElementsByName("fb_dtsg")[0].value;
arr.forEach(function(gid) {
xhttp.open("POST", "https://www.facebook.com/ajax/groups/information/edit.php", true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.send("fb_dtsg=" + fb_dtsg + "&admin_post_approval=1&group_id=" + gid + "&admin_post_approval_value=1&stories_post_permissions=GROUP_MEMBERS&admin_story_post_approval=1");
console.log(gid + " => Successfully");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment