MyBB Community Forums

Full Version: Include language file for UCP (Checkbox).
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'll try to describe my problem because it's the first time I've faced the problem but I can't find a solution.

The language variable ./inc/languages/language/admin/config_pluginname.lang.php is integrated into a plugin for the ACP. In the plugin's functions sections, $lang->load('config_pluginname'); used which also works correctly in the ACP.

How do I have to define the plugin (hook?) so that the language file for an additional checkbox is loaded correctly for the UCP?

The information:
functions pluginname_usercp()
{
global $mybb, $lang;
$lang->load('pluginname');
}
does not produce success. Maybe the appropriate hook is required at the top of the plugin? What should the hook be?
Should language variables for the UCP ./inc/languages/language/pluginname.lang.php be loaded/used?

If I rename ./inc/languages/language/pluginname.lang.php to ./inc/languages/language/config_pluginname.lang.php, it works correctly.
The language files config_ should actually only be available in the ACP.

Currently the UCP always requests ./inc/languages/language/config_pluginname.lang.php (The path is correct, but the file name is not.

OK, I could rename the language file request in the plugin and the language files = without "config_" but that wouldn't be helpful.

It would be nice if someone would shed some light on my still obscure knowledge of plugins. The URL: https://docs.mybb.com/1.8/development/plugins/hooks/ is known, but no matter what I use from it, the language variable from pluginname.lang.php is not displayed.

Where did I not take something into account? Where is my mistake? 

Thanks in advance for any help.

I can't believe it, but it works now.
What have I done? I just have all the hooks except:
$plugins->add_hook("usercp_options_end", "snowfall_usercp");
$plugins->add_hook("usercp_do_options_end", "snowfall_usercp");

removed and hey presto, the previous error message was gone and the language variable was displayed correctly in the UCP from the language file ./inc/languages/language/luginname.php. It seems that sometimes less (here: hooks) is ultimately more.
The ACP also continues to work without error messages.