WP Manifestindependent plugin directory
manifest / integrations / heavenhold-helpers

Heavenhold Helpers

Plugin to create custom database tables with WPGraphQL

by Sumit Kukreja · github.com/skukreja/heavenhold-helpers

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/skukreja/heavenhold-helpers/archive/refs/heads/main.zip

This plugin adds a custom database table to store user votes for items in the Heavenhold project.

Installation

  1. Download the heavenhold-helpers.php file.
  2. Place the file in your WordPress plugins directory.
  3. Activate the plugin from the WordPress admin dashboard.

Usage

The plugin registers a new database table called build_likes with the following columns:

  • vote_id (BIGINT): The unique ID for each vote.
  • hero_id (BIGINT): The ID of the hero associated with the vote.
  • item_id (BIGINT): The ID of the item associated with the vote.
  • user_id (BIGINT): The ID of the user who voted.
  • ip_address (VARCHAR(15)): The IP address of the user who voted.
  • up_or_down (TINYINT): The vote type: 1 for like, 0 for dislike.

The plugin also registers a custom WPGraphQL type called ItemLikeDislikeCount with the following fields:

  • itemId (Int): The ID of the item.
  • likeCount (Int): The total number of likes for the item.
  • dislikeCount (Int): The total number of dislikes for the item.
  • userId (Int): The ID of the user.
  • userVote (String): The current user's vote status on the item: "like", "dislike", or "none".

You can access the likes and dislikes for a specific hero and user using the itemsLikesByHero query.