Support » Plugin: Theme My Login » Cannot load the custom template on version 7

  • Resolved Phuc Pham

    (@svincoll4)


    On version 6.x, I have the custom template for the profile-form.php under theme folder, like this path {theme-folder}/theme-my-login/profile-form.php. After upgrading to version 7.x, the extension Profiles doesn’t load this template, it loads its own default form instead.
    Can you bring it back to the old custom template?

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Jeff Farthing

    (@jfarthing84)

    Phuc,

    Unfortunately, like your last question, you will need to direct any questions regarding paid extensions to our support form.

    Jeff, which extension is solving this problem regarding custom templates?

    Plugin Author Jeff Farthing

    (@jfarthing84)

    Custom templates are no longer used by the plugin. Forms are now represented by PHP classes, which generate the “template” when called. The same level of customization can be achieved, it’s just done now using PHP functions. See this: https://docs.thememylogin.com/article/62-adding-extra-registration-fields

    Jeff thank you,

    I am looking for some design changes. My login, register forms are HUGE.

    In your example,

    https://docs.thememylogin.com/article/83-making-forms-bootstrap-compatible

    you add divs before/after each field.

    Is there a hook before and after the form?

    Plugin Author Jeff Farthing

    (@jfarthing84)

    Using that same example:

    
    function make_tml_forms_bootstrap_compatible() {
    	foreach ( tml_get_forms() as $form ) {
    		$form->render_args['before'] = '<div class="some-form-class">';
    		$form->render_args['after'] = '</div>';
    		foreach ( tml_get_form_fields( $form ) as $field ) {
    			if ( 'hidden' == $field->get_type() ) {
    				continue;
    			}
    
    			$field->render_args['before'] = '<div class="form-group">';
    			$field->render_args['after'] = '</div>';
    			if ( 'checkbox' != $field->get_type() ) {
    				$field->add_attribute( 'class', 'form-control' );
    			}
    		}
    	}
    }
    add_action( 'init', 'make_tml_forms_bootstrap_compatible' );
    

    Jeff, thanks a lot. I will try that.

    Jeff, this works. The only problem is, I can insert my design before and after the form. Where other parts of the page (for ex. links after the form) are not included in this.

    I would be glad if you can name any other hook, before tml constructs the page and after.

    In function render,

    $args[‘before’] is before $args[‘container’] this is good.

    But $args[‘after’] is before $this->render_links() and $args[‘container’] which restricts to design the form/page completely. Would it be a problem to put $args[‘after’] in the end?

    Like:

    
            public function render( $args = array() ) {
                    $defaults = wp_parse_args( $this->render_args, array(
                            'container'       => 'div',
                            'container_class' => 'tml tml-%s',
                            'container_id'    => '',
                            'before'          => '',
                            'after'           => '',
                            'show_links'      => true,
                    ) );
    
                    $args = wp_parse_args( $args, $defaults );
    
                    $output = $args['before'];
    
                    if ( ! empty( $args['container'] ) ) {
                            $output .= '<' . $args['container'];
                            if ( ! empty( $args['container_id'] ) ) {
                                    $output .= ' id="' . esc_attr( sprintf( $args['container_id'], $this->name ) ) . '"';
                            }
                            if ( ! empty( $args['container_class'] ) ) {
                                    $output .= ' class="' . esc_attr( sprintf( $args['container_class'], $this->name ) ) . '"';
                            }
                            $output .= ">\n";
                    }
    
                    $output .= $this->render_errors();
    
                    $output .= '<form name="' . esc_attr( $this->get_name() ) . '" action="' . esc_url( $this->get_action() ) . '" method="' . esc_attr( $this->get_method() ) . '"';
                    foreach ( $this->get_attributes() as $key => $value ) {
                            $output .= ' ' . $key . '="' . esc_attr( $value ) . '"';
                    }
                    $output .= ">\n";
    
                    foreach ( $this->get_fields() as $field ) {
                            $output .= $field->render() . "\n";
                    }
    
                    $output .= "</form>\n";
    
                    if ( $args['show_links'] ) {
                            $output .= $this->render_links();
                    }
    
                    if ( ! empty( $args['container'] ) ) {
                            $output .= '</' . $args['container'] . ">\n";
                    }
    
                    $output .= $args['after'];
    
                    return $output;
            }
    Plugin Author Jeff Farthing

    (@jfarthing84)

    You can use the tml_shortcode filter:

    
    function filter_tml_shortcode( $content, $action, $atts ) {
        $content = '<div>' . $content . '</div>';
        return $content;
    }
    add_filter( 'tml_shortcode', 'filter_tml_shortcode', 10, 3 );
    
    Plugin Author Jeff Farthing

    (@jfarthing84)

    @wpturk FYI – TML 7.0.6 will have the after argument after the container, to be consistent with the before argument, which is before the container.

    @jfarthing84, thank you.

    • This reply was modified 1 year, 2 months ago by  wpturk.
    • This reply was modified 1 year, 2 months ago by  wpturk.
Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Cannot load the custom template on version 7’ is closed to new replies.