setTimeout(function () { window.location.assign('$url') }, 3600);"; return $confirmation; } /** * Fix GravityForms - Redirect form after save to setting in 'Confirmation' (not working in form). */ add_action( 'gform_after_submission_20', 'redirect_to_page', 10, 2 ); add_action( 'gform_after_submission_21', 'redirect_to_page', 10, 2 ); function redirect_to_page( $entry, $form ) { // Set the path for the redirection. switch($entry['form_id']) { case '20' : $location = '/sales-items/'; break; case '21' : $location = '/edit-payment-records/'; break; default : $location = '/'; } header('Location: '.$location); } /** * Create a button to edit/view a form via a post. */ // Get a link for the listing. function getRecordLink($id,$mode,$label,$link) { return("
". "". "". "". "
" ); } /** * Load the parents style sheet. */ add_action( 'wp_enqueue_scripts', 'total_child_enqueue_parent_theme_style' ); function total_child_enqueue_parent_theme_style() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css', [], wp_get_theme( 'Total' )->get( 'Version' ) ); } /** * Define the dynamic filters to pass to Ninja Tables for the WHERE clause of a query. */ add_filter('ninja_table_raw_sql_placeholders', function ($value) { // Save the number along with the parameters to be passed. $value['{unitName}'] = (isset($_REQUEST['unitName'])) ? $_REQUEST['unitName'] : ''; $value['{memberNum}'] = (isset($_REQUEST['memberNum'])) ? $_REQUEST['memberNum'] : ''; return($value); }); /** * Display the elected State Officers on the Officer's page. */ function displayOfficers($query) { // Get the names of the men in office. $result = getDbObject()->dbQuery($query); // Build the officers section. $buffer = '
'; foreach ($result as $officer) { $buffer .= "
"; $buffer .= $officer['one']."
".$officer['two']; $buffer .= "
"; } $buffer .= "
"; // Display results. return($buffer); } /** * Display the Chapter Presidents on the Officer's page. */ function directorsAndMembership($officeAbbr,$title) { // Get the list of members. $officerList = getDbObject()->dbQuery( "SELECT b.fullName ". "FROM wp_sar_officerList a, wp_sar_currentMembers b ". "WHERE a.officeAbbr = '$officeAbbr' and a.nationalNum = b.nationalNum ". "ORDER BY last, first, middle, suffix" ); // Are there any entries to add? if (sizeof($officerList) > 0) { // Format the title. $title = "
$title
"; // Add the names. foreach($officerList as $name) $title .= $name['fullName']."
"; } return($title); } /** * Determine the date the rotationals end on the Officer's page. */ function computeYear($offset) { $year = (date("m") < '3') ? date("Y") : (date("Y") + 1); return($year + $offset); } /** * Add a user to WordPress. */ function addUserToWordpress($first,$last,$generalNum,$email,$password,$zip) { // Can we create the user? $id = wp_create_user( $generalNum, $password, $email); if (!is_wp_error($id)) { // Can we add metadata to the account? $status = wp_update_user(array( 'ID' => $id, 'user_nicename' => $generalNum, 'display_name' => $first." ".$last, 'user_status' => 0, 'first_name' => $first, 'last_name' => $last, 'role' => 'subscriber', 'meta_input' => array( 'user_password' => $password, 'user_zip' => $zip ) )); } // Did an error occur? if (is_wp_error($id) || is_wp_error($status)) error_log("addUserToWordpress: ".print_r($id->get_all_error_data(),true)."User/Email: ".$generalNum."/".$email,1,G_WEBMASTER_EMAIL); return($status); } /** * Add a record to a form in the Gravity Forms' database. */ // Add the fields of the associative array to a new entry in Gravity Forms. function addGfEntry($form,$fieldArray) { // Built a new template. $newEntry = array( "form_id" => "", "date_created" => date("Y-m-d")." 00:00:00", "is_starred" => "0", "is_read" => "0", "ip" => "::1", "source_url" => "https://www.masssr.org/", "currency" => "USD", "created_by" => "1", "user_agent" => "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0", "status" => "active" ); // Add the date created and form identifier. $newEntry['date_created'] = date("Y-m-d H:m:s"); $newEntry['form_id'] = $form; // Add the data fields for the record. foreach($fieldArray as $key => $value) $newEntry[$key] = $value; // Add the record to the database. $entry_id = GFAPI::add_entry($newEntry); return($entry_id); } /** * Add transaction number to Authorize.net charge to the payment transaction. */ add_filter('gform_authorizenet_transaction_pre_capture', function( $transaction, $form_data, $config, $form, $entry ) { if ( $form['id'] == '25' ) { $transaction->invoice_num = rgar($entry,GF_TX_INVOICE_NUM_FIELD); $transaction->cust_id = rgar($entry,GF_TX_CUSTOMER_NUM_FIELD); } return $transaction; }, 10, 5 ); /** * Add line items to Authorize.net submission object before transaction is sent. */ add_filter( 'gform_submission_data_pre_process_payment_25', 'modify_submission_data_25', 10, 4); function modify_submission_data_25( $submission_data, $feed, $form, $entry ) { // Parse itm string to create an array of line items. $line_items = array(); $items = explode("<||>",rgar($entry,'38')); // Are there any items? if (sizeof($items) > 0) { // Repack each item in a collection of associative arrays foreach ($items as $item) if (strlen($item) > 10) { $pieces = explode("<|>",$item); $line_items[] = array( 'id' => $pieces[0], 'name' => $pieces[1], 'description' => $pieces[2], 'quantity' => $pieces[3], 'unit_price' => $pieces[4], 'options' => '' ); } // Replace the line items field in the submission. $submission_data['line_items'] = $line_items; } return($submission_data); } /** * TEMPORARY PROCEDURE FOR GUEST FORM. DELETE AFTER EVENT xxx */ add_filter( 'gform_field_validation_31_6', 'custom_validation_quantity', 10, 4 ); function custom_validation_quantity ( $result, $value, $form, $field ) { if ($result['is_valid'] && $_POST['input_6_3'] < '1') { $result['is_valid'] = false; $result['message'] = 'Quantity must be one or more'; } return $result; } /** * TEMPORARY PROCEDURE FOR GUEST FORM. DELETE AFTER EVENT xxx */ add_filter( 'gform_field_validation_31_9', 'custom_validation_national_number', 10, 4 ); function custom_validation_national_number( $result, $value, $form, $field ) { // Is there a member for the national number? $member = getDbObject()->dbQuery( "SELECT COUNT(*) as 'count' FROM wp_sar_currentMembers WHERE nationalNum = '".$_POST['input_9']."'" ); if ($result['is_valid'] && $member[0]['count'] == 0) { $result['is_valid'] = false; $result['message'] = 'No member found for national number'; } return $result; } /* * Do the national number and its confirmation match on 'update national number' form? */ add_filter( 'gform_field_validation_11_4', 'custom_validation', 10, 4 ); function custom_validation( $result, $value, $form, $field ) { // Do number and confirmation match? if ($result['is_valid'] && $_POST['input_3'] != $_POST['input_4']) { $result['is_valid'] = false; $result['message'] = 'New number does not match its confirmation'; } else { // Does member with national number already exist? $member = getDbObject()->dbQuery( "SELECT * FROM view_sar_get_membership_records WHERE nationalNum = '".$_POST['input_4']."'" ); // Flag error if so. if (sizeof($member) > 0) { $result['is_valid'] = false; $result['message'] = 'Member with national number already exists'; } } return $result; } /** * Change national number of member in membership record, and in the sales records on 'update national number'. */ add_action( 'gform_post_submission_11', 'update_national_number', 10, 2 ); function update_national_number( $entry, $form ) { // Update the general number if both arguments supplied. getDbObject()->dbQuery( "CALL sproc_sar_update_national_number('".$_POST['input_1']."','".$_POST['input_4']."')" ); } /** * Change user password - Does password and confirmation agree? Make change if so. */ add_filter( 'gform_field_validation_22_5', 'updateMemberPassword', 10, 4 ); function updateMemberPassword($result,$value,$form,$field ) { // Does the number and confirmation match? Reset password if so. if ($_POST['input_4'] != $_POST['input_5']) { $result['is_valid'] = false; $result['message'] = 'Password and conformation mismatch'; } else wp_update_user(array('ID' => $_POST['input_1'], 'user_pass' => $_POST['input_4'])); return($result); } /** * Update the roster of officers/members when a state or chapter officer changes. */ add_action( 'gform_after_submission_9', 'updateListOfOfficers', 10, 2 ); add_action( 'gform_after_submission_8', 'updateListOfOfficers', 10, 2 ); function updateListOfOfficers( $entry, $form ) { // Update the list of officers. getDbObject()->dbQuery( "CALL sproc_sar_create_officer_list();" ); // Update the highest office held in the membership records. getDbObject()->dbQuery( "CALL sproc_sar_set_highest_office()" ); } /** * Update the modified payment record after editing. */ add_action( 'gform_after_submission_21', 'update_payment_record', 10, 2 ); function update_payment_record( $entry, $form ) { $result = getDbObject()->dbQuery( "UPDATE wp_sar_salesPayments ". "SET nationalNum = '".$_POST['input_1']."' ". " amount = '".$_POST['input_8']."' ". " first = '".$_POST['input_3.3']."' ". " last = '".$_POST['input_3.6']."' ". " address = '".$_POST['input_7.1']."' ". " city = '".$_POST['input_7.3']."' ". " state = '".$_POST['input_7.4']."' ". " zip = '".$_POST['input_7.5']."' ". " phone = '".$_POST['input_5']."' ". " email = '".$_POST['input_4']."' ". " checkNum = '".$_POST['input_10']."' ". " dateOfCheck = '".$_POST['input_11']."' ". "WHERE invoiceNum = '".$_POST['input_2']."'" ); } /** * Add the check payment for the purchase to the purchases table. */ add_action('gform_after_submission_26', 'record_check_payment', 10, 2 ); function record_check_payment( $entry, $form ) { getDbObject()->dbQuery( "CALL sproc_sar_record_check_payment('".date("Y-m-d")."','".$entry['id']."')" ); } /** * Update life memberships when one is changed. */ add_action( 'gform_after_submission_18', 'updateLifeMembers', 10, 2 ); function updateLifeMembers( $entry, $form ) { // Gather the entry-ids of the records to update. $result = getDbObject()->dbQuery( "SELECT d.entryId, c.natLife, c.stateLife ". "FROM ( ". " SELECT ". " MAX(IF(meta_key='1',meta_value,'')) as 'nationalNum', ". " MAX(IF(meta_key='4',meta_value,'')) as 'natLife', ". " MAX(IF(meta_key='6',meta_value,'')) as 'stateLife' ". " FROM wp_gf_entry a, wp_gf_entry_meta b ". " WHERE a.form_id = '26' and a.id = b.entry_id and a.status = 'active' ". " GROUP BY b.entry_id ". ") c, wp_sar_currentMembers d ". "WHERE c.nationalNum = d.nationalNum" ); // Update the life-membership fields. foreach($result as $member) { GFAPI::update_entry_field($member['entryId'],"77",$member['natLife']); GFAPI::update_entry_field($member['entryId'],"79",$member['stateLife']); } // Return to the life membership page. header('Location: /life-memberships/'); } /** * Add new candidate to membership roster. */ function addCandidateToRoster($mapping) { // Update the fields for which data is provided. $newCandidateArray = array(); foreach($mapping as $key => $value) if (isset($_POST[$key])) $newCandidateArray[$value] = $_POST[$key]; // Add salutation, type of member, and type of application. $newCandidateArray['28.2'] = 'Mr.'; $newCandidateArray['29'] = 'Candidate'; $newCandidateArray['35'] = 'Type of applicant: '.$_POST['input_10'].'; Related to member: '.$_POST['input_7']; // Add candidate to roster of members. addGfEntry("6",$newCandidateArray); } // Add candidate referred by member. add_action( 'gform_after_submission_2', 'add_member_referred_candidate', 10, 2 ); function add_member_referred_candidate( $entry, $form ) { // Form 2 to Form 6 field mapping. $mapping = array( "input_1_3" => "28.3", "input_1_6" => "28.6", "input_2" => "6", "input_3" => "56", "input_15" => "64", ); // Add candidate to roster. addCandidateToRoster($mapping); } // Add candidate applied from public website. add_action( 'gform_after_submission_10', 'add_candidate_from_public_website', 10, 2 ); function add_candidate_from_public_website( $entry, $form ) { // Form 10 to Form 6 field mapping. $mapping = array( "input_3_3" => "28.3", "input_3_6" => "28.6", "input_5" => "6", "input_24_1" => "2.1", "input_24_2" => "2.2", "input_24_3" => "2.3", "input_24_4" => "2.4", "input_24_5" => "2.5", "input_15" => "56", "input_6" => "82", ); // Add candidate to roster. addCandidateToRoster($mapping); } /** * Lookup the emails, name, and officers of a chapter to recieve a request for an award or medal. */ add_action( 'gform_pre_submission_12', 'award_pre_submission_handler' ); add_action( 'gform_pre_submission_13', 'award_pre_submission_handler' ); add_action( 'gform_pre_submission_14', 'award_pre_submission_handler' ); function award_pre_submission_handler( $form ) { // Fields on eagle/ROTC/public-service forms with emails, name, and officers of chapter with state chair. $mappings = array( '12' => array('zip' => '35_5', 'emails' => '30', 'chairName' => '40', 'chapName' => '25', 'stateChair' => 'XESC'), // Eagle Scout '13' => array('zip' => '41_5', 'emails' => '40', 'chairName' => '45', 'chapName' => '25', 'stateChair' => 'XROTC'), // ROTC '14' => array('zip' => '33', 'emails' => '44', 'chairName' => '46', 'chapName' => '38', 'stateChair' => 'XROTC'), // Public Service ); // Identify the chapter for the zip code. $chapter = getDbObject()->dbQuery( "SELECT chapter FROM wp_sar_zipCountyRef WHERE zip = '".substr($_POST['input_'.$mappings[$form['id']]['zip']],0,5)."'" ); // Get the emails of the target officer. $details = getDbObject()->dbQuery( "SELECT GROUP_CONCAT(c.email SEPARATOR ',') as 'emails', MAX(c.fullName) as 'chairName', MAX(c.chapName) as 'chapName' ". "FROM ( ". " SELECT email, NULL as 'fullName', NULL as 'chapName' ". " FROM view_sar_get_all_officer_roster ". " WHERE officeAbbr = '".$mappings[$form['id']]['stateChair']."' ". " UNION ". " SELECT DISTINCT a.email, a.fullName, b.chapName ". " FROM view_sar_get_all_officer_roster a, wp_sar_chapterRef b ". " WHERE a.chapAbbr = '".$chapter[0]['chapter']."' AND officeAbbr in ('CAAM','CPRES') AND a.chapAbbr = b.chapAbbr". ") c;" ); // Add emails and name of chapter and their A&M chairman to form. $_POST['input_'.$mappings[$form['id']]['emails']] = $details[0]['emails']; $_POST['input_'.$mappings[$form['id']]['chairName']] = $details[0]['chairName']; $_POST['input_'.$mappings[$form['id']]['chapName']] = $details[0]['chapName']; } /** * Enter a member's change of address into his membership record (Form 9 --> Form 3). */ add_action( 'gform_after_submission_7', 'change_of_address_update', 10, 2 ); function change_of_address_update( $entry, $form ) { // Form 9 to Form 3 field mapping. $mapping = array( "input_1_1" => "2.1", "input_1_2" => "2.2", "input_1_3" => "2.3", "input_1_4" => "2.4", "input_1_5" => "2.5", "input_1_6" => "2.6", "input_3" => "6", "input_4" => "56", "input_5" => "32", "input_6" => "31", "input_9" => "82" ); // Is the entry_id provided? if (isset($_POST['input_8']) && is_numeric($_POST['input_8'])) { // Update the fields for which data is provided. foreach($mapping as $key => $value) if (isset($_POST[$key])) GFAPI::update_entry_field($_POST['input_8'],$value,$_POST[$key]); // Update the change in the membership record in to relational table. getDbObject()->dbQuery( "CALL sproc_sar_load_gf_member_to_mysql($_POST['input_8'])" ); } } /* * Test 'redirect' custom field when entering a page. Redirect if not logged in. */ add_action('template_redirect', 'verify_authentication'); function verify_authentication() { $id = get_queried_object_id(); if (!is_user_logged_in() && get_post_meta( $id, 'mef_redirect', true ) == "true") { auth_redirect(); exit; } } /* * On successful login, redirect to the URL specified by custom login form. */ add_action('wp_login', 'on_login_redirect', 10, 3); function on_login_redirect( $user_login, $user ) { if (isset($_REQUEST['redirect_to']) && strlen($_REQUEST['redirect_to']) > 0) wp_redirect($_REQUEST['redirect_to']); else wp_redirect( home_url() ); exit; } /** * On failed login, redirect user to login page. */ add_action( 'wp_login_failed', 'myprefix_redirect_after_login_fail' ); function myprefix_redirect_after_login_fail( $username ) { wp_redirect('/login'); exit(); } /** * Redirect user to the home page when user logs out. */ add_action('wp_logout','auto_redirect_after_logout'); function auto_redirect_after_logout(){ wp_redirect( home_url() ); exit(); } /** * Always direct users to the theme's login page. */ add_filter( 'login_url', 'new_login_page', 10, 3 ); function new_login_page( $login_url, $redirect, $force_reauth ) { $login_page = home_url( '/login/' ); return add_query_arg('redirect_to', $redirect, $login_page ); } /** * This function looks for the current users national number and email in the wp_User object. */ function getNationalNumberFromWordpress(&$number,&$email,&$password,&$zip) { $number = "0"; $email = ""; $login = ""; $zip = ""; // Does the current user exist? $current_user = wp_get_current_user(); if ($current_user->exists()) { // Get the General Number (not "-X" sufix) and email. $number = substr($current_user->user_nicename,0,6); $email = $current_user->user_email; // Is this a member's account? if (is_numeric($number)) { // Get member's login and zip. /* xxx $password = get_user_meta($current_user->ID,"user_password",false)[0]; $zip = get_user_meta($current_user->ID,"user_zip",false)[0]; */ $password = get_user_meta($current_user->ID,"user_password",false); $zip = get_user_meta($current_user->ID,"user_zip",false); } } } /** * Returns TRUE if the user is has privledges above subscriber. */ function is_user_privledged($stringOfRoles) { // Is the user logged in? $status = FALSE; if (is_user_logged_in()) { // Get reference to user. Split string into array of roles. $currentUser = wp_get_current_user(); $roleArray = explode(",",$stringOfRoles); // Is any privledge in the user's roles? foreach($roleArray as $role) if (in_array(trim($role),$currentUser->roles)) $status = TRUE; } return($status); } /** * Set the directory where files are uploaded by Gravity Forms. */ add_filter( 'gform_upload_path', 'change_scwma_upload_path', 10, 2 ); function change_scwma_upload_path( $path_info, $form_id ) { $path_info['path'] = G_UPLOAD_PATH; $path_info['url'] = G_UPLOAD_URL; return $path_info; } /** * Performs a query and places the result set in a form for a Gravity Forms * drop-down control. */ function buildDropdownList($query,$message = "") { // Create array for drop down. Start with blank item. $items = array(); $items[] = array( 'value' => '0', 'text' => $message, 'selected' => 'selected'); // Get the values for the dropdown. $result = getDbObject()->dbQuery($query); // Add the element to the dropdown. foreach ($result as $item) $items[] = array( 'value' => $item['value'], 'text' => $item['text']); // Assign the list to the field. return($items); } /** * Lookup the email of the state officer. Set email of notification to it. */ add_filter( 'gform_notification_1', 'set_receivers_email', 10, 3 ); function set_receivers_email ( $notification, $form, $entry ) { // Are we sending mail to state officer? if ($_POST['input_19'] == '0') { // Get the email of the state officer or chapter president. $result = getDbObject()->dbQuery( "SELECT email ". "FROM view_sar_get_all_officer_roster ". "WHERE officeAbbr = '".$_POST['input_10']."' OR ". " (chapAbbr = '".$_POST['input_10']."' AND officeAbbr = 'CPRES')" ); // Did we find an email? Add to notification. Add it to $entry. if (sizeof($result) == 1) { $notification['to'] = $result[0]['email']; GFAPI::update_entry_field($entry['id'],"24",$result[0]['email']); } } return($notification); } /** * Lookup the chaper and the email for the membership inquiry. Set email of notification to them. */ add_filter( 'gform_notification_2', 'set_member_referral_emals', 10, 3 ); function set_member_referral_emals( $notification, $form, $entry ) { // Get emails of state registrars and secretary. $result = getDbObject()->dbQuery( "SELECT GROUP_CONCAT(email SEPARATOR ';') as 'emails' FROM view_sar_get_all_officer_roster WHERE officeAbbr in ('SSEC','SREGG','SAREGG')" ); // Did we find the emails? Add emails to notification. Add fields to to $entry. if (sizeof($result) == 1) { $notification['to'] = $result[0]['emails']; GFAPI::update_entry_field($entry['id'],"17",$result[0]['emails']); } return($notification); } /** * Lookup the chaper and the email for the membership inquiry. Set email of notification to them. */ add_filter( 'gform_notification_10', 'set_inquiry_emails', 10, 3 ); function set_inquiry_emails ( $notification, $form, $entry ) { // Get emails of state/chapter registrars and chapter president. $result = getDbObject()->dbQuery( "SELECT a.chapter, GROUP_CONCAT(c.email SEPARATOR ',') as 'emails' ". "FROM wp_sar_zipCountyRef a, view_sar_get_all_officer_roster b, wp_sar_currentMembers c ". "WHERE ((a.chapter = b.chapAbbr AND b.officeAbbr in ('CPRES','CMBR')) OR b.officeAbbr = 'SREGG') AND ". " b.nationalNum = c.nationalNum AND ". " a.zip = '".substr($_POST['input_24_5'],0,5)."'" ); // Did we find the emails? Add emails to notification. Add fields to to $entry. if (sizeof($result) == 1) { $notification['to'] = $result[0]['emails']; GFAPI::update_entry_field($entry['id'],"19",$result[0]['chapter']); GFAPI::update_entry_field($entry['id'],"23",$result[0]['emails']); } return($notification); } /** * If creating a new membership record, take the next lowest temporary number available * and assign it to the national number field of the membership record. * */ add_action( 'gform_pre_submission_6', 'member_rec_pre_submission_handler' ); function member_rec_pre_submission_handler($form) { if ( $_POST['input_10'] == G_TEMP_MEMBERSHIPNUM) { // Get the next available temporary membership number. $result = getDbObject()->dbQuery( "SELECT MIN(nationalNum)-1 as 'newNum' FROM view_sar_get_membership_records WHERE nationalNum > '".G_TEMP_MEMBERSHIPNUM."'" ); // Add the number to the form. if (sizeof($result) == 1) $_POST['input_10'] = $result[0]['newNum']; } } /** * Forward user to membership maintance page after editing of member record. * (GravityForms "confirmation" is broken on form.) * */ add_action( 'gform_after_submission_6', 'update_membership_record', 10, 2 ); function update_membership_record( $entry, $form ) { wp_redirect("/maintain"); } /** * Dynamically initialize the drop downs with a list of members and the general * numbers and loads the dropdown with it. */ add_filter('gform_pre_render','populate_dropDowns'); add_filter('gform_admin_pre_render','populate_dropDowns'); function populate_dropDowns($form) { // Scan throught the fields and load them by type. foreach ($form['fields'] as &$field ) { if (strpos( $field->cssClass,'load_current_chapters') !== false) { // Get a list of current chapters by name. $result = buildDropdownList( "SELECT chapAbbr as 'value', chapName as 'text' ". "FROM wp_sar_chapterRef ". "ORDER BY chapName", "" ); $field->choices = $result; } else if (strpos( $field->cssClass,'load_venues') !== false) { // Get a list of locations for events. $result = buildDropdownList( "SELECT entry_id as 'value', name as 'text' ". "FROM view_sar_get_event_locations ". "ORDER BY name ", "" ); $field->choices = $result; } else if (strpos( $field->cssClass,'load_this_years_events') !== false) { // Get the list of current chapters. $result = buildDropdownList( "SELECT DISTINCT b.unitName as 'value', b.unitDesc as 'text' ". "FROM wp_sar_salesPayments a, wp_sar_salesOrders b ". "WHERE a.invoiceNum = b.invoiceNum AND YEAR(a.date) = '20".G_YEAR."' ". "ORDER BY b.unitDesc", "" ); $field->choices = $result; } else if (strpos( $field->cssClass,'load_membership_types') !== false) { // Get the list of current chapters. $result = buildDropdownList( "SELECT DISTINCT memberType as 'value', memberType as 'text' ". "FROM view_sar_get_membership_records ". "UNION ". "SELECT 'Statistics' as 'value', 'Statistics' as 'text'", "" ); $field->choices = $result; } else if (strpos( $field->cssClass,'load_everyone') !== false) { // Get the list of all members of any type. $result = buildDropdownList( "SELECT nationalNum as 'value', ".G_DB_NAME_LFMS." as 'text' ". "FROM view_sar_get_membership_records ". "ORDER BY last, first, middle, suffix", "" ); $field->choices = $result; } else if (strpos( $field->cssClass,'load_members') !== false) { // Get the list of active members. $result = buildDropdownList( "SELECT nationalNum as 'value', ".G_DB_NAME_LFMS." as 'text' ". // "FROM view_sar_get_membership_records ". "FROM wp_sar_currentMembers ". "WHERE memberType in (".G_CURRENT_MEMBER_TYPES.") ". "ORDER BY last, first, middle, suffix", "" ); $field->choices = $result; } else if (strpos( $field->cssClass,'award_agents') !== false) { // Get those who are allowed to grant awards. $result = buildDropdownList( "SELECT pk as 'value', agent as 'text' ". "FROM wp_sar_awardAgents ". "ORDER BY pk", "" ); $field->choices = $result; } else if (strpos( $field->cssClass,'awards_available') !== false) { // Get the list of awards available to grant. $result = buildDropdownList( "SELECT pk as 'value', award as 'text' ". "FROM wp_sar_awardsAvailable ". "ORDER BY pk", "" ); $field->choices = $result; } else if (strpos( $field->cssClass,'member_login_id') !== false) { // Get a list of all member from year one. $result = buildDropdownList( "SELECT a.id as 'value', CONCAT(".G_DB_NAME_LFMS.",' (',a.user_login,' - ',DATE_FORMAT(b.dob,'%m%d'),')') as 'text' ". "FROM wp_users a, view_sar_get_membership_records b ". "WHERE a.user_login = b.nationalNum AND a.user_login REGEXP '^[0-9]+$' ". "ORDER BY b.last, b.first, b.middle, b.suffix", "" ); $field->choices = $result; } else if (strpos( $field->cssClass,'load_venues') !== false) { // Get the venues where we hold events. $result = buildDropdownList( "SELECT entry_id as 'value', name 'text' ". "FROM view_sar_get_event_locations ". "ORDER BY name", "" ); $field->choices = $result; } } return($form); } /** * Use the two-letter state code rather than the full name of the state. */ add_filter( 'gform_us_states', 'us_states' ); function us_states( $states ) { $new_states = array(); foreach ( $states as $state ) { $new_states[ GF_Fields::get( 'address' )->get_us_state_code( $state ) ] = $state; } return $new_states; } ?> {"id":15319,"date":"2019-02-28T09:13:45","date_gmt":"2019-02-28T14:13:45","guid":{"rendered":"https:\/\/www.massar.org\/?p=15319"},"modified":"2024-02-05T19:55:23","modified_gmt":"2024-02-05T19:55:23","slug":"the-story-behind-a-forgotten-symbol-of-the-american-revolution-the-liberty-tree","status":"publish","type":"post","link":"https:\/\/massar.org\/the-story-behind-a-forgotten-symbol-of-the-american-revolution-the-liberty-tree\/","title":{"rendered":"The Story Behind a Forgotten Symbol of the American Revolution: The Liberty Tree"},"content":{"rendered":"

