• Resolved mehdismekouar

    (@mehdismekouar)


    Hi,

    So i applied exactly what you prescribed in this topic to redirect based on query parameter “redirect_to”
    https://www.ads-software.com/support/topic/variable-redirect-on-user-registration/

    It works but after the redirection it always removes the “:” after https so it gives an error page always
    for example if the redirect_to is https://website.one the page redirects to https//website.one

    Here is the form code

    {"type":"form","data":{"fields":[{"id":"text-1","element_id":"text-1","form_id":"wrapper-1511347711918-1669","parent_group":"","type":"text","cols":"12","required":"true","field_label":"","placeholder":"?????? ??????????","wrapper_id":"wrapper-1511347711918-1669","required_message":"?? ???? ??? ??? ????? ?????","conditions":[]},{"id":"password-1","element_id":"password-1","form_id":"wrapper-1511347712118-1739","parent_group":"","type":"password","cols":"12","required":"true","required_message":"?? ???? ??? ??? ????? ?????","field_label":"","placeholder":"???? ??????","description":"","confirm-password-label":"Confirm Password","confirm-password-placeholder":"Confirm new password","wrapper_id":"wrapper-1511347712118-1739","conditions":[]},{"id":"hidden-1","element_id":"hidden-1","form_id":"wrapper-2915-1316","parent_group":"","type":"hidden","options":[],"cols":"12","conditions":[],"wrapper_id":"wrapper-2915-1316","field_label":"","default_value":"query","prefill":"redirect_to"}],"settings":{"pagination-header":"nav","paginationData":{"pagination-header-design":"show","pagination-header":"nav"},"formName":"????? ??????","version":"1.28.1","form-border-style":"none","form-padding":"","form-border":"","fields-style":"open","field-image-size":"custom","validation":"on_submit","akismet-protection":"0","form-style":"default","enable-ajax":"true","autoclose":"true","submission-indicator":"show","indicator-label":"?????...","form-type":"login","submission-behaviour":"behaviour-redirect","thankyou-message":"Thank you for contacting us, we will be in touch shortly.","redirect-url":"https://majalisnoor.com/wp-admin/","submitData":{"custom-submit-text":"????","custom-invalid-form-message":"???? ????? ?? ?????????? ?????? ???????","conditions":[]},"validation-inline":"1","form-expire":"no_expire","use-admin-email":"true","admin-email-title":"","admin-email-editor":"","admin-email-recipients":[],"user-email-title":"","user-email-editor":"","form-padding-top":"0","form-padding-right":"0","form-padding-bottom":"0","form-padding-left":"0","form-border-width":"0","form-border-radius":"0","cform-label-font-family":"Roboto","cform-label-custom-family":"","cform-label-font-size":"12","cform-label-font-weight":"bold","cform-title-font-family":"Roboto","cform-title-custom-family":"","cform-title-font-size":"45","cform-title-font-weight":"normal","cform-title-text-align":"left","cform-subtitle-font-family":"Roboto","cform-subtitle-custom-font":"","cform-subtitle-font-size":"18","cform-subtitle-font-weight":"normal","cform-subtitle-text-align":"left","cform-input-font-family":"Roboto","cform-input-custom-font":"","cform-input-font-size":"16","cform-input-font-weight":"normal","cform-radio-font-family":"Roboto","cform-radio-custom-font":"","cform-radio-font-size":"14","cform-radio-font-weight":"normal","cform-select-font-family":"Roboto","cform-select-custom-family":"","cform-select-font-size":"16","cform-select-font-weight":"normal","cform-multiselect-font-family":"Roboto","cform-multiselect-custom-font":"","cform-multiselect-font-size":"16","cform-multiselect-font-weight":"normal","cform-dropdown-font-family":"Roboto","cform-dropdown-custom-font":"","cform-dropdown-font-size":"16","cform-dropdown-font-weight":"normal","cform-calendar-font-family":"Roboto","cform-calendar-custom-font":"","cform-calendar-font-size":"13","cform-calendar-font-weight":"normal","cform-button-font-family":"Roboto","cform-button-custom-font":"","cform-button-font-size":"14","cform-button-font-weight":"500","cform-timeline-font-family":"Roboto","cform-timeline-custom-font":"","cform-timeline-font-size":"12","cform-timeline-font-weight":"normal","cform-pagination-font-family":"","cform-pagination-custom-font":"","cform-pagination-font-size":"16","cform-pagination-font-weight":"normal","payment_require_ssl":"true,","submission-file":"delete","login-username-field":"text-1","login-password-field":"password-1","remember-me":"true","remember-me-label":"??????","remember-me-cookie-number":"1","remember-me-cookie-type":"months","hide-login-form":"","hidden-login-form-message":"<p style=\"text-align: right\">??? ???? ?? ???? ?????</p>","store_submissions":"","form_name":"-","form_status":"publish","use-custom-css":"","sc_email_link":"1","sc_message":"<p>Your form has been saved as draft and a resume link has been generated so you can return to the form anytime within {retention_period} days from today. Copy and save the link or enter your email address below to have the link sent to your mail.</p><p>These fields weren't saved to your submission draft: Paypal, Stripe, Signature, Password, Captcha, and Upload. Kindly fill them out before submitting the form.</p>","honeypot":"1","use_donotcachepage":"1","akismet-protection-behavior":"fail","spam-fail-message":"?? ?????? ????? ??????? ?????","use_ajax_load":"","notification_count":0,"previous_status":"publish"},"client_id":"","integration_conditions":[],"behaviors":[{"slug":"behavior-4622","autoclose":"1","autoclose-time":"5","newtab":"sametab","submission-behaviour":"behaviour-redirect","thankyou-message":"Thank you for contacting us, we will be in touch shortly.","redirect-url":"https://website.one","label":"Redirect to home","conditions":[{"element_id":"hidden-1","rule":"is","value":""}]},{"slug":"behavior-9488","autoclose":"1","autoclose-time":"5","newtab":"sametab","submission-behaviour":"behaviour-redirect","thankyou-message":"Thank you for contacting us, we will be in touch shortly.","redirect-url":"{hidden-1}","conditions":[{"element_id":"hidden-1","rule":"is_not","value":""}]}],"notifications":[]},"status":"publish","version":"1.28.1"}
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @

    I gave a quick test with your form export and I’m not able to replicate the issue with URL removing “:”.

    It does redirect as:
    https://website.one/

    Do you have a staging site? If yes, could you please check and see how it behaves if you disable all the plugins except Forminator?

    However, it appears the redirection is working based on the form setting rather than the code. Could you also let us know what exact workflow you are looking to achieve so that it would help us to better suggest if there is any changes in the code?

    Looking forward to your response.

    Kind Regards,

    Nithin

    Thread Starter mehdismekouar

    (@mehdismekouar)

    Unfortunately i don’t have the staging option but i tried desactivating plugin by plugin and testing if a desactivated plugin will cure the problem and no desactivated plugin cured the problem after trying all the plugins

    Yes the redirection works correctly when the redirect url is entered as a plain text in forminator behaviour but when it’s entered as a field variable it gets modified by removing the “:”

    The exact workflow is to redirect logged users to the member only pages that they tried to access while logged out
    for example a visitor tries to access https://website.one/members
    the website redirects the visitor to https://website.one/login/?redirect_to=https://website.one/members
    after login success the for redirects the visitor to “redirect_to” which in that case is https://website.one/members

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @mehdismekouar,

    Could you please try this snippet along with the existing code and then check whether it works fine?

    <?php
    add_filter( 'forminator_form_submit_response', 'wpmudev_fix_response_url_redirect', 20, 2 );
    add_filter( 'forminator_form_ajax_submit_response', 'wpmudev_fix_response_url_redirect', 20, 2 );
    function wpmudev_fix_response_url_redirect( $response, $form_id ) {
    	if ( $form_id != 6 ) { //Please change the form ID
    		return $response;
    	}
    
    	if ( ! empty( $response['url'] ) ) {
            $response['url'] = urldecode($response['url']);
            $pos = strpos($response['url'], 'https://');
            if ( $pos !== false ) {
                $response['url'] = substr_replace($response['url'], '', $pos, strlen('https://'));
            }
    	}
    
    	return $response;
    }

    You’ll have to update the following line in the above code with your form ID:
    if ( $form_id != 6 ) {

    Suppose the form ID is 123, the above will change as:
    if ( $form_id != 123 ) {

    Please do check and see whether it helps.

    Kind Regards,

    Nithin

    Thread Starter mehdismekouar

    (@mehdismekouar)

    it worked thanks!

    Plugin Support Jair – WPMU DEV Support

    (@wpmudevsupport15)

    Hi @mehdismekouar,

    I hope you are doing well today!

    We are glad to hear that the issue has been resolved and marking this thread accordingly. Please let us know in case you need further help.

    Kind regards,
    Zafer

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Redirect after login problem’ is closed to new replies.