Updating to 2.0

WordPoints follows Semantic Versioning, and so version 2.0.0 is backward incompatible with previous versions. This means that you need to test your code written for 1.x for compatibility with 2.x, or else things could break.

Below is a list of backward-incompatible changes that you should be aware of. Most of these shouldn’t take you by surprise. Most of the functions and files removed have been marked as deprecated for at least a few versions, and will have given notices if used when WP_DEBUG mode is turned on.

Removed Files #

  • admin/includes/deprecated.php (not previously deprecated)
  • assets/css/datatables.css
  • assets/js/datatables-init.js
  • assets/js/jquery.datatables.min.js
  • components/points/includes/hooks/comment-removed.php
  • components/points/includes/hooks/post-delete.php
  • components/points/includes/hooks.php
  • components/points/install.php
  • components/points/uninstall.php
  • components/ranks/functions.php (not previously deprecated)
  • components/ranks/install.php
  • components/ranks/uninstall.php
  • includes/script.php (not previously deprecated)
  • includes/uninstall-bootstrap.php
  • includes/update.php
  • install.php

Removed Classes #

  • WordPoints_Modules
  • WordPoints_Points_Types

Removed Methods #

WordPoints_Post_Points_Hook

  • delete_hook()
  • delete_logs()

WordPoints_Comment_Points_Hook

  • approve_logs()
  • disapprove_logs()

WordPoints_Points_Hooks

  • list_inactive()
  • _register_hook()
  • _register_network_hook()
  • _unregister_hook()
  • get_all()

WordPoints_Points_Un_Installer

  • uninstall_points_single() (not previously deprecated)
  • uninstall_points_main() (ditto)

WordPoints_Ranks_Un_Installer

  • uninstall_ranks_main() (not previously deprecated)

Removed Functions #

  • wordpoints_register_module()
  • wordpoints_module_is_active()
  • wordpoints_modules_user_cap_filter()
  • wordpoints_symlink_fix()
  • wordpoints_dir_include()
  • wordpoints_debug()
  • wordpoints_debug_message()
  • wordpoints_enqueue_datatables()
  • wordpoints_display_admin_screen()
  • wordpoints_points_user_cap_filter()
  • wordpoints_points_component_uninstall()
  • wordpoints_points_component_activate()
  • wordpoints_points_component_update()
  • wordpoints_ranks_component_activate()

Removed Parameters #

  • WordPoints_Points_Logs_Query::count(): the first parameter ($use_cache) was removed.
  • WordPoints_Points_Logs_Query::get(): the second parameter ($use_cache) was removed.
  • WordPoints_Points_Logs_Query::__construct(): the following keys are no longer supported in the $args['meta_query'] parameter: id, id__in, id__not_in, key, value, value__in, value__not_in.

Removed Constants #

  • WORDPOINTS_POINTS_LOGS_DB
  • WORDPOINTS_POINTS_LOG_META_DB

In addition, the following config constants no longer have any effect:

  • WORDPOINTS_DEBUG
  • WORDPOINTS_SYMLINK

Other Notes #

In addition to the above, there are some other changes that you should note.

Changed Hook Signatures #

  • The WordPoints_Post_Points_Hook::publish_logs() method is deprecated and is no longer hooked to 'wordpoints_points_log-post_publish'. The logs() method is hooked to it instead, for uniformity.
  • The WordPoints_Post_Points_Hook::publish_hook() method is deprecated and is no longer hooked to 'transition_post_status'. The hook() method is hooked to it instead, for uniformity.
  • The 'extra_module_headers' filter is now 'extra_wordpoints_module_headers'.
  • A typo was fixed in the “wordpoints_component_deregiseter-{$slug}" action, changing it to “wordpoints_component_deregister-{$slug}" (extra “e” removed).

Components Un/Install #

Components are now expected to always be registered with the 'file' key specified. Its value must be the path to the components main file. Installation and uninstallation will be performed by a child of the WordPoints_Un_Installer_Base class, which should exist in a file specified by the value of the now required 'un_installer' key.  The installer file should not be included by the component, it will be automatically included where needed. At the end of the file should be a return 'My_Un_Installer'; statement, where My_Un_Installer is the name of your installer class defined in that file.

Miscellaneous #

  • The WordPoints_Points_Widget class is now declared as abstract, so you can not instantiate it directly. This shouldn’t affect anyone.
  • The functions in components/points/includes/points.php are no longer included when including the components/points/includes/functions.php file. This is only significant if you are including the latter file manually for some reason.
  • WordPoints_Points_Hook::set_options() now declares its only parameter, $options, to be an array. If you are attempting to pass anything else to it, it will fail.
  • WordPoints_Points_Hook::set_option(), which was added in 1.9.0, is now declared final. If you have a method with this same name in a points hook class, you need to refactor or you’ll get fatal errors.
  • wordpoints_alter_points() now returns the ID of the transaction (if it was logged) instead of boolean true on success. This could cause issues if you are using strict equality checks (===) on the return value of that function, or its wrappers: wordpoints_set_points(), wordpoints_add_points(), and wordpoints_subtract_points().