Controller with two functions

Hi there, i have a pretty beginner question:
i would like to combine a login function and a email-sending function in one controller, and when i do that, only one function works (the top one).
So, how can i have 2 function in one controller? they are combined or chained, but should be called seperately.

this here doesn’t seem to work:

return function ($kirby) {

  if ($kirby->user()) {



return function($kirby, $pages, $page) {

	if($kirby->request()->is('POST') && get('submit')) {



If you use multiple return statements only the first will ever be executed (at least in this scenario. So your conditions should be within one return function.

So both your if statements should be within the first return function. Check out the PHP docs for what return does for a better understanding:

hello @texnixe, i figured it out eventually. had to readjust a couple of brackets and now its working.
thanks a lot for your answer, as always…