Forum Replies Created

Viewing 8 Topics - 1 through 8 (of 8 total)
Author Posts
July 11, 2013 at 3:35 pm in reply to: Multilingual Edit Page 5878
obouilland obouilland

Yes, for sure !

For those who face the same problem, i find the solution by changing your function wpuf_edit_post_link, line 217 in wpuf-functions.php like this :

/**
 * Edit post link for frontend
 *
 * @since 0.7
 * @param string $url url of the original post edit link
 * @param int $post_id
 * @return string url of the current edit post page
 */
function wpuf_edit_post_link( $url, $post_id ) {
    if ( is_admin() ) {
        return $url;
    }

    $override = wpuf_get_option( 'override_editlink', 'wpuf_general', 'yes' );
    if ( $override == 'yes' ) {
        $url = '';
        if ( wpuf_get_option( 'enable_post_edit', 'wpuf_dashboard', 'yes' ) == 'yes' ) {
            $edit_page = (int) wpuf_get_option( 'edit_page_id', 'wpuf_general' );
			$current_language =ICL_LANGUAGE_CODE ;
			if($current_language == 'fr') {
   			 $edit_page_wpml = icl_object_id($edit_page,'page',true);
  			}
			else {
				$edit_page_wpml = $edit_page ;
				}
			
			
            $url = get_permalink( $edit_page_wpml );

            $url = wp_nonce_url( $url . '?pid=' . $post_id, 'wpuf_edit' );
        }
    }

    return $url;
}

add_filter( 'get_edit_post_link', 'wpuf_edit_post_link', 10, 2 );

The changes are just for additional languages, no need to had anything for default language.

Perhaps it is possible in next release just to add a function exists test on this function in order to hack it in my function.php and not have to change core plugin files.

In the same way, here is the function I had to my function.php file in order to save a post in the correct language (same again, only needed for additional languages, not for the default one):


/**
 * Update the lanuage  when the form submits
 *
 * @param type $post_id
 */
function update_language_hook( $post_id ) {
	$language = $_POST['icl_post_language'] = ICL_LANGUAGE_CODE;
    if ( isset( $language) && $language == 'fr' ) {
		global $wpdb;
		 $wpdb->update('wp_icl_translations', array('language_code'=>$language), array('element_id'=> $post_id)); 
	}
}
 
add_action( 'wpuf_add_post_after_insert', 'update_language_hook');

I hope it could help multilingual integration for wpufe.

Olivier

July 11, 2013 at 1:40 pm in reply to: Multilingual Edit Page 5873
obouilland obouilland

Ok Thank you for your reply. Do you plan to create WPML compatibility in a next future ?

May 16, 2013 at 3:15 pm in reply to: Pre populate select field 3702
obouilland obouilland

Thank you Tareq, great example, works perfectly for me. Just one thing : the hook field don’t appear in the admin section (in the wpuf custom field list of a node). It is not an issue to me, but it will be better if it could appear.

Thanks again.

Olivier

May 14, 2013 at 8:44 pm in reply to: Pre populate select field 3632
obouilland obouilland

Thanks Tareq, I will have a look at this example.

May 14, 2013 at 8:08 pm in reply to: Pre populate select field 3629
obouilland obouilland

Hi tareq.

I have already seen the developer docs, but I cannot see an example of how to use it, and there is no documentation on how to reach a field. Can you develop your documentation on it ?

Thanks.

May 1, 2013 at 4:52 pm in reply to: Edit post 3066
obouilland obouilland

Ok I solved it. It was because I did not use the edit_post_link function to link to the post edit page (I was directly linking to the edit page).

May 1, 2013 at 4:13 pm in reply to: Problem with activation 3064
obouilland obouilland

It worked. I had a message that the plugin is activated, and no more alert message.

Thank you for quick reply !

May 1, 2013 at 4:04 pm in reply to: Problem with activation 3062
obouilland obouilland

Yes, I still have it, even if the plugin is activated.

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