copy code from kunena 2 plugin for development of kunena 3

Signed-off-by: TomWu <phperwuhan@gmail.com>