MyBB Community Forums

Full Version: $Mybb Variable List
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
(2015-03-03, 10:53 PM)Crazycat Wrote: [ -> ]Good thread idea, I suggest to add it in the official doc

Its not neccessary, I do have a plugin that displays some of this info for me on activation though:

<?php

if (!defined("IN_MYBB")) {
    die( "Access inside MyBB" );
}

$plugins->add_hook( "admin_config_plugin_begin", "show_globals_header_info" );

function show_globals_info() {
    return array(
        'name' => 'Show Global Information',
        'description' => 'Lists some global variable information.',
        'version' => '1.0',
        'compatibility' => '16*, 18*'
    );
}

function show_globals_activate() {
}

function show_globals_deactivate() {
}

function show_globals_header_info() {
    /* This info is shown at the top of the plugin
     * page in the admincp.
     * You can adjust this function for your needs,
     * but try not displaying too much as it is
     * a pain to scroll through.
     */
    global $mybb;
    echo '<span style="white-space: pre;">';
    echo '$mybb->user: ';
    print_r( $mybb->user );
    echo '$mybb->usergroup: ';
    print_r( $mybb->usergroup );
    echo '$mybb->settings: ';
    print_r( $mybb->settings );
    echo '</span>';
}

?>
(2015-03-03, 11:19 PM)Ircher Wrote: [ -> ]Its not neccessary, I do have a plugin that displays some of this info for me on activation though:

Good idea, but imho, you'd better add a subsection in "Tools & Maintenance", under the "View PHP Info" entry.
what's the variable that gets the number of posts made on the last 24 hours?
(2016-03-01, 08:06 PM)Blackbeard Wrote: [ -> ]what's the variable that gets the number of posts made on the last 24 hours?

The same as the variable that gets number of users that rode monocycle last year. Non-existent until you define it. You'd need to look for a plugin that has it if you can't code it manually, basically a query for the count of posts older than TIME_NOW-24*3600 is required.
(2016-03-02, 11:39 PM)Destroy666 Wrote: [ -> ]
(2016-03-01, 08:06 PM)Blackbeard Wrote: [ -> ]what's the variable that gets the number of posts made on the last 24 hours?

The same as the variable that gets number of users that rode monocycle last year. Non-existent until you define it. You'd need to look for a plugin that has it if you can't code it manually, basically a query for the count of posts older than TIME_NOW-24*3600 is required.

I didn't knew that there isn't one at that time. I figured it out already, thanks anyway @Destroy666.
Is there a way to generate a random number whenever a template is called? like, I have this announcement template which is called depending on the amount of announcements it has, for instance, if it has 3 announcements, the template is called 3 times, and thus the code is repeated within that block. so I want a way to generate an unique number for that one instance, for instance if the template is called in the first time one number for the whole round, but in the next round the number is different. so Is there a variable in mybb to do what I want? Thanks.
Not really sure what you mean by "a variable in mybb" - there wouldn't be a pre-defined variable for this specific use-case, no, but if this is a plugin, you can define whatever variables you want.
(2017-02-16, 01:07 PM)Matt Wrote: [ -> ]Not really sure what you mean by "a variable in mybb" - there wouldn't be a pre-defined variable for this specific use-case, no, but if this is a plugin, you can define whatever variables you want.

Thanks for the reply, I solved it with jquery, and js cookie.
https://github.com/js-cookie/js-cookie
is there a way to fix regdate
(2017-07-12, 08:21 AM)ketamine Wrote: [ -> ]is there a way to fix regdate

Why ask that in this thread? What does fixing the regdate even mean? It's a date, how is it broken?
Pages: 1 2 3