plugin-update-checker
plugin-update-checker copied to clipboard
Cannot hooks from function
Hi, i have a problem when i want to put the updater separately from the main index plugin. I put the updater on files activation.php in function update_pinterin and then on main index plugin i called do_action function for calling the update_pinterin but it seems not working and the updater was not showing when i activated the plugin.
This is the main index code :
/*
Plugin Name: Pinterin
Plugin URI: https://semanthic.com/
Description: Plugin for automatic
Version: 1.4.5
Author: SEMANTHIC
Author URI: https://semanthic.com
License: SEMANTHIC LTD.
*/
function pinterin()
{
include_once plugin_dir_path(__FILE__) . '/vendor/autoload.php';
include_once plugin_dir_path(__FILE__) . '/vendor/updater-plugin/plugin-update-checker.php';
include_once plugin_dir_path(__FILE__) . '/activation.php';
do_action('update_pinterin');
}
add_action('plugins_loaded', 'pinterin');
// register_activation_hook(__FILE__, 'pinterin');
This is the files for activation.php
function update_pinterin()
{
$myUpdateChecker = Puc_v4_Factory::buildUpdateChecker(
'https://gitlab.com/masiting/plugins,
__FILE__,
'pinterin'
);
$myUpdateChecker->setAuthentication('Dasdas');
$myUpdateChecker->setBranch('plugin');
}
Please help, thanks.
(I've edited your post to add syntax highlighting to the code blocks.)
Assuming that this is the whole code, it looks like it's missing something: you need to hook the update_pinterin function to the custom update_pinterin action. Like this:
add_action('update_pinterin', 'update_pinterin');