This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install HTTParty gem: | |
# gem install httparty | |
require "httparty" | |
@nation_base_url = "https://#######.nationbuilder.com" # update this with your nation. | |
@api_token = "" # Generate a V2 API token in your nation's control panel and paste it here. | |
tag_id = "" # Update this with the ID of the tag you want to count. Use a tag that has many records. In my testing I used a tag with 41856 records. | |
path = "/api/v2/signups?filter[tag_id]=#{tag_id}&fields[signups]=id&page[size]=100" | |
tagged_record_ids = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/\d{4}/.exec(Date())[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tagged_record_ids = [] | |
next_path = "/api/v2/signups?filter[tag_id]=#{@tag.nb_id}&fields[signups]=id&page[size]=100" | |
while next_path | |
response = @nation.call_api(:get, next_path) | |
response_body = response.fetch(:body, {}) | |
ids = response_body.fetch("data", []).pluck("id").map(&:to_i) | |
tagged_record_ids += ids | |
next_path = response_body.fetch("links", {}).fetch("next", nil) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How to use it: | |
// 1. Create a filter for the people you want to delete from Paths. | |
// 2. Paste the below code into your browser's JS console. | |
// 3. Run removeFromPaths() when you're ready to start. | |
// A couple of notes: | |
// 1. This will delete them from all of the paths they're on, not just the specific Path you create a filter for. You could add a filter for a specific path name pretty easily. | |
// 2. This is hacky and not "proper". Use at your own risk. I'm sorry if this violates any NB terms of use. | |
function sleep(ms) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p style="text-align: center;">{% assign no_membership = true %} {% assign sorted_memberships = recipient.memberships | sort: 'started_at' | reverse %} {% for membership in sorted_memberships | limit: 1 %} {% assign no_membership = false %} {% if membership.status == "active" %} {% capture unixexpires %} {{ membership.expires_on | date: '%s' }} {% endcapture %} {% capture unixnow %} {{ 'now' | date: '%s' }} {% endcapture %} {% assign diff = unixexpires | minus: unixnow %} {% if diff < 5184000 %} {% comment %}THIS IS FOR MEMBERSHIPS EXPIRING SOON{% endcomment %}</p> | |
<p style="text-align: center;">{{recipient.first_name_or_friend}} -- Your {{ membership.membership_type_name }} membership expires on {{ membership.expires_on | date: '%B %d, %Y' }}. Renew now to continue enjoying your membership benefits.</p> | |
<div class="nb-tmce-btn" style="width: 200px; display: block; margin-left: auto; margin-right: auto;" contenteditable="false"><!--[if mso]> | |
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Include the membership array partial --> | |
{% include 'membership_array' %} | |
<!-- iterate through each ticket level --> | |
{% for ticket_level in page.event.ticket_levels %} | |
<!-- this sets the default for membersonly to false --> | |
{% assign membersonly = false %} | |
<!-- now we check whether the ticket level name contains "|members:" and if it does we set membersonly to true --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% assign memberships = '' %} | |
{% for membership in current_signup.memberships %} | |
{% assign memberships = memberships | concat: membership.membership_type_name | concat: ", " %} | |
{% endfor %} | |
{% assign memberships = memberships | downcase %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Include the membership array partial --> | |
{% include 'membership_array' %} | |
<!-- iterate through each ticket level --> | |
{% for ticket_level in page.event.ticket_levels %} | |
<!-- this sets the default for membersonly to false --> | |
{% assign membersonly = false %} |
NewerOlder