Forum Replies Created

Viewing 15 replies - 1 through 15 (of 152 total)
  • Hey there,
    seems in the html-function you changed latest insertBefore() to appendChild(). Is it possible to do it with all insertBefore()-function in the html-function of the file /includes/class-email-before-download-form.php?
    So change:

    
    public function html()
        {
    
            $raw = do_shortcode("[contact-form-7 id=\"$this->form_id\" ]");
            $remove = array('<ebd />','<ebd/>','<ebd_left />','<ebd_left/>');
            $raw = str_replace($remove, "", $raw);
            $form = new DOMDocument;
            libxml_use_internal_errors(true);
            $form->formatOutput = true;
            $form->loadHTML(mb_convert_encoding($raw, 'HTML-ENTITIES', 'UTF-8'));
            $form->removeChild($form->doctype);
            $form->replaceChild($form->firstChild->firstChild->firstChild, $form->firstChild);
            $parent = $form->getElementsByTagName('form')->item(0);
            $formID = $parent->getAttribute('action');
            $tmp = explode('#', $formID);
            $this->atts['form_id'] = $tmp[1];
            $paragraph = $parent->getElementsByTagName('div')->item(0);
    
            foreach ($this->download_id as $key => $id) {
                if(count($this->download_id) == 1) {
                    $item = $this->hide_download_dom_obj($id, $key);
                }else{
                    $item = $this->download_dom_obj($id, $key);
                }
                $item = $form->importNode($item, true);
                $paragraph->parentNode->insertBefore($item, $paragraph);
            }
    
            foreach ($this->atts as $name => $value) {
                if($value){
                    $item = $this->hidden_dom_obj($name,$value);
                    $item = $form->importNode($item, true);
                    $paragraph->parentNode->insertBefore($item, $paragraph);
                }
            }
            if($this->atts['hide_form'] == 'yes'){
                $script = $this->jquery_dom_obj();
                $item = $form->importNode($script, true);
                $parent->appendChild($item);
            }
            libxml_clear_errors();
            return $form->saveHTML();
        }
    

    to

    
    public function html()
        {
    
            $raw = do_shortcode("[contact-form-7 id=\"$this->form_id\" ]");
            $remove = array('<ebd />','<ebd/>','<ebd_left />','<ebd_left/>');
            $raw = str_replace($remove, "", $raw);
            $form = new DOMDocument;
            libxml_use_internal_errors(true);
            $form->formatOutput = true;
            $form->loadHTML(mb_convert_encoding($raw, 'HTML-ENTITIES', 'UTF-8'));
            $form->removeChild($form->doctype);
            $form->replaceChild($form->firstChild->firstChild->firstChild, $form->firstChild);
            $parent = $form->getElementsByTagName('form')->item(0);
            $formID = $parent->getAttribute('action');
            $tmp = explode('#', $formID);
            $this->atts['form_id'] = $tmp[1];
            $paragraph = $parent->getElementsByTagName('div')->item(0);
    
            foreach ($this->download_id as $key => $id) {
                if(count($this->download_id) == 1) {
                    $item = $this->hide_download_dom_obj($id, $key);
                }else{
                    $item = $this->download_dom_obj($id, $key);
                }
                $item = $form->importNode($item, true);
                $paragraph->parentNode->appendChild($item);
            }
    
            foreach ($this->atts as $name => $value) {
                if($value){
                    $item = $this->hidden_dom_obj($name,$value);
                    $item = $form->importNode($item, true);
                    $paragraph->parentNode->appendChild($item);
                }
            }
            if($this->atts['hide_form'] == 'yes'){
                $script = $this->jquery_dom_obj();
                $item = $form->importNode($script, true);
                $parent->appendChild($item);
            }
            libxml_clear_errors();
            return $form->saveHTML();
        }
    

    I have lots of styling-errors because of insertBefore()..

    @mandsconsulting I also recommend changing /includes/class-email-before-download-form.php:61 from:
    $paragraph->parentNode->insertBefore($item, $paragraph);
    to
    $paragraph->parentNode->appendChild($item);

    If possible I would change all insertBefore to appendChild.

    Reason:
    WP sometimes adds a p-tag around your hidden fields (e.g. when using page builders). So if p-tag is before name, email and submit-field you’ll mostly get styling errors. p-tag on the end will not destroy much as on beginning of the form-fields..

    p-tag class can be fixed by changing /includes/class-email-before-download-form.php:42 from:
    $p->setAttribute('class', 'cf7_input');
    to
    $p->setAttribute('class', $p->getAttribute('class') . ' cf7_input');

    Seems fixed since latest 5.1.1. Thank you! ??

    BTW: Seems this bug is available since v5.0…

    Same problem here after upgrading cf7 to 5.0 and before download to 5.1. I’m using php 5.4.45 (not my server.. :D).

    Hope this bug can also be fixt very soon ??

    • This reply was modified 6 years, 9 months ago by Ninos.
    • This reply was modified 6 years, 9 months ago by Ninos.

    Hey there,
    still have the same problem with cf7 5.0 and before download 5.1 (all latest). Forms are currently wrong.

    I get following html-code directly after the form-tag:
    <p><label class="ebd_input"><input name="ebd_downloads[]" value="10729|Trends im Affiliate-Marketing 2018" type="hidden"></label></p>
    Before there was no p-tag, and so no line-break.

    Also following cf7-html:

    <p class="name-download">Ihr Name<br />
        [text your-name class:name-input id:name]</p>
    
    <p  class="email-download">Ihre E-Mail-Adresse*<br />
        [email* your-email class:email-input id:email]</p>
    
    <p class="submit-download">[submit "Download-Link anfordern" class:submit-pc]</p>

    will now be rendered to this:

    <p class="cf7_input" id="downloadinputform">Ihr Name<br><span class="wpcf7-form-control-wrap your-name"><input name="your-name" value="" size="40" class="wpcf7-form-control wpcf7-text name-input" id="name" aria-invalid="false" type="text"></span></p>
    <p class="cf7_input">Ihre E-Mail-Adresse*<br><span class="wpcf7-form-control-wrap your-email"><input name="your-email" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-email wpcf7-validates-as-required wpcf7-validates-as-email email-input" id="email" aria-required="true" aria-invalid="false" type="email"></span></p>
    <p class="cf7_input"><input value="Senden" class="wpcf7-form-control wpcf7-submit" type="submit"><span class="ajax-loader"></span></p>

    As you can see, the p-classes are completely wrong.

    Hope you can fix it asap ??

    Plugin Author Ninos

    (@ninos-ego)

    Plugin Author Ninos

    (@ninos-ego)

    Thank you for your feedback. This problem is not part of my plugin. My plugin only replaces the wp_hash_password-function. If woocommerce uses its own function for password hashing I strongly recommend opening a ticket in their issuing system:
    https://github.com/woocommerce/woocommerce/issues/

    Something like that must not happen.

    Normally wp_hash_password() must be used, because woocommerce uses the wp_update_user()-function for saving the new user data:
    https://github.com/woocommerce/woocommerce/blob/f434fc7d9a1f00363b07c60bde0aa3c0666e46ac/includes/class-wc-form-handler.php#L248
    And this function is using wp_hash_password():
    https://core.trac.www.ads-software.com/browser/tags/4.7.4/src/wp-includes/user.php#L1760

    Please retry changing a password and tell me if it’s still md5. Then I’ll investigate. May you checked old user accounts, which were created before my plugin was installed/enabled.

    • This reply was modified 7 years, 5 months ago by Ninos.
    Thread Starter Ninos

    (@ninos-ego)

    Hey Marcus,
    thanks for your reply. The WP_Query has filters which can be used to extend the query. So WP_Query can also be multisite-ready. You could use following scripts, so you don’t need to code something by yourself for multisite-feature:
    https://github.com/ericandrewlewis/WP_Query_Multisite
    https://github.com/miguelpeixe/WP_Query_Multisite

    I really recommend switching to WP_Query. It’s may a little bit work, but it enhances your compatibility with lots of plugins and also adds flexibility to your queries.

    Kindest regards

    Plugin Author Ninos

    (@ninos-ego)

    Sorry for the late response. You can use following hooks:

    • wp_custom_login_header_before
    • wp_custom_login_header_after
    • wp_custom_login_footer_before
    • wp_custom_login_footer_after

    Also you can use a css-file ‘wp-custom-login.css’ in your theme for adding custom css to the login page.

    Best regards

    Thread Starter Ninos

    (@ninos-ego)

    Ah ok, that would be perfect. No stress, atm I’m just changing the relevant code part ??

    Thread Starter Ninos

    (@ninos-ego)

    Hmm, yeah there you’re right. So then I would do something like that ??
    if ($this->foot_count == 0 && ( strstr($contents, '="boxersandswipers"') || apply_filters( 'boxersandswipers_enable_js', false ) )) {

    Best regards ??

    Thread Starter Ninos

    (@ninos-ego)

    PS: Following has better performance:
    if ($this->foot_count == 0 && ( strstr($contents, '="boxersandswipers"') || has_post_thumbnail() )) {

    Thread Starter Ninos

    (@ninos-ego)

    Wow, you’re very fast and thanks you! I have another improvement XD If you’re using boxersandswipers for the thumbnail and you have no images in content (the_content()), then the lib is not loaded. Therefore I added following additional check in /inc/BoxersAndSwipers.php on line 243:
    if (strstr($contents, '="boxersandswipers"') && $this->foot_count == 0) {
    to
    if ( (has_post_thumbnail() || strstr($contents, '="boxersandswipers"') ) && $this->foot_count == 0) {

    Best regards ??

Viewing 15 replies - 1 through 15 (of 152 total)