Git Product home page Git Product logo

wordpress-post-like-system's People

Contributors

jonmasterson avatar qoto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wordpress-post-like-system's Issues

Google webmaster errors

Hello, i receive this error in webmaster for every post when u give like

wp-admin/admin-ajax.php?action=process_simple_like&nonce=ae6e6de73a&post_id=410&disabled=true&is_comment=0

What is the problem?Thanks

JS code is not added in the header

Hi
I really need a like system on my blog and i tried this one.
But the script is not added in the theme and therefor the link won't work. I did exactly as you wrote in the readme file and still...
After that i added the script, just for test, in header file, and after that before /body and there wasn't any change. When i click on the link, it'll move the scroll to top of the page.
What do you think is the problem?

Is there a way I can manipulate the number of likes the heart displays or starts off?

Is there a way I can manipulate the number of likes the heart displays or starts off?

For example each post with the heart/like starts at 0 is there a way we can adjust the like number to start at like 25 or 213?

Also is there a way the like/heart can have the letter 'k' after it reaches 1000 likes

For example 2,452 will translate to 2,45k or 2.4k

Awesome plugin! Lightweight & simple to integrate.

Feature request: Author total likes

Hey there--

Wondering if it might be possible through some arithmetic to calculate the total number of likes an author's posts (in total) have received to display it on their author profile page?

