[英]How to call an action from another plugin after another action from a different plugin gets called
我有兩個插件: plugin_A和plugin_B 。 在plugin_A/actions/plugin_A/
有一個動作a_action.php 。 在plugin_B/actions/plugin_B/
有一個動作b_action.php 。
plugin_A / start.php
elgg_register_action("a_action", __DIR__ . "/actions/plugin_A/a_action.php");
plugin_B / start.php
elgg_register_action("b_action", __DIR__ . "/actions/plugin_B/b_action.php");
我想之后的任何時間a_action被稱為被稱為b_action。
我該怎么辦。
謝謝大家。
為此,您只需在a_action.php的末尾調用elgg函數,該函數稱為action
action('b_action');
我選擇了插件掛鈎:
elgg_register_plugin_hook_handler("action", "a_action", "pay_action_hook");
function pay_action_hook($hook, $entity_type, $returnvalue, $params) {
if (/* My stuff works OK */) {
return true;
}
register_error(elgg_echo('My stuff work out failed'));
return false;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.