Allow users to add custom queries to Mustache variables
I don't know anything about Mustache, so just a note about the code: $_SERVER['BASE_DIR'] . '/customcontents/'. $username . '.php' is duplicated, it could be extracted out to a local variable:

$userFile = $_SERVER['BASE_DIR'] . '/customcontents/' . $username . '.php'
if (file_exists($userFile)) {
   include($userFile);
}


(You might have ideas for a better name.)

Reference: Chapter 6. Composing Methods, Introduce Explaining Variable in Refactoring: Improving the Design of Existing Code by Martin Fowler:


  Put the result of the expression, or parts of the expression, 
  in a temporary variable with a name that explains the purpose.


And Clean Code by Robert C. Martin, G19: Use Explanatory Variables.