Skip to content

Instantly share code, notes, and snippets.

@damncabbage
Forked from BinaryMuse/README.md
Last active September 15, 2020 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save damncabbage/1e20b4ba83d02fb74d98293b2d0ef044 to your computer and use it in GitHub Desktop.
Save damncabbage/1e20b4ba83d02fb74d98293b2d0ef044 to your computer and use it in GitHub Desktop.
Change your profile photo for all meetup groups

I haven't found a way to set your main profile photo on meetup.com such that it overrides any old photos you have set in individual groups. This script will do just that — set your group specific profile photo to your main photo for every group you're in.

Here's what to do:

  1. Go to your main profile page: http://www.meetup.com/profile/
  2. Ensure you've set your main profile photo to the photo you want to use in all your groups.
  3. Open your browser's developer tools (often F12 on Windows, cmd+opt+i on macOS), copy the following code, paste it in the Console tab, and press enter:
var memberId = 56746842; // <=== Edit this
  
(async function() {
  var imageSrc = document.querySelector('#member-profile-photo img').getAttribute('src')
  var match = /member_(\d+)\./.exec(imageSrc)
  if (!match) {
    console.error(`Couldn't find your photo ID! Are you on https://www.meetup.com/profile ?`)
    return
  }
  var imageId = match[1]

  var groups = new Set()
  Array.from(document.querySelectorAll('[data-chapterid]'))
    .map(el => el.getAttribute('data-chapterid'))
    .forEach(groups.add.bind(groups))

  for (var groupId of [...groups]) {
    console.log(`Changing profile photo for ${groupId}`)
    try {
      await $.post('https://www.meetup.com/api/', {
        method: 'makeGroupProfilePhoto',
        arg_member: memberId,
        arg_chapter: groupId,
        arg_memberPhotoId: imageId,
      })
    } catch (err) {
      console.error(`Failed to change profile photo for ${groupId}`)
    }
  }

  console.log(`Done!`)
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment