MyBB Community Forums

Full Version: PluginLibrary 13
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Windows can set files to read-only too, other than that, I don't know. You might want to get the exact return/debug value or add debug messages to PluginLibrary itself.
i have installed this plugin and there is default text showing on
Hello PluginLibrary!
This is a sample PluginLibrary Plugin (which can be disabled!) that displays this message on all pages.

...and this is the hellopl_example template.

How i can change it to mine?
The hello_pl plugin is a demo for developers only. For plugins that need PluginLibrary, you only need pluginlibrary.php in your plugins folder. Uninstall/delete the hello_pl.php.
When I try the use the cache funtion I get the following error:

Fatal error: Call to a member function cache_update() on a non-object
Fatal error: Call to a member function cache_read() on a non-object
Fatal error: Call to a member function cache_delete() on a non-object

This is my code:
function pugin_api_validation()
{
global $PL, $db, $mybb, $settings, $cache;

$somedata = "test";

$PL->update_cache('fg_cache_test', $somedata);
$cache = $PL->cache_read('fg_cache_test');
if($cache)
{
    echo $cache;
}
$PL->cache_delete('fg_cache_test');

When I try to use the MyBB built in function it works:
$cache->update('test', 'hi');
$value = $cache->read('test');
echo $value;
Then PluginLibrary is not loaded at the time of the function call.

https://github.com/frostschutz/MyBB-Plug...-on-demand
(2013-09-29, 06:59 PM)frostschutz Wrote: [ -> ]Then PluginLibrary is not loaded at the time of the function call.

https://github.com/frostschutz/MyBB-Plug...-on-demand

augh! What a silly mistake. Dodgy

Cheers!
help me i cant install plugin library. When i am clicking on install&activate it shows "selected plugin can't installed" help me pls
The message says everything: the plugin library doesn't need to be installed - just upload it and everything is fine.
Couldn't you make an addition to check if the user is logged in as well? Would be very useful.

function is_logged() {

        global $mybb;

        if(!$mybb->user['uid'])
                {
                        return false;
                } else {
                        return true;
                }

}
^ Well, it simply doesn't require an additional function. It wouldn't even really shorten the code:
if(is_logged())
{
   do_something();
} else {
   do_something_else();
}

// + is_logged() function, compared to

if($mybb->user['uid'])
{
   do_something();
} else {
   do_something_else();
}
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16