Whilst small files can be uploaded to forum posts, if you have a custom theme or module to contribute please add it on the "Add-ons" page.

TOPIC: [SOLVED] Example module code

Example module code 1 month 1 day ago #1

  • vytux
  • vytux's Avatar
  • Offline
  • Senior
  • Posts: 456
I am fairly sure that this code is just there to show what can be done and is not actually required for a custom module for any reason. As it seems to break my module unless a super admin is using it....

    /**
     *  Boostrap.
     *
     * @param UserInterface $user A user (or visitor) object.
     * @param Tree|null     $tree Note that $tree can be null (if all trees are private).
     */
    public function boot(UserInterface $user, ?Tree $tree): void
    {
        // The boot() function is called after the framework has been booted.
        // We can now use the current user, tree, etc.
        if (!Auth::isAdmin($user) && $tree !== null) {
            return;
        }

Am I correct with this assumption?
Vytautas

webtrees 1.7.9 (MODS: vytux_cousins, vytux_gallery3, vytux_pages, fancy_imagebar, fancy_treeview, Ancestral fan chart)
PHP 7.1.2, MySQL 5.7.17 x86_64 GPL, Nginx (mainline)
ged.vytux.com
Help translate Vytux Modules at translate.vytux.com/
The administrator has disabled public write access.

Example module code 1 month 1 day ago #2

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Posts: 10908
> I am fairly sure that this code is just there to show what can be done and is not actually required for a custom module for any reason.

Correct.
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net
The administrator has disabled public write access.

[SOLVED] Example module code 4 weeks 2 days ago #3

  • vytux
  • vytux's Avatar
  • Offline
  • Senior
  • Posts: 456
Problem solved.
Vytautas

webtrees 1.7.9 (MODS: vytux_cousins, vytux_gallery3, vytux_pages, fancy_imagebar, fancy_treeview, Ancestral fan chart)
PHP 7.1.2, MySQL 5.7.17 x86_64 GPL, Nginx (mainline)
ged.vytux.com
Help translate Vytux Modules at translate.vytux.com/
The administrator has disabled public write access.
Powered by Kunena Forum