WordPress.org

Forums

I Recommend This
[resolved] Recommendation to fix usage in hidden/expanding elements (10 posts)

  1. forthewinn
    Member
    Posted 1 year ago #

    The plugin will not work if the content is within a hidden area when the page loads. I'd recommend fixing by delegating to the parent element. In dot_irecommendthis.js:

    $(document).on('click', '.dot-irecommendthis',

    I've had to modify it with this quickfix for the time being.

    Some other suggestions for updates:
    - Function to display just the number
    - Ability to add custom classes to link
    - Option to start from 1, rather than 0.
    - Ability to clear recommendations
    - Ability to change title that says "recommend this" (viewable on hover). In my case, this language doesn't make sense
    - Ability to view blocked IPs, clear them, and whitelist them

    https://wordpress.org/plugins/i-recommend-this/

  2. Harish Chouhan
    Member
    Plugin Author

    Posted 1 year ago #

    @forthewinn THanks for the recommendations. I noticed you have commented on the plugin on both of my sites as well. Would appreciate if you stick to 1 place to communicate whichever is easier for you so I can then use that to reply.

    Regarding to your first thing you mentioned, I never thought of that. If possible may I request you to give me link to the page where you faced the issue and keep the original code back?

    Things I would work on as soon as time permits:

    1. Option to start from 1, rather than 0.
    2. Ability to change title that says "recommend this" (viewable on hover). In my case, this language doesn't make sense

    - Ability to clear recommendations (this won't be added anytime soon as there are many plugins for that already. The plugin was created as a basic voting mechanism for posts, custom post types. But I would keep this on the to-do list.)

    Regarding other suggestions:
    - Function to display just the number (Can be done using basic CSS modification hence won't be added)
    - Ability to add custom classes to link (Again if someone is added custom CSS class, they would want to give it some custom styling. And if CSS is added anyways, it would be pointless for a custom class. Developers could simply use the existing class)
    - Ability to view blocked IPs, clear them, and whitelist them (I am not sure what blocked IP's you mean?)

    The plugin was created for 1 single purpose and I am thankful that people have used it and liked it, I would be taking note on improvements such as option to start with a count of 1, ability to customize the on hover text, etc. Unlimited options is more confusing and keeping with WordPress's philosophy of making decisions and not options, I'm trying to stay on that path.

    I hope I have explained each of your questions in the best possible way.

  3. forthewinn
    Member
    Posted 1 year ago #

    I don't have a testing link I can share, but simply put the button in a container div that is display none and the event will not be bound.

    For displaying just the number- The auto markup that the plugin generates can create problems, such as within an anchor link (link within a link). Just CSS can't fix that.

    Custom Class- This is better and simpler than creating extra CSS markup when one already has a button style or other helper classes and wants to add that style without using jQuery to add it.

    Clear Recommendations- There are already plugins that can modify or reset the number that your plugin stores for the votes? Can you point me towards what you are referring to? Else I would assume I would have to go into the database to do this? (not sure where it's stored)

    Blocked IPs- The settings page has "Disable saving of IP Address. Will only save cookies to track user votes.", so I was assuming that there was something preventing the same IP from voting multiple times on the same post.

    Thanks.

  4. Harish Chouhan
    Member
    Plugin Author

    Posted 1 year ago #

    @forthewinn I will test the hidden thing soon. I am marking this ticket again as unresolved so I can remind me of this issue for testing.

    Custom Class: I am not sure of what you mean by anchor link within a link? That is not a valid way to add links in the first place. The plugin's CSS using a image. Anyone can simply override it with few lines of CSS. That helps developers to customize it based on their needs. As features such as this would always be requested by someone. And it would simply make the entire plugin bloated after a while. Hence as I mentioned earlier, if a theme needs special styling, it can target the existing classes. I have done so for my own themes and few theme developers on ThemeForest have also done the same.

    Clear Recommendations: No I mean there are other standalone plugins for rating that allow the like/unlike feature similar to Facebook like. I currently have no plans of adding this feature anytime soon.

    Blocked IP's: Yes if the disabled IP is not selected, a person cannot vote for the same post twice even if they manage to delete their local cookie. This is useful for many cases and was the reason I had created the plugin initially. For e.g. many website design galleries have similar voting features. If the voting/recommend is not an important part of the site, then I recommend selected the
    "Disable saving IP address" option" as it will avoid the need to adding the IP and increasing database size.

  5. forthewinn
    Member
    Posted 1 year ago #

    Exactly. You can't have links within links, which is the problem I was describing. In my structure I need to display the number within a link (a block level link around a whole grid item). Your function generates an anchor link, so the only way I can get the number is to hide the whole thing in another spot, use jquery to get the number from the hidden element, and then put that text within the element I need it in. A little hackish and I'm sure some other users would not be able to figure it out. Adding a function for that is pretty simple and not too many lines of code, and makes your plugin more useful for a broader audience. I wouldn't call that bloat.

  6. Harish Chouhan
    Member
    Plugin Author

    Posted 1 year ago #

    @forthewinn I'm a little confused here regarding your use case. I can only be able to understand if I see what you are trying to do.

    If you simply need to display the vote count, you could simply echo the count using something like:

    <?php $custom_vote_count = get_post_meta( get_the_ID(), '_recommended', true ); ?>

    You could then echo the variable $custom_vote_count inside whatever content/link you want.

  7. forthewinn
    Member
    Posted 1 year ago #

    Excellent, thanks.

  8. Harish Chouhan
    Member
    Plugin Author

    Posted 11 months ago #

    @forthewinn, Hello,

    Can you please share with me the JS file you had modified to make the plugin work with hidden data

  9. forthewinn
    Member
    Posted 11 months ago #

    Here's the full thing. Only a change on one line:
    https://gist.github.com/jawinn/327db34270caf4f3ff0c

  10. Harish Chouhan
    Member
    Plugin Author

    Posted 11 months ago #

    Thanks @forthewinn for the prompt reply. I'll test it and release it in next version and giving you credit for the same.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • I Recommend This
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.