Skip Navigation

Dies ist das technische Support-Forum für WPML – das mehrsprachige WordPress-Plugin.

Mitlesen können alle, doch nur WPML-Kunden können hier Fragen veröffentlichen. Das WPML-Team antwortet im Forum an 6 Tagen pro Woche, 22 Stunden am Tag.

Heute stehen keine Supporter zur Arbeit im German-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

This topic contains 10 Antworten, has 2 Teilnehmer.

Last updated by philippM-25 vor 1 Jahr, 10 Monate.

Assisted by: Andreas W..

Autor Beiträge
Mai 17, 2022 um 10:01 pm #11241931

philippM-25

I have buddypress (bp), events manager (em) and wpml installed.
em adds an "events" section to the profile. When I try to follow that link, it instead redirects me to the overall events page. After looking into the redirects happening, I assume, that WPML is causing this behavior. All other profile sections like e.g. "settings" are working fine. This issue is similar to the one described in this thread: https://wpml.org/forums/topic/wrong-buddypress-redirects-on-profile-page/ Also, see the pictures in this old thread.

Unfortunately, there is no solution posted. the update to bp ml 1.7 also does not seem to catch what is going wrong. Do you have an idea how to fix this?

Thanks!
Philipp

Mai 18, 2022 um 1:36 am #11242341

Andreas W.
Supporter

