New 2026 project, no custom code whatsoever.
CurrentUserID() is not working in Default Value for add function.
Template was regenerated, Composer was updated, I can generate projects but global functions are ignored.
New 2026 project, no custom code whatsoever.
CurrentUserID() is not working in Default Value for add function.
Template was regenerated, Composer was updated, I can generate projects but global functions are ignored.
Did you put all your code in Global Code? It won’t work because the app’s kernel is not booted yet.
You may post your code for discussion.
No, nothing in Global code.
Just CurrentDate() in Default Value for Add.
Did you see the current date in the Add page?
If yes, when did the error? Any error message? If yes, you may want to enable Debug during development and post the stack trace.
Debug enabled
Cannot find CurrentDate() in Global functions.
CurrentDate() is an older function and may be outdated for recent versions. If you check the source code, you’ll find:
/**
* Get current date in default date format
*
* @param int $namedformat Format = -1|5|6|7 (see comment for FormatDateTime)
* @return string
*/
function CurrentDate(int $namedformat = -1): string
If you don’t provide argument, it just return date('Y-m-d') which may not match your date format or locale setting. If you use Date/Time picker, it may not show because picker also use your date format or locale setting.
If you use the predefined datetime formats, you better provide an argument, e.g. if you use yMMdd, you can pass 5.
Alternatively, you may simply use date('your format') directly.
CurrentUserID() or CurrentUserInfo() doesn’t work either.
Did you use them as default values in the Add page too? If yes, has the user already logged in? If not, there is no current user info yet. Otherwise, you may provide more info about where you use them.
And here the error
public function __construct() { $this->userId = CurrentUserID(); }Attempted to call undefined function “CurrentUserInfo” from namespace "PHPMaker2026
Attempted to call undefined function “CurrentUserID” from namespace "PHPMaker2026
It is a namespace issue. v2026 uses CRUD by Doctrine ORM. When you add a record, it will create a new entity. The entities are under Entity namespace, e.g. PHPMaker2026\Demo\Entity, while the global function are under the project namesapce, e.g. PHPMaker2026\Demo.
If you use global function under the same namespace, e.g. most server events, you can ignore the namespace. But entities are under their own namespace.
You may try enter global function name with namespace, e.g. \PHPMaker2026\Demo\CurrentUserID().
Also all my functions I wrote in Global do not work meaning system does not recognize them.
Please note that PHP uses namespaces to separate and organize code logically. Assuming all classes or functions share the same namespace will lead to frequent errors and undefined references.
Your custom global functions are still recognized as before — what matters is where they are used. PHP programming follows a namespace system that should not be ignored.
It’s worth spending a bit of time learning how namespaces actually work, it’s a small effort that pays off big as your projects grow.
Try v2026.1.
Note: Global functions without namespace disallowed in entity constructor. You can still use global functions without namespace in Add page as always (and in most other pages because they are under the same namespace), but if you create a new entity (e.g. $entity = new Db\Entity\Foo;), there is no default value in the entity by global functions without namespace. To use global functions for default values in entities, namespace must be used.