[TikiWiki-commits] [Git][tikiwiki/tiki][master] [ENH] Display module preference errors in Modules Admin for immediate feature activation

"luci \(@luciash\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <692dc03e653a2_2a7120c8699db@gitlab-sidekiq-low-urgency-cpu-bound-v2-7879b95b78-brrzz.mail>

luci pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
f2965917 by Espoir Baraka at 2025-12-01T16:11:57+00:00
[ENH] Display module preference errors in Modules Admin for immediate feature activation
---
* [ENH] Modlib: Add clickable links to missing preferences in module error messages

See merge request tikiwiki/tiki!8855

- - - - -


4 changed files:

- lib/core/Tiki/Smarty/SmartyTiki.php
- lib/modules/modlib.php
- templates/footer.tpl
- tiki-modules.php


Changes:

=====================================
lib/core/Tiki/Smarty/SmartyTiki.php
=====================================
@@ -526,6 +526,11 @@ class SmartyTiki extends Smarty
 
         if (! defined('TIKI_IN_INSTALLER') && ! defined('TIKI_IN_TEST')) {
             require_once 'tiki-modules.php';
+            // Re-assign module_pref_errors after modules are loaded to capture errors from lazy rendering
+            if (Perms::get()->admin) {
+                $modlib = TikiLib::lib('mod');
+                $this->assign('module_pref_errors', $modlib->pref_errors);
+            }
         }
         $this->assign('TIKI_IN_INSTALLER', defined('TIKI_IN_INSTALLER'));
     }


=====================================
lib/modules/modlib.php
=====================================
@@ -1123,8 +1123,11 @@ class ModLib extends TikiLib
             $info = $this->get_module_info($mod_reference);
             $cachefile = $this->get_cache_file($mod_reference, $info);
 
+            $prefslib = TikiLib::lib('prefs');
+
             foreach ((array) $info['prefs'] as $preference) {
                 if ($prefs[$preference] != 'y') {
+                    $this->add_pref_error($mod_reference['name'], $preference);
                     return smarty_block_remarksbox(
                         [
                             'type' => 'warning',


=====================================
templates/footer.tpl
=====================================
@@ -19,13 +19,17 @@
         </div>
     </div>
 {/foreach}
-   
+
 {if $prefs.feature_inline_comments eq 'y' && $tiki_p_post_comments eq 'y'}
     <a id="note-editor-comment" class="alert alert-info" style="display:none;" href="#" role="button">{tr}Add Comment{/tr}</a>
 {/if}
 {if isset($force_fill_action)}
     {include file="tiki-tracker_force_fill.tpl"}
 {/if}
+
+{if Perms::get()->admin and isset($modlib)}
+    {assign var=module_pref_errors value=$modlib->pref_errors}
+{/if}
 {if $module_pref_errors|default:null}
     <div class="container{if isset($smarty.session.fullscreen) && $smarty.session.fullscreen eq 'y'}-fluid{/if} modules">
         {remarksbox type="warning" title="{tr}Module errors{/tr}"}


=====================================
tiki-modules.php
=====================================
@@ -24,6 +24,7 @@ global $prefs, $user;
 
 clearstatcache();
 $modules = $modlib->get_modules_for_user($user);
+$smarty->assign('modlib', $modlib);
 
 if (Perms::get()->admin) {
     $smarty->assign('module_pref_errors', $modlib->pref_errors);



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/f2965917c2888ae7a4a0c673cda9b206c19940ae

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/f2965917c2888ae7a4a0c673cda9b206c19940ae
You're receiving this email because of your account on gitlab.com.

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.