Skip Navigation

Waiting for author

Topic Tags: Compatibility

Overview of the issue

If you are using the Profile Builder feature from JetEngine plugin, you will experience that options are not being applied in the second language.

Workaround

Please, make sure of having a full site backup of your site before proceeding.

Part 1

  • Open …/wp-content/plugins/jet-engine/includes/modules/profile-builder/inc/rewrite.php file.
  • Look for line 57.
  • Replace:
    $pages  = Module::instance()->settings->get_pages();
    
  • With:
    $pages  = Module::instance()->settings->get_pages();
    
    // WPML Workaround for compsupp-7264 - PART 1
    if ( class_exists('Sitepress') && isset( $pages['account_page'] ) ) {
    	// Get WPML Active Languages
    	$wpml_languages = apply_filters( 'wpml_active_languages', NULL, 'orderby=id&order=desc' );
    
    	// Let's add a new item in $pages array for each language, so it can also create rewrite rules for it
    	foreach( $wpml_languages as $language ) {
    		if ( $language['language_code'] != apply_filters('wpml_default_language', NULL ) ) {
    			$account_page_id = $pages['account_page'];
    			
    			// The new item should have the translated account page ID
    			$translated_account_page_id = apply_filters( 'wpml_object_id', $account_page_id , get_post_type($account_page_id) , TRUE, $language['language_code']  );
    			$pages['account_page_'.$language['language_code']] = $translated_account_page_id;
    		}
    	}
    }
    

Part 2

  • Open …/wp-content/plugins/jet-engine/includes/modules/profile-builder/inc/query.php file.
  • Look for line 53.
  • Replace:
    $user    = get_query_var( Module::instance()->rewrite->user_var );
    
  • With:
    $user    = get_query_var( Module::instance()->rewrite->user_var );
    
    // WPML Workaround for compsupp-7264 - PART 2
    if ( class_exists('Sitepress') ) {
    	
    	// Let's create a with the query_var of the account page in each language
    	$account_pages = [];
    	$wpml_languages = apply_filters( 'wpml_active_languages', NULL, 'orderby=id&order=desc' );
    	foreach( $wpml_languages as $language ) {
    		if ( $language['language_code'] != apply_filters('wpml_default_language', NULL ) ) {
    			$account_pages[] = 'account_page_'.$language['language_code'];
    		}
    	}
    	// If the current query_var match with our array items, let's "fix" the $page variable so the switch works correctly
    	if ( in_array( $page, $account_pages) ) {
    		$page = 'account_page';
    	}
    }
    
  • Go to Settings > Permalinks page and re-save permalinks

2 Responses to “JetEngine - Profile Builder Options not applied in second language”

  1. Is there a version that I am able to use as a code snippet rather than directly editing the files, so that when there are plugin updates I wouldn’t need to make the changes again?

    • Hello Samara,
      Unfortunately we don’t have such a version. However, we are in contact with the author and they are already aware of this situation. Maybe they are in capacity of providing you with one.
      Regards

Leave a Reply

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>