jrUser_is_power_user in forms

SteveX
SteveX
@ultrajam
12 years ago
2,589 posts
I'm not sure if this is a problem, but after trying to use it in a similar form I found that jrUser_is_power_user() did not prevent the form from being shown to non-power users. Adding "'group' => 'power'," worked for me, but jrUser_is_power_user() didn't, I guess because the field is saved to the form table.

This is similar code from jrProfile/index.php:
    if (jrUser_is_power_user()) {

        // Profile Quota (power users only)
        $_tmp = array(
            'name'          => 'profile_quota_id',
            'label'         => 'profile quota',
            'help'          => 'What Quota should this profile be part of?',
            'type'          => 'select',
            'options'       => 'jrProfile_get_settings_quotas',
            'value'         => $_profile['profile_quota_id'],
            'required'      => true,
            'group'         => 'power',
            'validate'      => 'number_nz',
            'form_designer' => false // We do not allow the form designer to override this field
        );
        jrCore_form_field_create($_tmp);
    }



--
¯\_(ツ)_/¯ 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: 01/03/14 01:28:03AM
brian
@brian
12 years ago
10,149 posts
The "form_designer => false" was not on that form initially (pre 5.1), so it could have been saved as a "designer" field, which is why it would be shown now if the group was not set.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
SteveX
SteveX
@ultrajam
12 years ago
2,589 posts
I had an empty form table. But it's working now with group so I'm happy. I'll post here if I see the problem I was having again.

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 :)
brian
@brian
12 years ago
10,149 posts
This:

'form_designer' => false

will prevent that field being saved to the form table, so that should make that field be "dynamic" on every view.

Let me know if you see any issues with it.

Thanks!


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

Tags