Registering account_tab with jrUser

SteveX
SteveX
@ultrajam
11 years ago
2,584 posts
The quota check doesn't seem to run on Lifestreams when registering an account_tab with jrUser. The lifestreams account tab appears even when the module is disabled for the quota.


Its based on the foxycart init function, this is from foxycart:
    // Setup our Subscription Browser
    $_tmp = array(
        'label' => 34,
        'quota_check' => false
    );
    jrCore_register_module_feature('jrUser', 'account_tab', 'jrFoxyCart', 'subscription_browser', $_tmp);

This is from my module function:
    // Setup the stream settings tab
    $_tmp = array(
        'label' => 1,
        'quota_check' => true
    );
    jrCore_register_module_feature('jrUser', 'account_tab', 'ujLifeStreams', 'stream_settings', $_tmp);

Is there anything I am missing to get that tab working as expected?
Thanks


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)

updated by @ultrajam: 05/04/14 11:22:32PM
brian
@brian
11 years ago
10,149 posts
That should do it - you don't need to run an integrity check, as the jrUser_account_tabs function pulls in the registered modules on each call.

The 'quota_settings' defaults to true, so you don't actually need that. Have you registered your module for core quota support?

Hope this helps!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
SteveX
SteveX
@ultrajam
11 years ago
2,584 posts
Yes it is registered.

Looking at jrUser_account_tabs function it doesnt look like the tab is being unset if the quota is not allowed.

                // $label can come in as an array
                if (is_array($label)) {
                    $_tbs["{$mod}/{$view}"] = array(
                        'label' => (isset($_lng[$mod]["{$label['label']}"])) ? $_lng[$mod]["{$label['label']}"] : $label['label'],
                        'url'   => "{$_conf['jrCore_base_url']}/{$url}/{$view}"
                    );
                    if (!isset($label['quota_check']) || $label['quota_check'] === true) {

                        // Check for specific field access
                        $fld = "quota_{$mod}_allowed";
                        if (isset($label['field']) && strlen($label['field']) > 0) {
                            $fld = $label['field'];
                        }

                        if (isset($_user[$fld]) && $_user[$fld] != 'on') {
// added this at line 741
unset($_tbs["{$mod}/{$view}"]);
                            continue;
                        }
                    }
                }

// added this at line 741
unset($_tbs["{$mod}/{$view}"]);

With that unset added in it seems to work properly.


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)

updated by @ultrajam: 04/04/14 02:14:23PM
brian
@brian
11 years ago
10,149 posts
Good catch Steve - fixing that now.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net

Tags