Created
September 13, 2022 15:33
-
-
Save nikitasinelnikov/9417686b75733aa27b2b456f9e934a68 to your computer and use it in GitHub Desktop.
Ultimate Member v2: User Reviews. Remove star
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
remove_filter( 'um_profile_field_filter_hook__user_rating', 'um_reviews_show_rating', 99 ); | |
/** | |
* Hide rating at frontend | |
* | |
* @param $value | |
* @param $data | |
* | |
* @return string | |
*/ | |
function um_reviews_show_rating( $value, $data ) { | |
return ''; | |
} | |
add_filter( 'um_profile_field_filter_hook__user_rating', 'um_1000_reviews_show_rating', 99, 2 ); | |
/** | |
* Remove Rating column | |
* | |
* @param $columns | |
* | |
* @return mixed | |
*/ | |
function um_1000_manage_edit_um_review_columns( $columns ) { | |
unset( $columns['review_rating'] ); | |
return $columns; | |
} | |
add_filter( 'manage_edit-um_review_columns', 'um_1000_manage_edit_um_review_columns', 100, 1 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Template for the UM User Reviews, The Rating block. | |
* | |
* Page: "Members" | |
* Hook: 'um_members_after_user_name' | |
* Caller: um_reviews_add_rating() function | |
* | |
* This template can be overridden by copying it to yourtheme/ultimate-member/um-reviews/member-rating.php | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; | |
} | |
// flush content then rating will be empty |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Template for the UM User Reviews, The "Add review" block | |
* | |
* Page: "Profile", tab "Reviews" | |
* Caller: um_profile_content_reviews_default() function | |
* | |
* This template can be overridden by copying it to yourtheme/ultimate-member/um-reviews/review-add.php | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) exit; | |
if ( UM()->Reviews()->api()->can_review( um_profile_id() ) ) { | |
um_fetch_user( get_current_user_id() ); ?> | |
<div class="um-reviews-item"> | |
<div class="um-reviews-img"><a href="<?php echo esc_url( um_user_profile_url() ); ?>"><?php echo um_user( 'profile_photo', 40 ); ?></a></div> | |
<div class="um-reviews-prepost"><i class="um-faicon-pencil"></i> <?php _e( 'Write a review for this user', 'um-reviews' ); ?></div> | |
<div class="um-reviews-post review-new"> | |
<span class="um-reviews-title"></span> | |
<span class="um-reviews-meta"> | |
<?php printf( __( 'by <a href="%s">%s</a>, %s', 'um-reviews' ), um_user_profile_url(), um_user( 'display_name' ), current_time( UM()->options()->get( 'review_date_format' ) ) ); ?> | |
</span> | |
<span class="um-reviews-content"></span> | |
<div class="um-reviews-note"></div> | |
<div class="um-reviews-tools"></div> | |
</div> | |
<div class="um-reviews-post review-form"> | |
<a href="javascript:void(0);" class="um-reviews-cancel-add"><i class="um-icon-close"></i></a> | |
<form class="um-reviews-form" action="" method="post"> | |
<span class="um-reviews-rate"> | |
<input name="rating" type="hidden" value="5"> | |
</span> | |
<span class="um-reviews-title"> | |
<input type="text" required="required" name="title" placeholder="<?php esc_attr_e('Enter subject...','um-reviews'); ?>" maxlength="60" /> | |
</span> | |
<span class="um-reviews-meta"> | |
<?php printf(__('by <a href="%s">%s</a>, %s','um-reviews'), um_user_profile_url(), um_user('display_name'), current_time( UM()->options()->get( 'review_date_format' ) ) ); ?> | |
</span> | |
<span class="um-reviews-content"> | |
<textarea name="content" required="required" placeholder="<?php esc_attr_e('Enter your review...','um-reviews'); ?>"></textarea> | |
</span> | |
<input type="hidden" name="user_id" id="user_id" value="<?php echo esc_attr( um_profile_id() ); ?>" /> | |
<input type="hidden" name="reviewer_id" id="reviewer_id" value="<?php echo esc_attr( get_current_user_id() ); ?>" /> | |
<input type="hidden" name="reviewer_publish" id="reviewer_publish" value="<?php echo esc_attr( um_user('can_publish_review' ) ); ?>" /> | |
<input type="hidden" name="action" id="action" value="um_review_add" /> | |
<input type="hidden" name="nonce" id="action" value="<?php echo wp_create_nonce( 'um-frontend-nonce' ) ?>" /> | |
<div class="um-field-error" style="display:none"></div> | |
<span class="um-reviews-send"><input type="submit" value="<?php esc_attr_e('Submit Review','um-reviews'); ?>" class="um-button" /></span> | |
</form> | |
</div> | |
<div class="um-clear"></div> | |
</div> | |
<?php | |
um_fetch_user( um_profile_id() ); | |
} | |
if ( ! is_user_logged_in() ) { ?> | |
<div class="um-reviews-item"> | |
<?php | |
$login_url = add_query_arg( 'redirect_to', add_query_arg( array( 'profiletab' => 'reviews' ), um_user_profile_url() ), um_get_core_page( 'login' ) ); | |
printf( __( 'You are not logged in. Please <a href="%s">login</a> to review this user.','um-reviews'), $login_url ); | |
?> | |
</div> | |
<?php } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Template for the UM User Reviews, The "Edit review" block | |
* | |
* Page: "Profile", tab "Reviews" | |
* Caller: um_profile_content_reviews_default() function | |
* | |
* This template can be overridden by copying it to yourtheme/ultimate-member/um-reviews/review-edit.php | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) exit; | |
global $post; | |
if ( ! UM()->Reviews()->api()->already_reviewed( um_profile_id() ) ) { | |
return; | |
} | |
$post = UM()->Reviews()->api()->get_review_detail( um_profile_id(), get_current_user_id() ); | |
if ( empty( $post->post_content ) ) { | |
return; | |
} | |
$content = wp_strip_all_tags( $post->post_content ); | |
setup_postdata( $post ); | |
um_fetch_user( get_current_user_id() ); | |
?> | |
<div class="um-reviews-item" data-review_id="<?php echo esc_attr( $post->ID ); ?>" data-user_id="<?php echo esc_attr( um_profile_id() ); ?>"> | |
<div class="um-reviews-img"> | |
<a href="<?php echo esc_url( um_user_profile_url() ); ?>"><?php echo um_user( 'profile_photo', 40 ); ?></a> | |
</div> | |
<div class="um-reviews-post review-list"> | |
<span class="um-reviews-title"><span><?php the_title(); ?></span></span> | |
<span class="um-reviews-meta"><?php printf( __( 'by <a href="%s">%s</a>, %s', 'um-reviews' ), um_user_profile_url(), um_user( 'display_name' ), get_the_time( UM()->options()->get( 'review_date_format' ) ) ); ?></span> | |
<span class="um-reviews-content"><?php echo nl2br( $content ); ?></span> | |
<?php if( UM()->Reviews()->api()->is_flagged( $post->ID ) ) { ?> | |
<div class="um-reviews-flagged"><?php esc_html_e( 'This is currently being reviewed by an admin', 'um-reviews' ); ?></div> | |
<?php } ?> | |
<?php if( UM()->Reviews()->api()->is_pending( $post->ID ) ) { ?> | |
<div class="um-reviews-pending"><?php esc_html_e( 'This review will be moderated by an admin before it is live.', 'um-reviews' ); ?></div> | |
<?php } ?> | |
<div class="um-reviews-note"></div> | |
<?php if ( ! UM()->Reviews()->api()->is_pending( $post->ID ) ) { ?> | |
<div class="um-reviews-tools"> | |
<?php do_action( 'um_review_front_actions', um_profile_id(), get_current_user_id(), get_current_user_id(), $post->ID ); ?> | |
</div> | |
<?php } ?> | |
</div> | |
<div class="um-reviews-post review-form"> | |
<a href="javascript:void(0);" class="um-reviews-cancel-edit"><i class="um-icon-close"></i></a> | |
<form class="um-reviews-form" action="" method="post"> | |
<span class="um-reviews-rate"> | |
<input name="rating" type="hidden" value="5"> | |
</span> | |
<span class="um-reviews-title"> | |
<input type="text" name="title" placeholder="<?php esc_attr_e( 'Enter subject...', 'um-reviews' ); ?>" value="<?php echo esc_attr( $post->post_title ); ?>" maxlength="60" /> | |
</span> | |
<span class="um-reviews-meta"><?php printf( __( 'by <a href="%s">%s</a>, %s', 'um-reviews' ), um_user_profile_url(), um_user( 'display_name' ), current_time( UM()->options()->get( 'review_date_format' ) ) ); ?></span> | |
<span class="um-reviews-content"> | |
<textarea name="content" placeholder="<?php esc_attr_e( 'Enter your review...', 'um-reviews' ); ?>"><?php echo esc_textarea( $content ); ?></textarea> | |
</span> | |
<input type="hidden" name="user_id" id="user_id" value="<?php echo esc_attr( um_profile_id() ); ?>" /> | |
<input type="hidden" name="reviewer_id" id="reviewer_id" value="<?php echo esc_attr( get_current_user_id() ); ?>" /> | |
<input type="hidden" name="action" id="action" value="um_review_edit" /> | |
<input type="hidden" name="nonce" id="action" value="<?php echo wp_create_nonce( 'um-frontend-nonce' ) ?>" /> | |
<input type="hidden" name="review_id" id="review_id" value="<?php echo esc_attr( $post->ID ); ?>" /> | |
<input type="hidden" name="rating_old" id="rating_old" value="<?php echo esc_attr( get_post_meta( $post->ID, '_rating', true ) ); ?>" /> | |
<input type="hidden" name="reviewer_publish" id="reviewer_publish" value="<?php echo esc_attr( UM()->roles()->um_user_can( 'can_publish_review' ) ); ?>" /> | |
<div class="um-field-error" style="display:none"></div> | |
<span class="um-reviews-send"><input type="submit" value="<?php _e( 'Save Review', 'um-reviews' ); ?>" class="um-button" /></span> | |
</form> | |
</div> | |
<div class="um-clear"></div> | |
</div> | |
<?php | |
um_fetch_user( um_profile_id() ); | |
wp_reset_postdata(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Template for the UM User Reviews, The list of reviews | |
* | |
* Page: "Profile", tab "Reviews" | |
* Caller: um_profile_content_reviews_default() function | |
* | |
* This template can be overridden by copying it to yourtheme/ultimate-member/um-reviews/review-list.php | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) exit; | |
if ( UM()->Reviews()->api()->already_reviewed( um_profile_id() ) ) { | |
$my_id = get_current_user_id(); | |
} else { | |
$my_id = null; | |
} | |
foreach ( $reviews as $review ) { | |
setup_postdata( $review ); | |
$content = wp_strip_all_tags( $review->post_content ); | |
$reviewer_id = get_post_meta( $review->ID, '_reviewer_id', true ); | |
$reviewer = get_userdata( $reviewer_id ); | |
um_fetch_user( $reviewer_id ); | |
?> | |
<div class="um-reviews-item" id="review-<?php echo esc_attr( $review->ID ); ?>" data-review_id="<?php echo esc_attr( $review->ID ); ?>" data-user_id="<?php echo esc_attr( um_profile_id() ); ?>"> | |
<div class="um-reviews-img"> | |
<a href="<?php echo esc_url( um_user_profile_url( $reviewer_id ) ); ?>"><?php echo um_user( 'profile_photo',40 ); ?></a> | |
</div> | |
<div class="um-reviews-post review-list"> | |
<span class="um-reviews-title"><span><?php echo get_the_title( $review ); ?></span></span> | |
<span class="um-reviews-meta"><?php printf( __('by <a href="%s">%s</a>, %s','um-reviews' ), um_user_profile_url(), um_user( 'display_name' ), get_the_time( UM()->options()->get( 'review_date_format' ), $review ) ); ?></span> | |
<span class="um-reviews-content"><?php echo nl2br( $content ); ?></span> | |
<?php if ( UM()->Reviews()->api()->is_flagged( $review->ID ) ) { ?> | |
<div class="um-reviews-flagged"><?php esc_html_e( 'This is currently being reviewed by an admin', 'um-reviews' ); ?></div> | |
<?php } ?> | |
<div class="um-reviews-note"></div> | |
<div class="um-reviews-tools"><?php do_action('um_review_front_actions', um_profile_id(), $reviewer_id, $my_id, $review->ID ); ?></div> | |
</div> | |
<div class="um-reviews-post review-form"> | |
<a href="javascript:void(0);" class="um-reviews-cancel-edit"><i class="um-icon-close"></i></a> | |
<form class="um-reviews-form" action="" method="post"> | |
<span class="um-reviews-rate"> | |
<input name="rating" type="hidden" value="5"> | |
</span> | |
<span class="um-reviews-title"><input type="text" name="title" placeholder="<?php esc_attr_e('Enter subject...','um-reviews'); ?>" value="<?php echo esc_attr( $review->post_title ); ?>" /></span> | |
<span class="um-reviews-meta"><?php printf( __( 'by <a href="%s">%s</a>, %s','um-reviews' ), um_user_profile_url(), um_user( 'display_name' ), current_time( UM()->options()->get( 'review_date_format' ) ) ); ?></span> | |
<span class="um-reviews-content"> | |
<textarea name="content" placeholder="<?php esc_attr_e('Enter your review...','um-reviews'); ?>"><?php echo esc_textarea( isset( $content ) ? $content: '' ); ?></textarea> | |
</span> | |
<input type="hidden" name="user_id" id="user_id" value="<?php echo esc_attr( um_profile_id() ); ?>" /> | |
<input type="hidden" name="reviewer_id" id="reviewer_id" value="<?php echo esc_attr( get_current_user_id() ); ?>" /> | |
<input type="hidden" name="action" id="action" value="um_review_edit" /> | |
<input type="hidden" name="nonce" id="action" value="<?php echo wp_create_nonce( 'um-frontend-nonce' ) ?>" /> | |
<input type="hidden" name="review_id" id="review_id" value="<?php echo esc_attr( $review->ID ); ?>" /> | |
<input type="hidden" name="rating_old" id="rating_old" value="<?php echo esc_attr( get_post_meta( $review->ID, '_rating', true ) ); ?>" /> | |
<input type="hidden" name="reviewer_publish" id="reviewer_publish" value="<?php echo esc_attr( UM()->roles()->um_user_can( 'can_publish_review' ) ); ?>" /> | |
<div class="um-field-error" style="display:none"></div> | |
<span class="um-reviews-send"> | |
<input type="submit" value="<?php esc_attr_e('Save Review','um-reviews'); ?>" class="um-button" /> | |
</span> | |
</form> | |
</div> | |
<div class="um-clear"></div> | |
<?php do_action('um_review_after_review_content', $review->ID, $reviewer_id , um_profile_id() ); ?> | |
<div class="um-clear"></div> | |
</div> | |
<?php } | |
um_reset_user(); | |
wp_reset_postdata(); | |
wp_reset_query(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Template for the UM User Reviews, The "Overview rating" block | |
* | |
* Page: "Profile", tab "Reviews" | |
* Caller: um_profile_content_reviews_default() function | |
* Child template: review-detail.php | |
* | |
* This template can be overridden by copying it to yourtheme/ultimate-member/um-reviews/review-overview.php | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) exit; ?> | |
<div class="um-reviews-header"> | |
<span class="um-reviews-header-span"> | |
<?php if ( um_is_myprofile() ) { | |
_e( 'Your Rating', 'um-reviews' ); | |
} else { | |
_e( 'User Rating', 'um-reviews' ); | |
} ?> | |
</span> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Template for the UM User Reviews, The list of rated users | |
* | |
* Shortcode: [ultimatemember_lowest_rated], [ultimatemember_most_rated], [ultimatemember_top_rated] | |
* Caller: Reviews_Shortcode->ultimatemember_lowest_rated( $args ) method | |
* Caller: Reviews_Shortcode->ultimatemember_most_rated( $args ) method | |
* Caller: Reviews_Shortcode->ultimatemember_top_rated( $args ) method | |
* | |
* This template can be overridden by copying it to yourtheme/ultimate-member/um-reviews/reviews-widget.php | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) exit; | |
do_action( 'um-reviews-widget--before', $users, $list_class ); | |
?> | |
<ul class="um-reviews-widget <?php echo esc_attr( $list_class ); ?>"> | |
<?php | |
foreach ( $users->results as $user_id ) { | |
um_fetch_user( $user_id ); | |
$count = UM()->Reviews()->api()->get_reviews_count( $user_id ); | |
?> | |
<li> | |
<div class="um-reviews-widget-pic"> | |
<a href="<?php echo um_user_profile_url(); ?>"><?php echo get_avatar( $user_id, 40 ); ?></a> | |
</div> | |
<div class="um-reviews-widget-user"> | |
<div class="um-reviews-widget-name"><a href="<?php echo um_user_profile_url(); ?>"><?php echo um_user( 'display_name' ) . ' (' . $count . ')'; ?></a></div> | |
</div> | |
<div class="um-clear"></div> | |
</li> | |
<?php } ?> | |
</ul> | |
<?php do_action( 'um-reviews-widget-after', $users, $list_class ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.um-reviews-rate { | |
display: none !important; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment