Call to undefined function

The problem, as pointed out in the php error, is on line 7 of the “chat.php” file:

add_action( 'init', ic_show_chat_bar());

This line has two problems:

  1. The correct syntax for a valid callback function should be without the parenthesis and wrapped in single quotes.
  2. Since the function is declared inside a php class, it won’t be accesible to add_action unless we pass the class instance itself as an argument. Since the function is not static, we can use $this to pass the current instance.

Thus, the correct syntax in this case would be:

add_action( 'init', array( $this, 'ic_show_chat_bar' ) );

I recommend visiting the code reference for add_action() and also reading the user contributed notes at the bottom, where several examples of how to work with actions when using a class can be found.