{"id":1958212,"date":"2023-10-13T07:49:47","date_gmt":"2023-10-13T11:49:47","guid":{"rendered":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/?p=1958212"},"modified":"2024-01-25T13:46:33","modified_gmt":"2024-01-25T18:46:33","slug":"fix-the-country-name-when-importing-from-meetup","status":"publish","type":"post","link":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/fix-the-country-name-when-importing-from-meetup\/","title":{"rendered":"Fix the Country Name When Importing from Meetup"},"content":{"rendered":"\n<iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/6XdXZ3FxLV8?si=4QENOc9So7XsiYBE\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe>\n\n\n\n<p class=\"has-theme-palette-8-background-color has-background\"><strong>Note:<\/strong> As of <a href=\"https:\/\/theeventscalendar.com\/release-notes\/the-events-calendar\/the-events-calendar-6-3-1\/\">The Events Calendar 6.3.1<\/a>, this feature is now included in the plugin, and the snippet in this article is no longer needed.<\/p>\n\n\n\n<p>Meetup uses a 2-letter code to store country names. However, The Events Calendar needs the full name to be saved. This snippet makes the necessary adjustments during the import.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n&lt;?php\n\/**\n * Change the 2-letter country code to the full country name when importing from Meetup.\n * Meetup saves the country names with their 2-letter code (alpha2code). However, The Events Calendar \n * needs the full name to be saved. This snippet makes that adjustment.\n *\n * Plugins required: The Events Calendar\n * Author: Andras Guseo\n * Last updated: December 19, 2023\n *\n * @version 6.0.9\n *\/\n\nadd_action ( &#039;tribe_events_venue_created&#039;, &#039;tec_fix_meetup_venue_country&#039; );\n\nfunction tec_fix_meetup_venue_country ( $venue_id ) {\n\n\t\/\/ Get the origin.\n\t$origin = get_post_meta( $venue_id, &#039;_VenueOrigin&#039;, true, );\n\n\t\/\/ Bail if the venue is not imported.\n\tif ( $origin != &#039;event-aggregator&#039; ) {\n\t\treturn;\n\t}\n\n\t\/\/ Get the venue.\n\t$venue = tribe_get_venue_object( $venue_id );\n\n\t\/\/ Get the country code of the venue.\n\t$country = strtoupper( $venue-&gt;country );\n\n\t\/\/ Get the country array from Tribe Common.\n\t$countries = tribe( \\Tribe__Languages__Locations::class )-&gt;build_country_array();\n\n\t\/\/ If the country code of the venue exists, then change it to the full country name from the array.\n\tif ( array_key_exists( $country, $countries ) ) {\n\t\t\/\/ On some servers the country update needs to wait... :(\n\t\t\/\/ You can try to remove this line, and see if it works.\n\t\t\/\/ If it doesn&#039;t work, then add back.\n\t\tsleep(5);\n\t\t\n\t\t\/\/ Update country.\n\t\tupdate_post_meta( $venue_id, &#039;_VenueCountry&#039;, $countries&#x5B; $country ] );\n\t\t\n\t\t\/\/ Make sure we have a state.\n\t\tif ( $country == &#039;US&#039; ) {\n\t\t\tupdate_post_meta( $venue_id, &#039;_VenueState&#039;, $venue-&gt;province );\n\t\t}\n\t}\n}\n<\/pre><\/div>\n\n<style>.wp-block-kadence-advancedheading.kt-adv-heading1958212_f0c48e-f7, .wp-block-kadence-advancedheading.kt-adv-heading1958212_f0c48e-f7[data-kb-block=\"kb-adv-heading1958212_f0c48e-f7\"]{font-style:normal;}.wp-block-kadence-advancedheading.kt-adv-heading1958212_f0c48e-f7 mark.kt-highlight, .wp-block-kadence-advancedheading.kt-adv-heading1958212_f0c48e-f7[data-kb-block=\"kb-adv-heading1958212_f0c48e-f7\"] mark.kt-highlight{font-style:normal;color:#f76a0c;-webkit-box-decoration-break:clone;box-decoration-break:clone;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;}<\/style>\n<h2 class=\"kt-adv-heading1958212_f0c48e-f7 wp-block-kadence-advancedheading\" data-kb-block=\"kb-adv-heading1958212_f0c48e-f7\">Detailed Instructions on How to Implement the Code Snippet<\/h2>\n\n\n\n<p>First, browse to Plugins &#8211; Add New Plugin. Search for <a href=\"https:\/\/wordpress.org\/plugins\/code-snippets\/\">Code Snippets<\/a> by Code Snippets Pro. It should be the first result. Install and activate the plugin. Once activated, browse to <strong>Code Snippets &#8211; Add New<\/strong>. In this example, we\u2019re naming the snippet Meetup Country Code Fix.<\/p>\n\n\n\n<p>Copy the snippet from the Knowledgebase article and paste it into the Code Editor. Note, you\u2019ll need to remove the first line from the snippet as the Code Snippet plugin adds it automatically.<\/p>\n\n\n\n<p>Check the option to run the snippet everywhere, scroll to the bottom of the page and click the Save Changes and Activate button. This will enable the code snippet.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1724\" height=\"1156\" src=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/12\/Screenshot-2023-12-19-at-16-45-50-Edit-Snippet-\u2039-The-Events-Calendar-Complete-Collection-\u2014-WordPress.png\" alt=\"User interface for adding a code snippet to the code snippets plugin\" class=\"wp-image-1958872\" srcset=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/12\/Screenshot-2023-12-19-at-16-45-50-Edit-Snippet-\u2039-The-Events-Calendar-Complete-Collection-\u2014-WordPress.png 1724w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/12\/Screenshot-2023-12-19-at-16-45-50-Edit-Snippet-\u2039-The-Events-Calendar-Complete-Collection-\u2014-WordPress-300x201.png 300w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/12\/Screenshot-2023-12-19-at-16-45-50-Edit-Snippet-\u2039-The-Events-Calendar-Complete-Collection-\u2014-WordPress-1024x687.png 1024w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/12\/Screenshot-2023-12-19-at-16-45-50-Edit-Snippet-\u2039-The-Events-Calendar-Complete-Collection-\u2014-WordPress-768x515.png 768w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/12\/Screenshot-2023-12-19-at-16-45-50-Edit-Snippet-\u2039-The-Events-Calendar-Complete-Collection-\u2014-WordPress-1536x1030.png 1536w\" sizes=\"auto, (max-width: 1724px) 100vw, 1724px\" \/><\/figure>\n\n\n\n<p>Note, that to import events from Meetup into The Events Calender, you\u2019ll need an active license key for <a href=\"https:\/\/theeventscalendar.com\/products\/event-aggregator\/\">Event Aggregator<\/a>, which is a premium add-on.<\/p>\n\n\n\n<p>Browse to <strong>Events &#8211; Import<\/strong>. Select Meetup from the Import Origin. If you haven\u2019t already, you\u2019ll be prompted to connect your site to Meetup.com. In this example, we\u2019re importing one event. Once Meetup is connected, select One-Time Import from the Import Type Dropdown. Copy the URL from a Meetup event that takes place in a physical location and paste it into the URL box. Click the Preview button, then click the Import All Button. This will import the event and add the necessary data into The Events Calendar.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"982\" height=\"865\" src=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/10\/Screenshot-2023-12-19-at-16-51-49-New-Import-\u2013-Events-Import-\u2039-The-Events-Calendar-Complete-Collection-\u2014-WordPress.png\" alt=\"A series of fields related to the user interface for Event Automator when importing an event from Meetup.com into The Events Calendar.\" class=\"wp-image-1958873\" srcset=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/10\/Screenshot-2023-12-19-at-16-51-49-New-Import-\u2013-Events-Import-\u2039-The-Events-Calendar-Complete-Collection-\u2014-WordPress.png 982w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/10\/Screenshot-2023-12-19-at-16-51-49-New-Import-\u2013-Events-Import-\u2039-The-Events-Calendar-Complete-Collection-\u2014-WordPress-300x264.png 300w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/10\/Screenshot-2023-12-19-at-16-51-49-New-Import-\u2013-Events-Import-\u2039-The-Events-Calendar-Complete-Collection-\u2014-WordPress-768x676.png 768w\" sizes=\"auto, (max-width: 982px) 100vw, 982px\" \/><\/figure>\n\n\n\n<p>Click on the Venues link and select the venue associated with the event that you imported. In the backend, the Country and State if applicable, should be part of the venue information. The full country name should be displayed on the frontend of the site.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"466\" height=\"256\" src=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/12\/Screenshot-2023-12-19-at-17-00-19-Edit-Venue-Panera-Bread-\u2039-The-Events-Calendar-Complete-Collection-\u2014-WordPress.png\" alt=\"Information that displays the address, city, country, state or province, and postal code of a venue\" class=\"wp-image-1958874\" srcset=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/12\/Screenshot-2023-12-19-at-17-00-19-Edit-Venue-Panera-Bread-\u2039-The-Events-Calendar-Complete-Collection-\u2014-WordPress.png 466w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/12\/Screenshot-2023-12-19-at-17-00-19-Edit-Venue-Panera-Bread-\u2039-The-Events-Calendar-Complete-Collection-\u2014-WordPress-300x165.png 300w\" sizes=\"auto, (max-width: 466px) 100vw, 466px\" \/><\/figure>\n\n\n\n<p>Note that the team is aware of this bug and a fix will be coming soon. If you run into any issues importing events from Meetup.com into The Events Calendar, please contact our Support team.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Note: As of The Events Calendar 6.3.1, this feature is now included in the plugin, and the snippet in this article is no longer needed. Meetup uses a 2-letter code to store country names. However, The Events Calendar needs the full name to be saved. This snippet makes the necessary adjustments during the import. Detailed&#8230;<\/p>\n","protected":false},"author":17,"featured_media":1955565,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_swpsp_post_exclude":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"ep_exclude_from_search":false,"footnotes":""},"categories":[24,59,79],"tags":[202,45,200,201],"stellar-product-taxonomy":[],"class_list":["post-1958212","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-customizing","category-customizing-resources","category-snippets","tag-country","tag-importing","tag-meetup","tag-venue"],"acf":[],"taxonomy_info":{"category":[{"value":24,"label":"Customizations"},{"value":59,"label":"PHP &amp; Functions"},{"value":79,"label":"Snippets"}],"post_tag":[{"value":202,"label":"Country"},{"value":45,"label":"Importing"},{"value":200,"label":"Meetup"},{"value":201,"label":"Venue"}]},"featured_image_src_large":["https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/02\/social-share-1024x538.png",1024,538,true],"author_info":{"display_name":"Andras Guseo","author_link":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/author\/andras\/"},"comment_info":0,"category_info":[{"term_id":24,"name":"Customizations","slug":"customizing","term_group":0,"term_taxonomy_id":24,"taxonomy":"category","description":"","parent":0,"count":110,"filter":"raw","term_order":"0","cat_ID":24,"category_count":110,"category_description":"","cat_name":"Customizations","category_nicename":"customizing","category_parent":0},{"term_id":59,"name":"PHP &amp; Functions","slug":"customizing-resources","term_group":0,"term_taxonomy_id":59,"taxonomy":"category","description":"","parent":24,"count":101,"filter":"raw","term_order":"0","cat_ID":59,"category_count":101,"category_description":"","cat_name":"PHP &amp; Functions","category_nicename":"customizing-resources","category_parent":24},{"term_id":79,"name":"Snippets","slug":"snippets","term_group":0,"term_taxonomy_id":79,"taxonomy":"category","description":"","parent":0,"count":136,"filter":"raw","term_order":"0","cat_ID":79,"category_count":136,"category_description":"","cat_name":"Snippets","category_nicename":"snippets","category_parent":0}],"tag_info":[{"term_id":202,"name":"Country","slug":"country","term_group":0,"term_taxonomy_id":202,"taxonomy":"post_tag","description":"","parent":0,"count":1,"filter":"raw","term_order":"0"},{"term_id":45,"name":"Importing","slug":"importing","term_group":0,"term_taxonomy_id":45,"taxonomy":"post_tag","description":"","parent":0,"count":35,"filter":"raw","term_order":"0"},{"term_id":200,"name":"Meetup","slug":"meetup","term_group":0,"term_taxonomy_id":200,"taxonomy":"post_tag","description":"","parent":0,"count":1,"filter":"raw","term_order":"0"},{"term_id":201,"name":"Venue","slug":"venue","term_group":0,"term_taxonomy_id":201,"taxonomy":"post_tag","description":"","parent":0,"count":2,"filter":"raw","term_order":"0"}],"_links":{"self":[{"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1958212","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=1958212"}],"version-history":[{"count":7,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1958212\/revisions"}],"predecessor-version":[{"id":1959268,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1958212\/revisions\/1959268"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media\/1955565"}],"wp:attachment":[{"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media?parent=1958212"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=1958212"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=1958212"},{"taxonomy":"stellar-product-taxonomy","embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/stellar-product-taxonomy?post=1958212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}