Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter michaelw_dc

    (@michaelw_dc)

    A new post was just published, and both the Twitter share and the LinkedIn share have the same incorrect URL. They’ll probably fix it soon, but you might be able to see it live if you happen to be around. Regardless, here are the relevant URLs and supporting documents.

    Social Accounts:

    Twitter Account with Post: https://twitter.com/PfRTorg
    LinkedIn Company Page with Post: https://www.linkedin.com/company/ruraltransformation/

    Social Share Embedded Links:

    LinkedIn Shortened URL: https://lnkd.in/dC32-z9q
    Twitter Shortened URL: https://t.co/yBQcC06tXy?amp=1

    Post Links:

    The incorrect post link is: https://www.ruraltransformation.org/blog/financing-rural-america-webinar/To
    The correct post link is: https://www.ruraltransformation.org/blog/financing-rural-america-webinar

    Also see screenshots:

    https://www.ruraltransformation.org/wp-content/uploads/2021/08/prt-linkedin-auto-share.jpg
    https://www.ruraltransformation.org/wp-content/uploads/2021/08/prt-twitter-auto-share.jpg

    It probably won’t be useful, but I copied the share markup for you:

    https://www.ruraltransformation.org/wp-content/uploads/2021/08/prt-twitter-share-markup.txt
    https://www.ruraltransformation.org/wp-content/uploads/2021/08/prt-linked-share-markup.txt

    • This reply was modified 3 years, 3 months ago by michaelw_dc.
    Thread Starter michaelw_dc

    (@michaelw_dc)

    They state that they will be posting something this afternoon or on Monday. I’ll try to let you know when they do, but I might not be notified quickly enough, and you might not be available soon enough to take your observations, before they fix it manually. So, I will try to get in and copy the markup that is posted to LinkedIn when it goes live.

    Thread Starter michaelw_dc

    (@michaelw_dc)

    The URL that was being shared was this one: https://www.ruraltransformation.org/blog/policy-brief-equity-in-federal-housing-and-community-development-funding-a-proposal-for-a-national-floor/

    It was posted to this LinkedIn company page:
    https://www.linkedin.com/company/ruraltransformation/

    NOTE: When the content editor noticed that the URL was incorrect, he manually changed the post on LinkedIn, so you cannot see the problem now.

    I’ve seen this before while trying to get my own multi-column block working. It was related to my “name” for the InnerBlock’s layouts property’s objects (ie: el(InnerBlocks, {layouts: [{name: ‘some-name’, …}, {name: ‘some-other-name’, …}])

    The names have to be consistent (ie, first column name should always be column-1, or columnA, or whatever, and the second column should always be column-2, or columnB, or whatever). In my case, I had been changing the names of the columns based upon other user-configured characteristics.

    However, I don’t see you using layouts, so this anecdote may not help you.

    Thread Starter michaelw_dc

    (@michaelw_dc)

    Also, this problem exists in cc_class.php function getSubscribers.

    Yup, that’s a a solution. When I initially started troubleshooting this issue, I wasn’t aware what the problem was. If I had known that before I put in the work to determine the source of the problem, I would have done it your way. But perhaps this information can help the plugin developer come up with a proper fix for this problem.

    Also, I realized I left out part of the export_feed function in my last post. Here’s my full, modified export_feed function:

    
        public static function export_feed($entry, $form, $feed, $api){
            $email_field_id = $feed["meta"]["field_map"]["email_address"];
            $email = $entry[$email_field_id];
            $merge_vars = array('');
            foreach($feed["meta"]["field_map"] as $var_tag => $field_id){
    
                $field = RGFormsModel::get_field($form, $field_id);
    			$field_type = RGFormsModel::get_input_type($field);
    
                if($field_id == intval($field_id) && $field_type == "address") {
                	//handling full address
                    $merge_vars[$var_tag] = self::get_address($entry, $field_id);
    			} elseif( $var_tag == "country_code" && $field_type == "address" ) {
                    // translate the country name from the GF address field into a country code
                    $merge_vars[$var_tag] = GFCommon::get_country_code(trim($entry[$field_id]));
                } elseif( $var_tag == "state_code" && $field_type == "address" ) {
                    // assuming that anything longer than two characters is a state name, as returned by the "US" version of the address field
                    if(strlen(trim($entry[$field_id])) > 2) { 
                        // translate the state name from the GF address field into a state code. 
                        // GFCommon::get_us_state_code returns the original argument if it doesn't exist, so this is safe for non-US states
                        $merge_vars[$var_tag] = GFCommon::get_us_state_code(trim($entry[$field_id]));
                    } else {
                        // Just set it.  If its a valid two-letter abbreviation, great.  If not, oh well!  GIGO.
                        $merge_vars[$var_tag] = $entry[$field_id];
                    }
                } elseif( $field_type == 'date' ) {
    				$merge_vars[$var_tag] = apply_filters( 'gravityforms_constant_contact_change_date_format', $entry[$field_id] );
                } else {
                    $merge_vars[$var_tag] = $entry[$field_id];
    			}
            }
    
            $retval = $api->listSubscribe($feed["meta"]["contact_list_id"], $merge_vars, "html");
    
           if( !is_wp_error( $retval ) && !empty($retval)) {
               self::add_note($entry["id"], __('Successfully added/updated in Constant Contact.', 'gravity-forms-constant-contact'));
            } else {
    
                $error = '';
                if( is_wp_error( $retval ) ) {
                    $error = ': '.$retval->get_error_message();
                }
    
                self::add_note($entry["id"], __('Errors when adding/updating in Constant Contact', 'gravity-forms-constant-contact') . $error );
            }
        }
    

    I ran into this same issue, and delved into the plugin code to see what was going on. Ultimately, I found that if you’re using the US-configured version of the GravityForms address field, the state and country fields are set to the full name of their respective values.

    For example, if you select Texas, the constant contact plugin will pull “Texas” for the state, and “United States” for the country. This happens regardless whether you map it to state_name or state_code, and country_name or country_code.

    Unfortunately, mapping those values to state_name or country_name do nothing on the Constant Contact site. No translation, they are simply blanked out. So for my form, state_name and country_name serve no purpose and should never be mapped. And of course, if you map them to state_code and country_code, they are invalid and will result in either silent add-failure or blanked-out state/country in the CC contact entry.

    My fix for this is to never use state_name or country_name AND to replace function export_feed (constant_contact.php, line 1170) with this:

    
    public static function export_feed($entry, $form, $feed, $api){
        $email_field_id = $feed["meta"]["field_map"]["email_address"];
        $email = $entry[$email_field_id];
        $merge_vars = array('');
        foreach($feed["meta"]["field_map"] as $var_tag => $field_id){
    
        $field = RGFormsModel::get_field($form, $field_id);
        $field_type = RGFormsModel::get_input_type($field);
    
        if($field_id == intval($field_id) && $field_type == "address") {
            //handling full address
            $merge_vars[$var_tag] = self::get_address($entry, $field_id);
        } elseif( $var_tag == "country_code" && $field_type == "address" ) {
            // translate the country name from the GF address field into a country code
            $merge_vars[$var_tag] = GFCommon::get_country_code(trim($entry[$field_id]));
        } elseif( $var_tag == "state_code" && $field_type == "address" ) {
            // assuming that anything longer than two characters is a state name rather than a state code
            if(strlen(trim($entry[$field_id])) > 2) { 
                // translate the state name from the GF address field into a state code. 
                // GFCommon::get_us_state_code returns the original argument if it doesn't exist, so this is safe for non-US states
                $merge_vars[$var_tag] = GFCommon::get_us_state_code(trim($entry[$field_id]));
            } else {
                // Just set it.  If its a valid two-letter abbreviation, great.  If not, oh well!  GIGO.
                $merge_vars[$var_tag] = $entry[$field_id];
            }
        } elseif( $field_type == 'date' ) {
            $merge_vars[$var_tag] = apply_filters( 'gravityforms_constant_contact_change_date_format', $entry[$field_id] );
        } else {
            $merge_vars[$var_tag] = $entry[$field_id];
        }
    }
    

    Additionally, in order to keep my change in place, I’ve disabled update notifications for this plugin.

    All-in-all, I don’t think this is a terribly good fix for state_code, because it ignores Canada (there are three type settings for GF Address Field: International, United States, and Canadian). Canadian provinces won’t get translated to their two-digit abbreviations. Also, for International, the state field is a free-text field. I sort of addressed that by testing the length of the state in the above code snippet, but its not terribly robust.

    Also, I can foresee problems with International form visitors. How do you know which to set? state_code or state_name? And even if you do, will Constant Contact handle state_name correctly? In my US-specific testing, it did not.

    You could possibly set both state_name AND state_code, cross your fingers and hope it submits (however, I came across an old bug report from 2008 at Constant Contact’s API v1 discussion forums where you cannot set both and expect good results–I’m not certain if it was ever corrected). See https://community.constantcontact.com/t5/Developer-Support-ask-questions/Error-when-updating-a-Contact-with-StateCode/td-p/20264

    Forum: Plugins
    In reply to: [Flickr Gallery] HTTPS API

    I updated all instances of https://api.flickr.com to https://api.flickr.com within the file: phpFlickr.php.

    It appears to be working for me without further modification.

Viewing 8 replies - 1 through 8 (of 8 total)