• Hi there,
    I think my question is quite simple, the answer though is beyond my knowledge.

    How to include theme_my_login() just after “Il suffit de se connecter pour accéder au formulaire.”

    <?php
    	$aria_req = ( $req ? " aria-required='true'" : '' );
    	$args = array(
    
      		'id_form'           => 'commentform',
      		'id_submit'         => 'submit',
      		'title_reply'       => __( '* Je peux apporter une solution' ),
      		'title_reply_to'    => __( 'Je peux répondre à %s' ),
      		'cancel_reply_link' => __( 'Cancel Reply' ),
      		'label_submit'      => __( 'Je partage!' ),
    
    		'comment_field' =>  '<p class="comment-form-comment"><label for="comment">' . _x( 'Solution(s), critiques, témoignage:', 'noun' ) .
    		'</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true">' .
    		'</textarea></p>',
    
      		'must_log_in' =>  '<p class="must-log-in">' .
        	sprintf(
          		__( 'Il suffit de <a href="%s">se connecter</a> pour accéder au formulaire.' ),
          		wp_login_url( apply_filters( 'the_permalink', get_permalink() ) )
        		) . '</p>',
    
      'logged_in_as' => '<p>' .
        sprintf(
        __( 'Connecté en tant que <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Me déconnecter?</a>' ),
          admin_url( 'profile.php' ),
          $user_identity,
          wp_logout_url( apply_filters( 'the_permalink', get_permalink( ) ) )
        ) . '</p>',
    
      'comment_notes_before' => '<p class="comment-notes">' .
        __( 'Your email address will not be published.' ) . ( $req ? $required_text : '' ) .
        '</p>',
    etc.

    So far the following adaptation, is the closest I have to what I want but it displays the tml form wether the user is connected or not… not really what I am trying to do:

    <?php
    	$aria_req = ( $req ? " aria-required='true'" : '' );
    	$args = array(
    
      		'id_form'           => 'commentform',
      		'id_submit'         => 'submit',
      		'title_reply'       => __( '* Je peux apporter une solution' ),
      		'title_reply_to'    => __( 'Je peux répondre à %s' ),
      		'cancel_reply_link' => __( 'Cancel Reply' ),
      		'label_submit'      => __( 'Je partage!' ),
    
    		'comment_field' =>  '<p class="comment-form-comment"><label for="comment">' . _x( 'Solution(s), critiques, témoignage:', 'noun' ) .
    		'</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true">' .
    		'</textarea></p>',
    
      		'must_log_in' =>  '<p class="must-log-in">' .
        	sprintf(
          		__( 'Il suffit de <a href="%s">se connecter</a> pour accéder au formulaire.' ),
          		wp_login_url( apply_filters( 'the_permalink', get_permalink() ) )
        		) . '</p><div="connectform">' .
    		theme_my_login() . '</div>',
    
      'logged_in_as' => '<p>' .
        sprintf(
        __( 'Connecté en tant que <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Me déconnecter?</a>' ),
          admin_url( 'profile.php' ),
          $user_identity,
          wp_logout_url( apply_filters( 'the_permalink', get_permalink( ) ) )
        ) . '</p>',

    I hope somebody will be up to help me (and maybe others)
    Many thanks in advance,
    Yours Sincerely,
    Tche

    https://wordpress.org/plugins/theme-my-login/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Tche111

    (@tche111)

    Any ideas, any body?

    Plugin Author Jeff Farthing

    (@jfarthing84)

    <?php if ( ! is_user_logged_in() ) {
        // Do something if the user IS NOT logged in
    
    } else {
        // Do something if the user IS logged in
    }
    ?>
    Thread Starter Tche111

    (@tche111)

    Thanks for your answer Jef but I knew this way already…
    My problem is that I can not follow this way in my comment.php with the array, the sprintf and the whole ..thing.
    Could you or anybody further help?

    Thread Starter Tche111

    (@tche111)

    Sorry to push it up again,
    I might not be the only one having to deal with a comment-form call with an array… and wishing to ease the connection process with TML…

    Plugin Author Jeff Farthing

    (@jfarthing84)

    Oh, sorry. Your problem is that the theme_my_login() function echoes the form, it doesn’t return it. You need it returned. Try replacing the call to it with:

    Theme_My_Login::get_object()->shortcode()
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to dispay form in comment.php if user is not logged in’ is closed to new replies.