aurovrata / cf7-polylang

Contact Form 7 Polylang extension
GNU General Public License v2.0
1 stars 1 forks source link

Alert popup when saving translations in the dashboard #3

Open aurovrata opened 7 years ago

aurovrata commented 7 years ago

@diggy any idea how to get rid of the javascript popup when navigating away from a saved translation cf7 form? (Screenshot #4 on the plugin page)

I tried a few support forums but found no answer. The problem I believe arises from the fact that the CF7 form editor page is a custom page which does not follow the WP std for post editing. I inject javascript in the footer to dynamically render the Polylang translation metabox on page load. As a result the WP javascript magic that checks if a page modification has been saved captures the changes in the polylang input fields, but does not register its ajax saving process (handled by the polylang plugin).

Since you have some experience with WP maybe you have a idea to solve this at the javascript level?

The only way I can think of resolving this is to redesign the CF7 form edit page by hijacking the page on the sub-menu.

diggy commented 7 years ago

@aurovrata currently on a tight time budget, just made a drive-by commit cause I needed this plugin for a client project, and ran into trouble. If this is a serious or annoying bug, I'm sure the client will complain, and I'll take look! As CF7 is an immensely popular plugin, and Polylang is on the rise, I'd suggest you contact Chouby (the author of Polylang, https://github.com/Chouby) to see if he has any ideas.

aurovrata commented 7 years ago

No worries, I just thought I would bounce this past you on the off-chance it might ring a bell.

Yeah Chouby has been helpful in the past. I will ping him to see if he has an idea.

If you use CF7 a lot you'll probably like the Post My CF7 form plugin extension too, which allows you to save every form submission as post.

aurovrata commented 7 years ago

Dear Afifosh

thanks for your effort, unfortunately CF7 plugin is where the issue is. It was written at the beginning of WP when it was a challenge to write plugins for the dashboard. The author has not updated the code for new hooks available in the more recent releases of WP. So as a result it makes it difficult for extensions to play nice with the plugin. I tried my best to make the extension as useful as possible given these limitations. I even wrote to the author of the cf7 plugin to suggest some modifications and extend my help to rewrite the cf7 plugin altogether but he declined.

However, the good news is that I have an idea how to fix some of these limitations and I hope to introduce this in version 2.0 of cf7 polylang extension, but right now I don't have much time for this.

Kind Regards Aurovrata Aurèle Venet (PhD, BSc, DIC) Director, Creative Strategy & Analytics

Mobile: +91 90 43 02 82 21 | Web: Syllogic.in http://www.syllogic.in Blog: Syllogic Thinks! http://blog.syllogic.in | :-) Only In India! http://we2our2.blogspot.com | Tweet: @aurovrata https://twitter.com/aurovrata

[image: http://www.linkedin.com/in/aurovrata] http://www.linkedin.com/in/aurovrata

On 20 December 2016 at 17:34, afifosh notifications@github.com wrote:

Dear Aurovrata , your plugins its awesome but you have one issue its make page loading slow .. to sort out the issue of Alert popup when saving translations , its done just by modifying the admin.php url and replace it by post.php and the popup alert will disappear .

Example : class-cf7-polylang-admin.php

public function set_edit_form_link($link, $post_ID, $context){ //let's check we have the correct post type $post_type = get_post_type($post_ID); if(WPCF7_ContactForm::post_type != $post_type){ return $link; }

//$link = admin_url('admin.php?page=wpcf7&post='.$post_ID.'&action=edit'); $link = admin_url('post.php?post='.$post_ID.'&action=edit'); return $link; }

public function cf7_new_translation_link($link, $language, $from_post_id ){ //let's check we have the correct post type $post_type = get_post_type($from_post_id); if(WPCF7_ContactForm::post_type != $post_type){ return $link; } //$link = admin_url('admin.php?page=wpcf7-new&from_post='.$from_post_id.'&locale='.$language->locale.'&new_lang='.$language->slug); $link = admin_url('post.php?from_post='.$from_post_id.'&locale='.$language->locale.'&new_lang='.$language->slug); return $link; }

[image: polylang error] https://cloud.githubusercontent.com/assets/24671815/21349878/6d394e28-c6c5-11e6-8c87-10c3510b9c47.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aurovrata/cf7-polylang/issues/3#issuecomment-268226742, or mute the thread https://github.com/notifications/unsubscribe-auth/ACo28Yv9u1k9CqpJsJcEUSi7pw34W_Clks5rJ8Q0gaJpZM4KurAD .