How to display this link in PHP?

Discussion in 'PHP' started by nasi, Jan 6, 2013.

  1. #1
    Hi,
    I have this code:
    	<p class="reviews"><?php
    		if ( va_user_can_add_reviews() ) {
    			echo html_link(
    				get_permalink( get_the_ID() ) . '#add-review',
    				__( 'Add your review', APP_TD )
    			);
    			echo ', ';
    		} else if ( !is_user_logged_in() ) {
    			echo html_link(
    				get_permalink( get_the_ID() ) . '#add-review',
    				__( 'Add your review', APP_TD )
    			);
    			echo ', ';
    		}
    PHP:
    I want to display just the link: "Add review" which will lead to submit review form on my site.Can you tell me how to remove the unneeded data (which looks for user registration)and to wrap this code as link?
     
    nasi, Jan 6, 2013 IP
  2. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #2
    Since they both have the same code
    <p class="reviews"><?php
            if ( (va_user_can_add_reviews()) || (!is_user_logged_in()) ) {
                echo html_link(
                    get_permalink( get_the_ID() ) . '#add-review',
                    __( 'Add your review', APP_TD )
                );
                echo ', ';
            }
    
    PHP:
     
    Rukbat, Jan 6, 2013 IP