generic_cpt_actions ); } /** * Filters the event name which is currently being processed. * * Returning a value different from $event_name will make Achievements think that * it was the action that was originally triggered. * * @param string $event_name Action name * @param array $func_args Optional; action's arguments, from func_get_args(). * @return string|bool Action name or false to skip any further processing * @since Achievements (3.0) */ abstract function event_name( $event_name, $func_args ); /** * For actions that are in WordPress core and handle post types, update the * user ID from the logged in user to the post author's ID (e.g. for draft * posts which are then published by another user). * * In your implementation you must check that $event_name matches the name of the * action that your plugin implements. * * This method assumes that $func_args[0] is the Post object. * * @param int $user_id Logged in user's ID * @param string $event_name Name of the event * @param array $func_args Arguments that were passed to the action * @return int New user ID * @since Achievements (3.0) */ public function get_post_author( $user_id, $event_name, $func_args ) { $post = $func_args[0]; if ( ! empty( $post->post_author ) ) return absint( $post->post_author ); else return $user_id; } }