MyBB Central

Full Version: Plugin Help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Why dosen't this showing anything when I call it with {number} on member_profile:
PHP Code:
<?php
if(!defined("IN_MYBB"))
{
    die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

$plugins->add_hook("member_profile""number");

function 
capito_test_info()
    {

    return array(
        
"name"        => "Test Plugin",
        
"description"        => "A sample plugin ...",
        
"website"        => "",
        
"author"        => "Capito",
        
"authorsite"        => "",
        
"version"        => "1.0",
        
"guid"             => "",
        
"compatibility"    => "*"
        
);
    }

function 
capito_test_activate() {
    global 
$db$mybb;
$query $db->simple_select("settinggroups""gid""name='general'");
    
$gid $db->fetch_field($query"gid");

    
$setting_1 = array(
        
"sid"            => "NULL",
        
"name"            => "numbercap",
        
"title"            => "enabledd",
        
"description"    => "Use it?",
        
"optionscode"    => "textarea",
        
"value"            => "This is my forum.",
        
"disporder"        => "21",
        
"gid"            => $gid,
    );

    
$db->insert_query("settings"$setting_1);




 
rebuild_settings();
}


function 
capito_test_deactivate() {
    global 
$db$mybb$templates;

$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name IN('numbercap')");

rebuild_settings();
}

function 
number() {

    
global 
$number$mybb;
$number "rand(0,10000) k? ";
return 
$number;
}



?>
Have you tried using something different? It may work.
That makes no sense what you just said.
(Apr 22, 2012, 11:58 AM)Capito Wrote: [ -> ]That makes no sense what you just said.

By something different, I mean a different line of code.
(Apr 22, 2012, 12:05 PM)GmZ Wrote: [ -> ]
(Apr 22, 2012, 11:58 AM)Capito Wrote: [ -> ]That makes no sense what you just said.

By something different, I mean a different line of code.

I have tried stuff like this (under the function number):
$global number;
$number = "Fish";
return $number;

And it still shows nothing.
(Apr 22, 2012, 12:18 PM)Capito Wrote: [ -> ]I have tried stuff like this (under the function number):
$global number;
$number = "Fish";
return $number;

And it still shows nothing.

If Fish is a username, try using the user ID instead.
(Apr 22, 2012, 12:43 PM)GmZ Wrote: [ -> ]
(Apr 22, 2012, 12:18 PM)Capito Wrote: [ -> ]I have tried stuff like this (under the function number):
$global number;
$number = "Fish";
return $number;

And it still shows nothing.

If Fish is a username, try using the user ID instead.
Im just trying to show text from a function.
So what ever $number is I can call it with {$number}
(Apr 22, 2012, 12:45 PM)Capito Wrote: [ -> ]Im just trying to show text from a function.
So what ever $number is I can call it with {$number}

Oh, I don't really know how to do that then. I'm sorry, I wish I could help.
(Apr 22, 2012, 12:50 PM)GmZ Wrote: [ -> ]
(Apr 22, 2012, 12:45 PM)Capito Wrote: [ -> ]Im just trying to show text from a function.
So what ever $number is I can call it with {$number}

Oh, I don't really know how to do that then. I'm sorry, I wish I could help.

If you find a example that does that I might be able to give you a dollar.
I am tired of this.

I got it working.