The use case would be a multi-author site to gamify authorship and have bragging rights / top authors (not necessarily to display as a list, but if an author wanted to compare their likes to another's).

Show liked custom post types in user profile.

I'm using your Code to let Users like custom post types and it's working great! The only thing is, that liked posts, that don't have a title, are not appearing in the Users Profile view. Only Posts with a title are shown. But Wordpress assigns a unique ID to the post, so the title isn't really needed.
But if i like a social media post with no title, it's not appearing in the user profile.

How to achieve this?

Status...

Is this project still maintained?

Google Webmaster tools problem

Hi there,

I have your plugin running on my website... it was all ok (I really liked it) but now when I access google webmaster tools It shows many software errors (google official link for tis error https://support.google.com/webmasters/answer/2409443?ctx=MCE&ctx=S4)... Now I have 491 software errors .... A usual link error seems like:
http://www.website.com/wp-admin/admin-ajax.php?action=process_simple_like&nonce=e9509175b0&post_id=12121&disabled=true&is_comment=0

What this error mean? And how I can solve it?

Thanks

Auto update issue

Hi,
I have a like icon at two places in my website ,
What i need , is that if i like form one icon and it show count , the other can also update automatically ,?

Is this plugin provide such functionality ...?
Please reply asap

May be a Security Issue

Hello,

You have a very nice code, but I think there is one line that might be a Security Issue -

$is_comment = isset( $_REQUEST['is_comment'] ) ? $_REQUEST['is_comment'] : 0;

Might be used for Injection attack etc.

I would rather use -

$is_comment = isset( $_REQUEST['is_comment'] ) ? 1 : 0;

Just a suggestion.

Thank You!

There no issue here (yet!). I only logged in to say a big thank you for putting this out. Looking at all the help you have provided folks with different customizations, I want to say you are one of those rare selfless people who can go out of their way to help a person.

Thank you and stay like this!

Implementation outside of Wordpress? Complicated? or Not?

I'm just wondering how hard would it be to modify this to work without wordpress. Non-programmer here, but I've seen PHP code around... I guess I'm just wondering if there is a point for me even starting it (like if it's too complex for php noop to comprehend), I mean I'm up for the challenge, I just don't know how tall of a mountain this would be for me. And if I should try and find something else already available?

Any advice would be appreciated very much.
Cheeers

Removing the liked post from the page template not works.

Removing liked posts from page template not working. But added same code how it was for posts page.

<?php
/*
* Template Name: Liked Posts
*/
get_header();
$current_user = get_current_user_id();
?>
	<table class="form-table">
		<tr>
			<th><label for="user_likes"><?php _e( 'You Like:', 'YourThemeTextDomain' ); ?></label></th>
			<td>
			<?php
			$types = get_post_types( array( 'public' => true ) );
			$args = array(
			  'numberposts' => -1,
			  'post_type' => $types,
			  'meta_query' => array (
				array (
				  'key' => '_user_liked',
				  'value' => $current_user,
				  'compare' => 'LIKE'
				)
			  ) );		
			$sep = '';
			$like_query = new WP_Query( $args );
			if ( $like_query->have_posts() ) : ?>
			<p>
			<?php 
            
 while ( $like_query->have_posts() ) : $like_query->the_post(); 
 echo $sep; 
 $post_id = get_the_ID();
 $nonce = wp_create_nonce( 'simple-likes-nonce' );
 $is_comment = '0';
?>
 <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
 <?php the_title(); ?></a> 
 <?php echo  $post_id; ?>
 <a href="<?php echo admin_url( 'admin-ajax.php?action=process_simple_like' . '&post_id=' . $post_id . '&nonce=' . $nonce . '&is_comment=' . $is_comment . '&disabled=true') ?>">Remove</a>
 <?php echo do_shortcode('[jmliker]'); ?>
			<?php
			$sep = ' &middot; ';
			endwhile; 
			?>
			</p>
			<?php else : ?>
			<p><?php _e( 'You do not like anything yet.', 'YourThemeTextDomain' ); ?></p>
			<?php 
			endif; 
			wp_reset_postdata(); 
			?>
			</td>
		</tr>
	</table>
<?php get_footer(); ?>

Header plugin

Hello JonMasterson, I'm using your plugin but I had to make a change in the header thus leaving.

Plugin Name: WordPress Post Like System
Plugin URI: http://jonmasterson.com/
Description: A simple and efficient post like system for WordPress.
Version: 4.0
Author: Jon Masterson
Author URI: http://boliquan.com/
Text Domain: WP-POST-LIKE
Domain Path: /lang

likes dont stay

hello,

thanking you for providing with such a great code. between, would like to know why the likes dont stay for all my posts. for few, it does and for few, it doesnt. i am not able to understand the reason. any suggestion?

regards

anonymous user and cache-ing

I've noticed that the like counter (as well as the shape fill) don't work properly (or update right away) when an anonymous user does the liking. I believe this is a cache-ing issue during the calls to update_post_meta() and update_comment_meta().

Changing Icon Position

Thank you for your work its so usefull. i am changed output sort $count . $loader . $icon but when i click its turning default i want to pull text left side but i couldnt :(

just display likes....without hyperlink...non-clickable version

is it possible to just display the likes a post got.....something like a non-clickable version....not sure what to call it....may be it can be called a muted version

for example
I will place the likes in the single post for users to click on it and register/unregister a like..... but on the home page(for instance a static home page to display latest/featured posts ) I just want to display the number of likes a post got, the user can not click the like icon to register a like, just display the likes.

SUGGESTION: type flag

Hi,

I have a suggestion to modify the code.

Currently the code is written in a way that it only supports POST/PAGE and COMMENTS.
Specially, checking of COMMENT is done by $is_comment flag-variable.

Here is the problem, we want to use the LIKE system may be also for MarketPlace posts, bbPress and BuddyPress activities etc. At current stat of the coding its hard to modify.

I would like to suggest you to change the code so that all the LIKE functions will take two parameters - ID and type. type { 'P' for Page/Post, 'C' for Comments, 'M' for MarketPlace, 'B' for bbPress etc. }

If type parameter is other than 'P' or 'C', it will just call a custom function say - get_simple_likes_button_B() which will be custom written.

This will help us to use this code and implement it for different plugins.

Issue with BuddyPress

Found an issue when run this system with BuddyPress plugin.

If a user (role: subscriber) is login and click to like/dislike a CPT which author is himself, the $response variable not return the parameters (status, icon, etc.), but the complete code of member page.

This remove the button icon and text.

show top rated by category?

Hi, do I show the top rated by category id number?
Example I want to show you the 5 most popular content by 1 category id.

content title and picture will be enough.

Don't enqueue scripts

Hey there

Great code! Just a question: How can we use this without enqueue the script in the functions.php?

function sl_enqueue_scripts() {
	wp_enqueue_script( 'simple-likes-public-js', get_template_directory_uri() . '/js/simple-likes-public.js', array( 'jquery' ), '0.5', false );
	wp_localize_script( 'simple-likes-public-js', 'simpleLikes', array(
		'ajaxurl' => admin_url( 'admin-ajax.php' ),
		'like' => __( 'Like', $textdomain ),
		'unlike' => __( 'Unlike', $textdomain )
	) );
}

I'm using Sage which bundles all the scripts so i don't want separate scripts in my functions.php, how can i achieve this? Or would it be possible to just place all of this in a plugin?

Unlike issue with WP Query

When I query posts to show the most-liked posts for all time (function 12) I see that even after I unlike a post, it’s still listed as most-liked. This is a bug that someone else commented on in the original post about this. Please assist.

After click icon and count disappears

First off, thanks for the work on this script.

It works fine for me on localhost, but on wpEngine - whenever I click the like link - it disappears. I refresh the page, and it is as if nothing was clicked.

Could this be an issue with the wpEngine's cache layering?

Thanks!

changing icon position, etc.

I'm trying to change the icon position so it's to the right of the "Like" text. I modified the $output so it's wrapped in a <div> instead of a <span> and I'm using my own custom icons.

I also changed the $output so it's $count . $icon, which displays correctly by default, but when clicked it moves the icon back to the left when it shows the count.

Is there something else that needs to be modified to keep the icon on the right?

I don't see the "Unlike" text. Is that setup only for comments?

I'd also like to show the likes count by default, even if someone hasn't liked it yet.

Is it possible to show it as: Like Text -> Icon -> Count, and if it has been liked: Unlike Text -> Unlike Icon -> Count ?

Alternatively (and probably best) would be to just show the like count above this button, such as "xxx people like this" and then below I'd have the like button with Like Text -> Icon and when clicked it would show Unlike Text -> Unlike Icon without the loading text popping up. Either way, need the icon on the right ;)

any info is appreciated, and thanks for the cool tool πŸ‘

p.s. I'm not a programmer so maybe I'm just missing the obvious stuff in the code after 18 hours of work.

How can I use ajax for this

hi, very nice addon I love it and I am using this code to display users who liked post ,

        $userlikes = get_post_meta( get_the_ID() , '_user_liked', true );
        if ( ! empty( $userlikes ) ) {
            $user_query = new WP_User_Query( array( 'include' => $userlikes, 'number' => 4, 'order' => DESC, ) );
        }
// User Loop
        if ( ! empty( $user_query->results ) ) {
            foreach ( $user_query->results as $user ) {
                ?>

                    <span><?php echo $user->user_login; ?></span>


        <?php    
    }
}

but need to refresh page to see new users who liked, I need little help to use ajax display this result, without refresh page,

Is it possible to add like and dislike button

Hi,
I love this plugin. It's very easy to setup and minimal for what it does.
But I am in need to create 2 buttons for like and dislike. More like vote up and vote down button.
Can it be done with this plugin? Looking for a light weighted solution for this.

Please suggest.

Possible to simply display total 'likes' of all posts of CPT?

I've tried to manipulate a couple of the functions to get this solution, but I'm not having any luck.

Basically my client is asking that I have a display of all "likes" from the total of all the posts of this custom post type. Its kind of a "here's how much activity this site is getting" kind of a statistic.

Is this possible?

Inconsistent Functionality On A Clean WordPress Install

Hi Jon & Other Interested Parties (this means you),

I'm evaluating your awesome like system on a clean WordPress install using the stock Twenty Fifteen WP theme:

https://just-post-likes-micahbolen.c9.io/

I made 0 modifications to your code and 0 modifications to the stock WordPress code and I hope I followed your simple installation instructions adequately (pretty sure of this as I triple-checked).

I am seeing intermittent inconsistencies with the like count and intermittent unexpected behavior when the like button is pressed. I want to say that the problems are more frequent when testing as an anonymous user, but I'm not certain if that's the only time I see the problems.

I'm not getting any JS or PHP errors. Again, this is a clean WP install. No other plugins and no obvious library conflicts or anything of that nature.

I'm reaching out to you (Jon in particular) primarily because I could not reproduce the problems I was seeing on my sandbox on your demo page: http://jonmasterson.com/post-like-demo/

It seems that your demo page runs just fine and I assume the related code on your demo page is pretty much identical to what is available in this repository. However, I did notice that your demo page seems to take a little longer to process "likes" than my sandbox. Ever so slightly longer. Perhaps, it is because your demo page has lots of likes and, therefore, it takes longer to count them all. That is what I assume. So, that brings me back to my sandbox of a clean WP install.

Any assistance or recommendations from anyone watching this repo would receive much kudos and praise for anything that is in the least bit helpful.

Kind Regards,

Micah

Sort posts by number of likes

Hi guys,
I was wondering if you know any way to sort posts by the number of likes they have?
I know I can do that using 'orderby' => 'meta_value_num' but then it won't include the results that don't have the post meta value in the database.

Thanks!

Font Awesome Icon Updates

Hey Jon - great stuff here, thanks for sharing. Quick but stupid question: how do I update the FA icon from a heart to a thumbs up (or any other FA icon)? Thanks again!

like two times the same post

When i'm logged in i can like the post and when i'm log out i can also like the post. So a same user can like two times the same post.
Is it normal ?

No Result from get_post_meta( ) in post_user_likes() function

Hi Jon,

WP function update_post_meta( $post_id, "_user_liked", $post_users ) will never be called, because $post_users as result of the function post_user_likes( $user_id, $post_id, $is_comment ) is always empty. So the meta key "_user_liked" will never be added in WP.
That's why you won't be able to check, if the user has already liked or not.

Am I right or do I miss something?
Thanks

Plugin broken in Wordpress 5.4.*

Hello! I'm using your code for years now on this site and it was working like a charm! But now, all of the sudden, it stopped working and i can only imagine that it is a compatibility issue with the latest Wordpress version.

If you visit the site above, it will probably show you some posts with the flag "liked" in red, even though you probably never liked a post on that site. Because of this, people are toggling each others likes instead of adding up. The communication with the backend is still working but it is not possible anymore to have more than 1 like on 1 post.

Those with more are older or i've set that manually as a test.

Any help would be very appreciated!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.