Languages: Englisch (English ) Deutsch (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

The Events Manager Plugin has not yet been tested by our team for compatibility with WPML:
https://wpml.org/plugin/?wpv_view_count=120064&wpv-plugin-functionality=0&wpv_post_search=events&wpv-wpcf-recommendation-flag=&wpv_filter_submit=Search

It appears that the developer of this plugin has created a compatibility plugin in order to make his plugin work seamlessly together with WPML.
hidden link

I would suggest you try to recreate the issue on the following test site and let me know about the results.

One-Click Login:
hidden link

Take note that I already installed the plugins here and made a test. The events appear not to be translateable with the WPML Translation Editor, as you can see in this example:

hidden link

The issue appears to be that the plugin options are not copied toward the translated event. In such case I would suggest you translate those events manually, as explained here:

https://wpml.org/documentation/translating-your-contents/using-different-translation-editors-for-different-pages/

Now, I have inscribed myself on a manually translated event which is this one:
hidden link

On my translated profile, I do see the correct results:
hidden link

Could it be that the events that are not working on the profile in your case are maybe also not correctly translated? If not, then it might be the case that even another used plugin is causing the issue when running with WPML and we would need to investigate further.

Best regards
Andreas

Mai 19, 2022 um 8:30 pm #11260563

philippM-25

Thank you, Andreas, for that detailed reply and test!

I can follow the steps you took, just from your observations mentioned here:
"
Now, I have inscribed myself on a manually translated event which is this one:
hidden link

On my translated profile, I do see the correct results:
hidden link
"

I think the second link (hidden link) is not the translated version of the buddypress events page in your profile, but it is the generic event manager events page, that lists all the events, not the ones you are attending. The one in view in your profile should have a URL like ("hidden link"). So it is actually the exact same behavior, as I was describing.

Or do I miss something?

I also tried it myself in the demo account, that was already enrolled in the translated event and I was redirected to the main page. I like the thought, that it might be due to missing tranlsations on events, the user is attending. But if you actually visit a sub page directly by appending the URL like: "hidden link" you can see the profile view and also navigate through the sub profile pages. Only the generic link is not working.

Let me know, if you have another idea, what could be the reason for that behavior.

Thanks again,
Philipp

Mai 20, 2022 um 12:52 am #11261147

Andreas W.
Supporter

Languages: Englisch (English ) Deutsch (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello Philipp,

You are right, the profile page is this one:

hidden link

Now, if I click here on the events tab I land at hidden link

Same in English:

hidden link

lands at:

hidden link

This said it seems to me that I can not recreate the issue that you experience on your site and it would be better if you could provide me admin access so that I can have a better look at the issue.

I would like to request temporary access (wp-admin and FTP) to your site to take a better look at the issue. It would be better for a testing site where the issue is replicated.

You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Maybe I'll need to replicate your site locally. For this, I’ll need to temporarily install a plugin called “All In One WP Migration” on your site. This will allow me to create a copy of your site and your content. Once the problem is resolved I will delete the local site. Let me know if this is ok with you.

IMPORTANT

Please make a backup of site files and database before providing us access.
If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this:
hidden link

The steps are also shown in this video: hidden link

Best regards
Andreas

Mai 23, 2022 um 11:20 am #11279405

philippM-25

Hi Andreas,
Actually this is the issue I am experiencing on my site.
Clicking in the events tab in the profile brings me to the overall events page and not the one of the user. Exactly as in your demo. Instead of this behavior,it should bring you to the events page of your profile.
So I think you already replicated the issue.

Mai 24, 2022 um 8:06 pm #11296789

Andreas W.
Supporter

Languages: Englisch (English ) Deutsch (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

Thank you for the confirmation.

I now realized that this redirect only occurs when the WPML core plugin is enabled and I have escalated this issue to our compatibility team for further revision.

As soon I will have further feedback from our team I will be in contact again.

Best regards
Andreas

Mai 29, 2022 um 3:53 am #11335685

Andreas W.
Supporter

Languages: Englisch (English ) Deutsch (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

On our test site, the following snippet solved the issue. Please add it to the bottom of your theme's functions.php file:

add_filter( 'parse_query', 'events_manager_wpml_fix_redirection' , 5 );

function events_manager_wpml_fix_redirection ($q) {
	if ( bp_current_component() == 'events') {
	    if ( isset( bp_core_get_directory_pages()->members->id ) ) {
		$q->set( 'page_id', bp_core_get_directory_pages()->members->id );
	    }
	}
}

Please confirm if this solved the issue for you.

Best regards
Andreas

Mai 29, 2022 um 7:00 pm #11337907

philippM-25

Hi Andreas,

thank you for the fix. This works. But it somehow breaks my menus. The footer is now mixed with the header menu and there is no footer anymore. Did you experience the same on your test site?

Best,
Philipp

Mai 31, 2022 um 8:02 pm #11357141

Andreas W.
Supporter

Languages: Englisch (English ) Deutsch (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

No, the snippet actually only uses a BuddyPress function in order to resolve the correct page path and slug.

Did you maybe break the markup of your functions.php file when adding the snippet?

Apart from that; I found this on the BuddyPress Docss, we could try to apply this function istead:
hidden link

I am consulting our compatibility team about this.

In case the issue persists, I would like to request again temporary access (wp-admin and FTP) to your site to take a better look at the issue. It would be better for a testing site where the issue is replicated.

You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

IMPORTANT

Please make a backup of site files and database before providing us access.
If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this:
hidden link

The steps are also shown in this video: hidden link

Best regards
Andreas

Juni 1, 2022 um 6:16 am #11358823

philippM-25

Hi Andreas,

thank you for the reply.

I deleted the code and added the one from buddyboss. I integrated the case from your code to the buddyboss code, to also check for the events component and change the page id accordingly. However, now the redirect is broken again. Also, when I now use your originally provided code only, the redirect does not work anymore. That said, I assume, that I really broke something in the functions.php before and due to that error, by coincidence, some subsequent code that caused the redirect was not trigger anymore.

Looking forard to hear back from you guys, if you can make the buddyboss code work. If not, I will provide the access details to you.

Find my current code here:

function bp_core_fix_wpml_redirection( $q ) {
	if (
		! defined( 'DOING_AJAX' )
		&& ! bp_is_blog_page()
		&& (bool) $q->get( 'page_id' ) === false
		&& (bool) $q->get( 'pagename' ) === true
	) {
		write_log("bp core redirect inside if");
		$bp_current_component = bp_current_component();
		$bp_pages             = bp_core_get_directory_pages();

		if ( 'photos' === $bp_current_component && isset( $bp_pages->media->id ) ) {
			$q->set( 'page_id', $bp_pages->media->id );
		} elseif ( 'forums' === $bp_current_component && isset( $bp_pages->members->id ) ) {
			$q->set( 'page_id', $bp_pages->members->id );
		} elseif ( 'groups' === $bp_current_component && isset( $bp_pages->groups->id ) ) {
			$q->set( 'page_id', $bp_pages->groups->id );
		} elseif ( 'documents' === $bp_current_component && isset( $bp_pages->document->id ) ) {
			$q->set( 'page_id', $bp_pages->document->id );
		} elseif ( 'videos' === $bp_current_component && isset( $bp_pages->video->id ) ) {
			$q->set( 'page_id', $bp_pages->video->id );
		} elseif ( 'events' === $bp_current_component && isset( $bp_pages->members->id ) ) {
			$q->set( 'page_id', $bp_pages->members->id );
		} else {
			$page_id = apply_filters( 'bpml_redirection_page_id', null, $bp_current_component, $bp_pages );
			if ( $page_id ) {
				$q->set( 'page_id', $page_id );
			}
		}
	}

	return $q;
}

add_action( 'parse_query', 'bp_core_fix_wpml_redirection', 5 );

Thanks again,
Philipp

Juni 1, 2022 um 9:48 am #11360831

philippM-25

Weird. Just checked it again and it now seems to be working with the code from my last reply. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.