Home › Forums › Plugin Support › WP User Frontend Pro › Registration Form _wp_http_referer
This topic contains 29 replies, has 3 voices, and was last updated by Tareq Hasan 5 years, 7 months ago.
-
AuthorPosts
-
July 9, 2013 at 7:36 pm #5763
Back,
Well after a little coding, i've successfully added what is need by the
do_shortcode()
in my theme function :`wp_enqueue_script(‘pupload-script',home_url().'/wp-includes/js/plupload/plupload.js?ver=1.5.5′,array( ‘jquery' ));
wp_enqueue_script(‘puploadhtml5-script',home_url().'/wp-includes/js/plupload/plupload.html5.js?ver=1.5.5?ver=1.5.5′,array( ‘jquery' ));
wp_enqueue_script(‘puploadflash-script',home_url().'/wp-includes/js/plupload/plupload.flash.js?ver=1.5.5?ver=1.5.5′,array( ‘jquery' ));
wp_enqueue_script(‘puploadsilver-script',home_url().'/wp-includes/js/plupload/plupload.silverlight.js?ver=1.5.5?ver=1.5.5′,array( ‘jquery' ));
wp_enqueue_script(‘puploadhtml4-script',home_url().'/wp-includes/js/plupload/plupload.html4.js?ver=1.5.5?ver=1.5.5′,array( ‘jquery' ));
wp_enqueue_script(‘handlers-script',home_url().'/wp-includes/js/plupload/handlers.min.js?ver=1.5.5?ver=3.5.2′,array( ‘jquery' ));
wp_enqueue_script(‘upload-script',home_url().'/wp-content/plugins/wp-user-frontend-pro/js/upload.js?ver=3.5.2′,array( ‘jquery' ));
wp_enqueue_script(‘jqueryui-script',home_url().'/wp-includes/js/jquery/ui/jquery.ui.core.min.js?ver=1.9.2′,array( ‘jquery' ));
wp_enqueue_script(‘jqueryuidate-script',home_url().'/wp-includes/js/jquery/ui/jquery.ui.datepicker.min.js?ver=1.9.2′,array( ‘jquery' ));
wp_enqueue_script(‘jqueryuidateadd-script',home_url().'/wp-content/plugins/wp-user-frontend-pro/js/jquery-ui-timepicker-addon.js?ver=3.5.2′,array( ‘jquery' ));
wp_enqueue_script(‘front-end-script',home_url().'/wp-content/plugins/wp-user-frontend-pro/js/frontend-form.js?ver=3.5.2′,array( ‘jquery' ));`I needed too to add the hardcoded WPUF JS code in page template :
<script type='text/javascript'> /* <![CDATA[ */ var pluploadL10n = {"queue_limit_exceeded":"Vous essayez d\u2019envoyer trop de fichiers \u00e0 la fois.","file_exceeds_size_limit":"%s d\u00e9passe la limite d\u2019envoi de ce site.","zero_byte_file":"Le fichier est vide. Merci d\u2019en essayer un autre.","invalid_filetype":"Ce type de fichier n\u2019est pas autoris\u00e9. Merci d\u2019en essayer un autre.","not_an_image":"Ce fichier n\u2019est pas une image. Merci d\u2019en envoyer un autre.","image_memory_exceeded":"M\u00e9moire d\u00e9pass\u00e9e. Veuillez r\u00e9essayer avec un fichier plus petit.","image_dimensions_exceeded":"Ce fichier est plus grand que la taille maximale. Merci d\u2019en envoyer un autre.","default_error":"Une erreur est survenue lors de l\u2019envoi. Veuillez r\u00e9essayer plus tard.","missing_upload_url":"Il y a une erreur de configuration. Veuillez contacter l\u2019administrateur de votre serveur.","upload_limit_exceeded":"Vous pouvez seulement envoyer 1 fichier.","http_error":"Erreur HTTP.","upload_failed":"L\u2019envoi a \u00e9chou\u00e9.","big_upload_failed":"Veuillez essayer de mettre ce fichier en ligne \u00e0 l\u2019aide de l\u2019%1$soutil du navigateur%2$s.","big_upload_queued":"%s d\u00e9passe la limite d\u2019envoi pour l\u2019outil de mise ne ligne multiple utilis\u00e9 avec votre navigateur.","io_error":"Erreur I\/O (Entr\u00e9es-Sorties).","security_error":"Erreur de s\u00e9curit\u00e9.","file_cancelled":"Fichier annul\u00e9.","upload_stopped":"L\u2019envoi est stopp\u00e9.","dismiss":"Fermer","crunching":"En cours de traitement\u2026","deleted":"d\u00e9plac\u00e9 dans la Corbeille.","error_uploading":"\u00ab %s \u00bb n\u2019a pas pu \u00eatre mis en ligne."}; /* ]]> */ </script> <script type='text/javascript'> /* <![CDATA[ */ var wpuf_frontend_upload = {"confirmMsg":"Are you sure?","nonce":"16f3c8d2e1","ajaxurl":"http:\/\/lab.zenoob.com\/kifffle\/wp-admin\/admin-ajax.php","plupload":{"url":"http:\/\/lab.zenoob.com\/kifffle\/wp-admin\/admin-ajax.php?nonce=44cdfa6206","flash_swf_url":"http:\/\/lab.zenoob.com\/kifffle\/wp-includes\/js\/plupload\/plupload.flash.swf","filters":[{"title":"Fichiers autoris\u00e9s","extensions":"*"}],"multipart":true,"urlstream_upload":true}}; /* ]]> */ </script> <script type='text/javascript'> /* <![CDATA[ */ var wpuf_frontend = {"ajaxurl":"http:\/\/lab.zenoob.com\/kifffle\/wp-admin\/admin-ajax.php","error_message":"Please fix the errors to proceed","nonce":"16f3c8d2e1"}; /* ]]> */ </script>
But seems this last part to make some weird things with form submission, sometimes it works, sometimes not .. i think it's because the hard coded part is dynamic.
What do i have to change in this part in order for everything to work ?
Thanks
FranΓ§ois
July 9, 2013 at 8:43 pm #5774You could add all the plupload library with a single line:
wp_enqueue_script( 'plupload-handlers' );
You don't need to hardcode them. As you need the scripts in all pages, may be remove the logic from the plugin by editing
wpuf.php
line 167, and/class/upload.php
line 27.if ( wpuf_has_shortcode( 'wpuf_form' ) || wpuf_has_shortcode( 'wpuf_edit' ) || wpuf_has_shortcode( 'wpuf_profile' ) ) {
I think it'll be a good idea to give an option to enable/disable the script loading on every page or specific pages, hmm.
July 9, 2013 at 9:14 pm #5783Mmhh .. Yes.. it helps a little more !
maybe would it be better to support
do_shortcode()
or to implement a “select templates” or “select pages” as you told…So, now everything seems ok apart one form (a registration form that only upload one image without others fields) .. The upload works well but redirects to /wp-admin/admin-ajax.php?msg=profile_update and display 0 …
Is it ajax related or something like that ?
July 9, 2013 at 10:06 pm #5798I suspect it's not getting some JS variables and can't make the request properly. The url misses an
action
parameter which is necessary. Do you see any error when hitting the submit button?July 9, 2013 at 10:29 pm #5801Nops Tareq… i've checked it and nothing special else the 0 displayed on the top.
Think it's also parameter related but wich one ?July 9, 2013 at 11:34 pm #5807Nothing new for the JS Script Issue …
I've finally successfully enqueued all the scripts neeeded by WPFU in order for
do_shortcode
to work …
Here it si the function to include in the main theme function :add_action( ‘wp_enqueue_scripts', ‘add_my_scripts');
function add_my_scripts() { if ( !is_admin() ) { wp_enqueue_script('jqueryuidateadd-script',home_url().'/wp-content/plugins/wp-user-frontend-pro/js/jquery-ui-timepicker-addon.js?ver=3.5.2',array('jquery-ui-datepicker')); wp_enqueue_script( 'jquery-ui-autocomplete' ); wp_enqueue_script( 'jquery-ui-slider' ); wp_enqueue_script('front-end-script',home_url().'/wp-content/plugins/wp-user-frontend-pro/js/frontend-form.js?ver=3.5.2',array( 'jquery','plupload-handlers' )); wp_enqueue_script('upload-script',home_url().'/wp-content/plugins/wp-user-frontend-pro/js/upload.js?ver=3.5.2',array( 'jquery', 'plupload-handlers' )); wp_localize_script( 'front-end-script', 'wpuf_frontend', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'error_message' => __( 'Please fix the errors to proceed', 'wpuf' ), 'nonce' => wp_create_nonce( 'wpuf_nonce' ) ) ); wp_localize_script( 'upload-script', 'wpuf_frontend_upload', array( 'confirmMsg' => __( 'Are you sure?', 'wpuf' ), 'nonce' => wp_create_nonce( 'wpuf_nonce' ), 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'plupload' => array( 'url' => admin_url( 'admin-ajax.php' ) . '?nonce=' . wp_create_nonce( 'wpuf_featured_img' ), 'flash_swf_url' => includes_url( 'js/plupload/plupload.flash.swf' ), 'filters' => array(array('title' => __( 'Allowed Files' ), 'extensions' => '*')), 'multipart' => true, 'urlstream_upload' => true, ) ) ); } }
July 10, 2013 at 12:01 am #5813Nice to know you made it. You could just edit the plugin and remove the
if
blocks for shortcode checking πJuly 10, 2013 at 12:34 am #5817Well, i'll be happy when i found the solution to the latest issue with JS … :-/
July 11, 2013 at 5:38 am #5858If your site is in a live site, I could see by myself?
July 11, 2013 at 5:52 am #5860This reply has been marked as private.July 11, 2013 at 6:20 am #5861The problem is, you are using the form in the authors profile page. To redirect to the same page, WPUF tries get the current page ID, in your case it's not a page. Thats why it gets 0 as page ID and can't generate an URL to be redirected.
So here is the solution, I think you'll understand whats going on:
[php]
function wpufe_profile_redirect( $response, $user_id, $form_id ) {if ( $form_id == ‘3648' ) {
$url = get_author_posts_url( get_current_user_id() );
$response[‘redirect_to'] = $url;
}return $response;
}add_filter( ‘wpuf_update_profile_resp', ‘wpufe_profile_redirect' );
[/php]July 11, 2013 at 11:19 am #5868Wooow thanks so Lot !
Again and again i didn't imagine that kind of support from you !
I really appreciate it πI think also that it would be usefull for WTUF to have the option to be implemented everywhere we need in a WP theme … so, i launch the idea π
Keep the good work guys !
cheers !
July 11, 2013 at 12:16 pm #5870MMhhh…
Try your code ‘as is' and doesn't seem to work, maybe i miss something.Have to investigate more, but that's a good way to begin !
π
July 11, 2013 at 12:30 pm #5871Ok !
It works but not investigate more, just added
if ( $form_id == '3648' ) { $url = get_author_posts_url( get_current_user_id() ); $response['redirect_to'] = $url; }
in
update_profile
functionπ so thanks Tareq !
July 11, 2013 at 1:29 pm #5872Oh, I missed the parameter number in the
add_filter
, should beadd_filter( 'wpuf_update_profile_resp', 'wpufe_profile_redirect', 10, 3 );
-
AuthorPosts
The topic ‘Registration Form _wp_http_referer’ is closed to new replies.