The Story Behind a Forgotten Symbol of the American Revolution: The Liberty Tree<\/title><\/p>\n<p>\nBy Erick Trickey<br \/>\n<a target=\"_blank\" href=\"https:\/\/www.smithsonianmag.com\/history\/story-behind-forgotten-symbol-american-revolution-liberty-tree-180959162\/\" rel=\"noopener noreferrer\">Smithsonian.com<\/a><br \/>May 19, 2016\n<\/p>\n<div style=\"width:400px;float:left;margin-right:10px\">\n<img decoding=\"async\" style=\"width:400px;\" src=\"\/wp-content\/uploads\/2019\/02\/16708487495_60c70cf28c.jpg\"\/><\/p>\n<p style=\"font-style:italic\">\nWhile Boston landmarks like the Old North Church still stand, the Liberty Tree, gone for nearly 250 years, has been lost to history.\n<\/p>\n<\/div>\n<p>On the night of January 14, 1766, John Adams stepped into a tiny room in a Boston distillery to meet with a radical secret society. “Spent the Evening with the Sons of Liberty, at their own Apartment in Hanover Square, near the Tree of Liberty,” Adams wrote.\n<\/p>\n<p>\nOver punch and wine, biscuits and cheese, and tobacco, Adams and the Sons of Liberty discussed their opposition to Britain’s hated Stamp Act, which required that American colonists pay a tax on nearly every document they created. Mortgages, deeds, contracts, court papers and shipping papers, newspapers and pamphlets \u2013 all had to be printed on paper with tax stamps.\n<\/p>\n<p>\nThe colonists were furious, but how to combat the Parliamentary action was a point of contention. Between Adams and his hosts, the methods differed. The future American president was resisting the tax with petitions, speeches and essays. His hosts, also known as the Loyal Nine, had threatened to lynch the king’s stampman.\n<\/p>\n<p>\nThrowing off the British and creating a new nation required a mix of Adams’ approach and the Loyal Nine’s: both high-minded arguments about natural rights and angry crowds’ threats and violence. After his visit, Adams assured his diary that he heard “No plotts, no Machinations” from the Loyal Nine, just gentlemanly chat about their plans to celebrate when the Stamp Act was repealed. “I wish they mayn’t be disappointed,” Adams wrote.\n<\/p>\n<p>\nThroughout these early years before the revolution, the ancient elm across from the distillery became Massachusetts’ most potent symbol of revolt. In the decade before the Revolutionary War, images of the Liberty Tree, as it became known, spread across New England and beyond: colonists christened other Liberty Trees in homage to the original.\n<\/p>\n<p>\nYet unlike Boston’s other revolutionary landmarks, such as the Old North Church and Faneuil Hall, the Liberty Tree is nearly forgotten today. Maybe that’s because the British army chopped down the tree in 1775. Or maybe it’s because the Liberty Tree symbolizes the violent, mob-uprising, tar-and-feathers side of the American Revolution \u2013 a side of our history that’s still too radical for comfort.\n<\/p>\n<p>\nThe tree was planted in 1646, just 16 years after Boston’s founding. Everyone traveling to and from the city by land would have passed it, as it stood along the only road out of town, Orange Street. (Boston sat on a narrow peninsula until the 1800s, when the Back Bay was filled in.) Though no measurements of the tree survive, one Bostonian described it as “a stately elm\u2026 whose lofty branches seem’d to touch the skies.”\n<\/p>\n<p>\nThe tree was almost 120 years old in March 1765, when the British Parliament passed the Stamp Act. After years of several other slights, including the Sugar Act’s taxes and the quartering of 10,000 British troops in North America, the colonies resisted. In Boston, opposition was led by the Loyal Nine, the band of merchants and artisans Adams encountered. The conspirators, including distillers, a painter, a printer, and a jeweler, wanted to go beyond the learned arguments about the inalienable rights of Englishmen taking place in newspapers and meeting halls. So, they staged a moment of political theater with symbols and actions anyone could understand.\n<\/p>\n<p>\nEarly in the morning of August 14, Bostonians discovered the effigy hanging from the tree. Initials pinned to the effigy, “A.O.,” identified it as Andrew Oliver, the Boston merchant who had agreed to collect the stamp tax. Next to him dangled a boot, a reference to Lord Bute, the former British prime minister whom many colonists blamed for the act. A small devil figure peeked up from inside the boot, holding a copy of the law. “What Greater Joy did ever New England see,” read a sign that hanged from one of the effigy’s arms, “Than a Stampman hanging on a Tree!”\n<\/p>\n<p>\nHundreds of Bostonians gathered under the elm, and a sort of party atmosphere broke out. “Not a Peasant was suffered to pass down to the Market, let him have what he would for Sale, ’till he had stopp’d and got his Article stamped by the Effigy,” the Boston Gazette reported. The sheriff came to cut down the effigy, but the crowd wouldn’t let him.\n<\/p>\n<p>\nAt 5 p.m. that day, shoemaker Ebenezer McIntosh \u2013 known for leading the South End’s brawlers in the annual anti-Catholic Pope’s Day riots \u2013 led several protesters as they put the effigy in a coffin and paraded it through Boston’s streets. “Liberty, property, and no stamps!” cheered the crowd of several hundred as they passed a meeting of Massachusetts’ governor and council at the Town House (now the Old State House). On the docks, some of the crowd found a battering ram and destroyed a building that Oliver had recently constructed. Others gathered outside Oliver’s house. “They beheaded the Effigy; and broke all the Windows next [to] the Street,” wrote Francis Bernard, the horrified governor of Massachusetts, “[then] burnt the Effigy in a Bonfire made of the Timber they had pulled down from the Building.” The mob also stormed into the house, splintered furniture, broke a giant mirror, and raided Oliver’s liquor supply. Oliver, who had fled just in time, sent word the next day that he would resign as stamp commissioner.\n<\/p>\n<p>\nThe Loyal Nine had teamed up with McIntosh because of his skills in turning out a crowd. But after he led a similar attack on Lieutenant Governor Thomas Hutchinson’s house on August 26, they decided he’d gone too far. A town meeting at Faneuil Hall voted unanimously to denounce the violence. Going for a more lofty symbolism, the Loyal Nine attached a copper plate to the elm a few weeks later. “Tree of Liberty,” it read.\n<\/p>\n<p>\nThe tree’s potency as rally site and symbol grew. Protesters posted calls to action on its trunk. Towns in New England and beyond named their own liberty trees: Providence and Newport, Rhode Island; Norwich, Connecticut; Annapolis, Maryland; Charleston, South Carolina. Paul Revere included the Liberty Tree, effigy and all, in his engraved political cartoon about the events of 1765.\n<\/p>\n<p>\nWhen news of the Stamp Act’s repeal reached Boston in March the following year, crowds gathered at the Liberty Tree to celebrate. The bell of a church close to the tree rang, and Bostonians hanged flags and streamers from the tree. As evening came, they fastened lanterns to its branches: 45 the first night, 108 the next night, then as many as the tree’s branches could hold.\n<\/p>\n<p>\nFor a decade, as tensions between the colonies and Britain grew, Boston’s rowdiest, angriest demonstrations took place at the Liberty Tree. “This tree,” complained loyalist Peter Oliver (Andrew Oliver’s brother), “was consecrated for an Idol for the Mob to Worship.” In 1768, the Liberty riot, a protest over the seizure of John Hancock’s ship, ended when the crowd seized a customs commissioner’s boat, dragged it from the dock to the Liberty Tree, condemned it at a mock trial there, then burned it on Boston Common. In 1770, a funeral procession for Boston Massacre victims included a turn past the tree. In 1774, angry colonists tarred and feathered Captain John Malcom, a British customs official, for caning a shoemaker, then took him to the Liberty Tree, where they put a noose around his neck and threatened to hang him unless he cursed the governor. (He didn’t, and they didn’t.)<\/p>\n<div style=\"width:350px;font-style:italic;float:right;margin-left:10px;font-size:22px; text-align:right;line-height:125%;\">\nUnmindful of names or distinctions they came,<br \/>\nFor freemen like brothers agree,<br \/>\nWith one spirit endued, they one friendship pursued,<br \/>\nAnd their temple was Liberty Tree\u2026\n<\/div>\n<p>\nIn 1775, after war broke out, Thomas Paine celebrated the Liberty Tree in a poem published in the Pennsylvania Gazette, celebrating its importance to all Americans, including the common man:\n<\/p>\n<p>\nFinally, in August of that year, four months after Lexington and Concord, British troops and loyalists axed the tree down. (It reportedly made for 14 cords of firewood — about 1,800 cubic feet.)\n<\/p>\n<p>\nAfter the British evacuated Boston on March 17, 1776, revolutionary Bostonians tried to reclaim the site. They erected a “liberty pole” there on August 14, the 11th anniversary of the first protest. In the years to come, Boston newspapers occasionally mentioned the site of the Liberty Stump. But it didn’t last as a landmark — even though the Marquis de Lafayette included it in his 1825 tour of Boston. “The world should never forget the spot where once stood Liberty Tree, so famous in your annals,” Lafayette declared.\n<\/p>\n<p>\nThomas Jefferson did the most to make the Liberty Tree a lasting metaphor, with his 1787 letter that declared, “The tree of liberty must be refreshed from time to time with the blood of patriots & tyrants.” Since then, Boston and the world have done a spotty job of following Lafayette’s advice.\n<\/p>\n<p>\nToday, the spot where the Liberty Tree stood, at Washington and Essex streets in Boston, is marked by a bronze plaque lying at ground level in an underwhelming brick plaza. Across the street, an 1850s wooden carving of the tree still adorns a building. The site was left out of Boston’s Freedom Trail. Historian Alfred F. Young thought that wasn’t an accident. “[Boston’s] Brahmin elite fostered a willful forgetting of the radical side of the Revolution,” he argued in his 2006 book Liberty Tree: Ordinary People and the American Revolution. It’s one thing, in this telling, to celebrate the Battle of Bunker Hill and let the Boston Tea Party symbolize revolutionary mischief, another thing to celebrate mobs who threatened hangings, ransacked houses, tarred and feathered. A 23-foot-tall silver aluminum Liberty Tree, created for the 1964 World’s Fair, later moved to Boston Common, where it failed miserably to become a landmark; in 1969, Boston officials scrambled to find a new home for the widely despised eyesore with little-to-no historical context. There is, however, a democratic argument for remembering the Liberty Tree. “The Revolution has a different meaning if you start here,” Nathaniel Sheidley, director of public history at the Bostonian Society, told the Boston Globe in 2015. “It wasn’t all about guys in white wigs.”\n<\/p>\n<p>\nToday, Boston’s Old State House museum displays part of the flag that flew above the Liberty Tree. It also houses one of the lanterns that decorated the tree at the Stamp Act repeal celebration on March 19, 1766 — 250 years ago this month. Last August 14, on the 250th anniversary of the Liberty Tree’s first protest, several history and activist groups gathered at Washington and Essex, carrying lanterns. And next year, the city of Boston hopes to start construction of an upgraded Liberty Tree Park at the site \u2013 and plant a new elm there.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Story Behind a Forgotten Symbol of the American Revolution: The Liberty Tree By Erick Trickey Smithsonian.comMay 19, 2016 While Boston landmarks like the Old North Church still stand, the Liberty Tree, gone for nearly 250 years, has been lost to history. On the night of January 14, 1766, John Adams stepped into a tiny…<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,3],"tags":[],"post_series":[],"class_list":["post-15319","post","type-post","status-publish","format-standard","hentry","category-reviews","category-history","entry","no-media"],"_links":{"self":[{"href":"https:\/\/massar.org\/wp-json\/wp\/v2\/posts\/15319"}],"collection":[{"href":"https:\/\/massar.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/massar.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/massar.org\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/massar.org\/wp-json\/wp\/v2\/comments?post=15319"}],"version-history":[{"count":0,"href":"https:\/\/massar.org\/wp-json\/wp\/v2\/posts\/15319\/revisions"}],"wp:attachment":[{"href":"https:\/\/massar.org\/wp-json\/wp\/v2\/media?parent=15319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/massar.org\/wp-json\/wp\/v2\/categories?post=15319"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/massar.org\/wp-json\/wp\/v2\/tags?post=15319"},{"taxonomy":"post_series","embeddable":true,"href":"https:\/\/massar.org\/wp-json\/wp\/v2\/post_series?post=15319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}