Discern a specific plugin’s action hooks
I’m new to WordPress plugin development (but not to coding) so please excuse the question.
I am trying to develop a plugin to catch user registrations and populate other web application databases from this (I have phpBB + Mantis Bug Tracker in my main domain alongside WordPress). It will populate the mysql databases form the wordpress registration/password change etc.
I am using “UsersWP” as my main user manager. It advertises that it has lots of hooks to offer extensibility. However, I can’t seem to discern how to leverage these hooks. Sadly, there’s no documentation with he plugin where they list the action hooks/filters.
I downloaded the sourcecode from here and did a search for action_do
There were a number of results, but most don’t get caught by my plugin code. I tried wp_login
(this is referneced in the UsersWP code) but this doesn’t return anything. However, the UsersWP specific action hook uwp_loaded
does get caught. My code:
<?php
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
// Log File ==========================================================
function write_log ($txt) {
$myfile = fopen("stigzler-log.txt", "a") or die("Unable to open file!");
fwrite($myfile, "n". date('h:i:s ', time()) . $txt);
fclose($myfile);
}
/* NULL RESULT: */
function ogz_SettingsSaved() {
write_log('Settings saved');
}
add_action('uwp_settings_save_','ogz_SettingsSave');
/* NULL RESULT: */
function ogz_wp_login( $user_login, $user ) {
write_log('wp_login: ' . $user_login);
}
add_action('wp_login', 'ogz_wp_login', 10, 2);
/* GETS RESULT: */
function ogz_uwp_loaded() {
write_log('uwp_loaded triggered');
}
add_action('uwp_loaded', 'ogz_uwp_loaded');
?>
Hopefully someone can give a me a steer towards how I achieve what I’m looking to achieve.
Leave an answer