Prevent ratings for your own entries/listings

This topic contains 4 replies, has 3 voices, and was last updated by  Naveen Giri 4 years, 2 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #531638

    Andreas
    Expired Member
    Post count: 43

    Hi,

    is it possible to prevent ratings for your own entries/listings?

    Best regards
    Andreas

    #531688

    Alex Rollin
    Moderator
    Post count: 27815

    Hello,

    Unfortunately there isn’t a setting for that, so it would require a customization.

    The developers will take a look at your question, probably after the weekend, and let you know if there is any easy fix.

    #531971

    Naveen Giri
    Moderator
    Post count: 1559

    Hi Andreas,

    Please ignore my last message, use following snippet to remove rating only for listing author.

    
    add_action('wp', 'disable_rating_input');
    function disable_rating_input(){
    	global $gd_post;
    	// remove rating for listing author.
    	if( $gd_post->post_author == get_current_user_id()){
    		remove_action( 'comment_form_logged_in_after', array( GeoDir_Comments, 'rating_input' ) );	
    	}
    }
    

    Thanks

    #532146

    Andreas
    Expired Member
    Post count: 43
    This reply has been marked as private.
    #532179

    Naveen Giri
    Moderator
    Post count: 1559

    Hi Andreas,

    Sorry for inconvenience. I have done some changes, please try following code snippet.

    
    
    
    
    add_action('wp', 'disable_rating_input');
    function disable_rating_input(){
    	global $gd_post;
    	// remove rating for listing author.
    	if( $gd_post->post_author == get_current_user_id()){
    		remove_action( 'comment_form_logged_in_after', array( 'GeoDir_Comments', 'rating_input' ) );	
    	}
    }
    

    Thanks

Viewing 5 posts - 1 through 5 (of 5 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket