briank

Approve All Kartra Membership Comments

Sep 23rd, 2021
981
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * Console hack to approve all (remaining) Kartra membership comments.
  3.  * Author: Brian Katzung <briank@kappacs.com>
  4.  * 1) Open the comments moderation.
  5.  * 2) Reject any unwanted comments.
  6.  * 3) Copy and paste below this comment into the browser console
  7.  *    and press the enter key to approve all remaining comments.
  8.  * 4) Repeat (1) and (2), then enter approveAll() if you want to approve
  9.  *    all all of another membership's comments.
  10.  */
  11. let appLinks;
  12. function approveAll (reload = true) {
  13.   if (reload) {
  14.     appLinks = $('a.approve_link').toArray();
  15.     if (!appLinks.length || confirm('Approve ' + appLinks.length + ' comments?')) approveAll(false);
  16.   } else {
  17.     let link = appLinks.shift();
  18.     if (link) {
  19.       link.click();
  20.       setTimeout(() => approveAll(false), 500);
  21.     }
  22.     document.title = 'Remaining: ' + appLinks.length;
  23.   }
  24. }
  25. approveAll();
RAW Paste Data