wpDiscuz 7 API Documentation

⌘K
  1. Home
  2. Docs
  3. wpDiscuz 7 API Documentat...
  4. Filters
  5. wpdiscuz_custom_ajax_allowed_actions

wpdiscuz_custom_ajax_allowed_actions

This filter can be used to register additional actions with the wpDiscuz custom AJAX handler.

Parameters

  1. $allowedActions (type: array) – action definitions keyed by action name. Each definition is an array with an “object” instance, a “callback” method name, and a “for” key accepting “user”, “guest” or “all”

Usage

add_filter("wpdiscuz_custom_ajax_allowed_actions", "my_custom_ajax_actions");

function my_custom_ajax_actions($allowedActions) {
    $allowedActions["myPluginAction"] = [
        "object"   => MyPlugin::getInstance(),
        "callback" => "myActionHandler",
        "for"      => "all",
    ];

    return $allowedActions;
}

Note

The vote action is no longer always present. From 7.6.67 wpdVoteOnComment is added to the array only when the Show Voting Buttons setting is enabled. A callback that wraps, reorders or unsets that key must tolerate its absence.

Adding wpdVoteOnComment back while voting is disabled is a deliberate override that reopens the vote endpoint on this transport. It does not restore the voting controls or register the native WordPress AJAX action.

Changelog

Since 7.6.33 version
Starting from the 7.6.67 version wpdVoteOnComment is present only when voting is enabled