Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 20 replies, has 3 voices.

Last updated by Kristof 4 years, 9 months ago.

Assigned support staff: David.

Author Posts
September 26, 2016 at 3:32 pm #1100640

Kristof

I have installed the Eventbrite API plugin, and with the default

$events = new Eventbrite_Query( apply_filters( 'eventbrite_query_args', array(
) ) );

filter, everything works fine, but as soon as I add an argument

$events = new Eventbrite_Query( apply_filters( 'eventbrite_query_args', array(
'display_private' => true,
) ) );

I get an error
Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Element does not exists.' in /home/itinerainst/public_html/wp-content/plugins/sitepress-multilingual-cms/classes/translations/class-wpml-translation-element.php:119 Stack trace: #0 /home/itinerainst/public_html/wp-content/plugins/sitepress-multilingual-cms/classes/translations/class-wpml-post-element.php(46): WPML_Translation_Element->get_wp_element_type() #1 /home/itinerainst/public_html/wp-content/plugins/sitepress-multilingual-cms/classes/canonicals/class-wpml-canonicals.php(32): WPML_Post_Element->is_translatable() #2 /home/itinerainst/public_html/wp-content/plugins/sitepress-multilingual-cms/classes/canonicals/class-wpml-canonicals.php(51): WPML_Canonicals->must_filter_permalink(28150743632) #3 /home/itinerainst/public_html/wp-content/plugins/sitepress-multilingual-cms/inc/url-handling/wpml-url-filters.class.php(127): WPML_Canonicals->permalink_filter('hidden link....', 28150743632) #4 [internal function]: WPML_URL_Filters->permalink_filter(' in /home/itinerainst/public_html/wp-content/plugins/sitepress-multilingual-cms/classes/translations/class-wpml-translation-element.php on line 119

hidden link

September 26, 2016 at 7:48 pm #1101042

Amir
Supporter

Why is there an extra comma (,) after "'display_private' => true", in your call?

Shouldn't it be:
$events = new Eventbrite_Query( apply_filters( 'eventbrite_query_args', array(
'display_private' => true
) ) );

September 27, 2016 at 10:08 am #1102182

Kristof

The comma is non critical, but as per your instructions, I have removed it. The issue however is still visible on the website.

September 27, 2016 at 11:04 am #1102366

David
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

I tried to reproduce your problem local but its getting a bit tricky to setup.

Would you have a development server where you can share access details with me?
This way we will both be seeing the same thing and it will be easier for me to reproduce local and debug.

I have marked your next reply as private.

September 28, 2016 at 11:35 am #1103608

David
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Its not working even if I remove the argument.

I think its because the development site wasnt connected to the API.
Or it could be connected to the wrong oauth endpoint.

Can you visit Tools -> Keyring and connect it there?

Thanks!

September 28, 2016 at 11:56 am #1103642

Kristof

Surely the site is connected. When I do another test, I get "This connection appears to be working."

September 29, 2016 at 3:55 pm #1105000

David
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

I removed the display_private argument and I still cant see it working.
Let me take another look and see what i find.

September 29, 2016 at 4:01 pm #1105010

David
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

I dont see any connections there (see screenshot) and the events page is empty even after removing the display_private argument.

Have you enabled WP_DEBUG so we can see error messages?

Screen Shot 2016-09-29 at 17.59.55.png
September 30, 2016 at 8:17 am #1105411

Kristof

I don't know where you were looking, but I do see the connection (see screenshot). But you are correct that currently no events are showing, which is annoying 🙁

Keyring ‹ Itinera Institute — WordPress.jpeg
September 30, 2016 at 4:08 pm #1105857

David
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Im just going to Tools -> Keyring.

I think that you have added the key & secret (visible after clicking manage) but you still need to add the actual connection and get the oauth authorization dialog from eventbrite.

Try going to Tools -> Keyring, Click add a connection and click on Eventbrite (not Manage)

Let me know how it goes

This is a screenshot from my test setup.

Screen Shot 2016-09-30 at 18.06.01.png
September 30, 2016 at 4:43 pm #1105876

Kristof

I now see 2x the Eventbrite Service.

September 30, 2016 at 5:29 pm #1105903

David
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Maybe this is different per user.

In any case, I have finally been able to reproduce your problem on my test site.

Let me look further and I will get back to you when I have more information.

October 3, 2016 at 1:59 pm #1107059

David
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

I found a possible solution and I am talking with the development team to approve and test it.
If everything goes as expected, it should be included in next release.

October 3, 2016 at 2:52 pm #1107119

Kristof

Do you have an ETA on the next release. We cannot launch this site without the Eventbrite integration and the site should be launched in 2 weeks.

October 3, 2016 at 2:54 pm #1107122

David
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Would a patch with the proposed solution work for you?
Just keep in mind that we havent fully tested yet.

diff --git a/classes/translations/class-wpml-post-element.php b/classes/translations/class-wpml-post-element.php
index a93c8bf..e33a32b 100644
--- a/classes/translations/class-wpml-post-element.php
+++ b/classes/translations/class-wpml-post-element.php
@@ -21,7 +21,10 @@ class WPML_Post_Element extends WPML_Translation_Element implements WPML_Duplica
                        return $post->post_type;
                }
 
-               return $this->get_wp_object()->post_type;
+               $post = $this->get_wp_object();
+               if ( $post ) {
+                       return $post->post_type;
+               }
        }
 
        function get_wpml_element_type() {
diff --git a/classes/translations/class-wpml-translation-element.php b/classes/translations/class-wpml-translation-element.php
index f1473ec..17ce183 100644
--- a/classes/translations/class-wpml-translation-element.php
+++ b/classes/translations/class-wpml-translation-element.php
@@ -115,9 +115,6 @@ abstract class WPML_Translation_Element extends WPML_SP_User {
                if ( is_wp_error( $element ) ) {
                        throw new UnexpectedValueException( $element->get_error_message() );
                }
-               if ( false === (bool) $element ) {
-                       throw new UnexpectedValueException( 'Element does not exists.' );
-               }
 
                return $this->get_type( $element );
        }