This file contains 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 | |
function wp_ulike_custom_author_counter( $user_id, $status = 'like' ){ | |
global $wpdb; | |
$meta_key = wp_ulike_setting_repo::isDistinct( 'post' ) ? 'count_distinct_' . $status : 'count_total_' . $status; | |
return $wpdb->get_var( | |
$wpdb->prepare( | |
"SELECT SUM(m.meta_value) FROM {$wpdb->prefix}ulike_meta m INNER JOIN $wpdb->posts p ON m.item_id = p.ID AND p.post_author = %s WHERE m.meta_group = 'post' AND m.meta_key = %s", |
This file contains 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 | |
function wp_ulike_pro_get_current_user_pinned_posts($atts){ | |
global $post; | |
$attributes = shortcode_atts( array( | |
'post_type' => 'post', | |
'past_days' => '', | |
'per_page' => 10 | |
), $atts ); |
This file contains 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 | |
/** | |
* Register custom template | |
* | |
* @param array $templates | |
* @return array | |
*/ | |
function wp_ulike_voting_register_templates( $templates ){ | |
$templates['wpulike-custom-template'] = array( |
This file contains 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 | |
function wp_ulike_disable_same_category_actions( $status, $args , $settings ){ | |
if( $args['type'] === 'post' && get_post_type( $args['item_id'] ) == 'post' ){ | |
$user_info = wp_ulike_get_meta_data( $args['current_user'], 'user', 'post_status', true ); | |
if( ! empty( $user_info ) ){ | |
$category_list = array(); | |
foreach ($user_info as $item_id => $current_status) { | |
if( ! empty($current_status ) && strpos( $current_status, 'un') === false && get_post_type( $item_id ) == 'post' ){ |
This file contains 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 | |
/** | |
* Restrict period time for 10 days after post publish | |
* | |
* @param integer $id | |
* @param string $type | |
* @return void | |
*/ | |
function wp_ulike_pro_custom_restrict_period_time( $id, $type ){ |
This file contains 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 | |
add_action( 'admin_action_migrate_likebtn_to_wp_ulike', 'migrate_likebtn_to_wp_ulike_admin_action' ); | |
function migrate_likebtn_to_wp_ulike_admin_action(){ | |
global $wpdb; | |
// Do your stuff here | |
if( empty( $_POST['posts'] ) && empty( $_POST['comments'] ) ){ | |
wp_die( 'Please select an option!' ); | |
} |
This file contains 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 | |
add_action( 'elementor/query/order_by_like_amount', function( $query ) { | |
// Get current meta Query | |
$meta_query = $query->get( 'meta_query' ); | |
// If there is no meta query when this filter runs, it should be initialized as an empty array. | |
if ( ! $meta_query ) { | |
$meta_query = []; | |
} |
This file contains 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 | |
function wp_ulike_custom_permission_status( $status, $args, $settings ){ | |
$cookie_key = sanitize_key( 'wp_ulike_manual_' . $args['type'] . $args['item_id'] ); | |
$has_cookie = false; | |
if( isset( $_COOKIE[ $cookie_key ] ) ) { | |
$status = false; | |
$has_cookie = true; | |
} else { |
This file contains 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 | |
/** | |
* Create shortcode: [wp_ulike_pro_um_counter] | |
* | |
* @param array $atts | |
* | |
* @return integer|string | |
*/ | |
function wp_ulike_pro_get_um_counter( $atts ){ |
This file contains 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 | |
/** | |
* Add new fields to account form | |
* | |
* @param string $type | |
* @param array $args | |
* @return void | |
*/ | |
function wp_ulike_pro_customize_account_form( $type, $args ){ |