Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 49 total)
  • Author
    Posts
  • in reply to: Show or Hide Fields Based On Role #38356
    MartinMartin
    Participant

    As others are interested in this functionality this is how I went about what I need in the end:

    I took the PHP code and implemented it in Snippets (or in functions.php etc). This allowed me to set the 'required' setting for each field as a variable. I then got the user role in code before the form creation happened and set the variable accordingly.

    in reply to: Field Values Not Saving (Sometimes) #36557
    MartinMartin
    Participant

    OK. Resolved it. Please ignore all the above. It turned out that another plugin had registered a role that was clashing with my client role (2 roles with the same name). It seems the admin user could see and edit the details regardless of the edited user roles but the user could only see the values and not update them. The clashing role is now gone and everything is working again.

    in reply to: Field Values Not Saving (Sometimes) #36551
    MartinMartin
    Participant

    I've made further tests and this is the result. All value updates made by the admin user through the form are working fine.

    All value changes made by a standard user are failing. I've even reduced the form to it's minimum level as below with only one remaining field which still fails to save.

    I wonder if there are settings against the user role which I need to check to ensure the values are saved to the database? I use Members from MemberPress for the sole reason of creating my custom users roles if there may be an issue there?

    add_filter( 'rwmb_meta_boxes', 'test_cip_pet' );
    
    function test_cip_pet( $meta_boxes ) {
        $prefix = '';
    
        $meta_boxes[] = [
            'title'   => __( 'TEST - Pet Details', 'your-text-domain' ),
            'id'      => 'test_pet_details',
            'type'    => 'user',
            'include' => [
                'relation'         => 'AND',
                'user_role'        => ['um_client', 'administrator'],
                'edited_user_role' => ['um_client'],
            ],
            'fields'  => [
                [
                    'id'     => $prefix . 'group_pet_details',
                    'type'   => 'group',
                    'fields' => [
                        [
                            'name'        => __( 'Specify details for each of your pets.', 'your-text-domain' ),
                            'id'          => $prefix . 'group_pet',
                            'type'        => 'group',
                            'collapsible' => true,
                            'group_title' => '{pet_name} - {pet_breed}',
                            'clone'       => true,
                            'max_clone'   => 20,
                            'add_button'  => __( 'Add another pet...', 'your-text-domain' ),
                            'fields'      => [
                                [
                                    'name'     => __( 'Pet\'s Name', 'your-text-domain' ),
                                    'id'       => $prefix . 'pet_name',
                                    'type'     => 'text',
                                    'required' => true,
                                ],
    			],				
                        ],
                    ],			
                ],
            ],
        ];
    
        return $meta_boxes;
    }
    in reply to: Field Values Not Saving (Sometimes) #36538
    MartinMartin
    Participant

    I've been trying some different scenarios and I've found that the behaviour isn't quite as described.

    It seems that when the form is opened up and edited by admin using shortcode [mb_user_profile_info id='cip_pet_details' user_id={{ GET.user_id }} label_submit="Save Pet Details" confirmation=""] with the user id being passed in the URL the form values will update fine.

    When I use the same shortcode (but without the user_id argument so it uses the currently logged in user) when logged in as a user it shows the saved values fine but none of the fields will update when changes are submitted.

    I have tested that all other circumstances are the same by using a duplicate of the admin page. To my thinking this means that the only difference now between the two is the logged in user role.

    in reply to: Field Values Not Saving (Sometimes) #36411
    MartinMartin
    Participant

    I've tried increasing but I already had it set pretty high. I was on 100000 before and bumped it up to 1000000 with no change in behaviour.

    in reply to: An error is occurring on one of my Field Groups #34311
    MartinMartin
    Participant

    I thought it would be strange for such a limit to exist. Is there any avenue I could look at to investigate it with the host company that you know of? It seems too coincidental that any field triggering a 3 digit array index isn't something to do with it yet I can't think why such a limit would exist anywhere.

    in reply to: An error is occurring on one of my Field Groups #34264
    MartinMartin
    Participant

    It looks like the php.ini works fine where it is and changing the value there is changing the reported value from phpinfo(). Changing it to 100000 had no effect.

    One thing I have noticed is that the field group structure is as follows:

    1 - Parent
    2 - Group
    3 - Fields & Groups

    I counted the number of objects at the #3 here and there are exactly 100 of these in the group at #2. When I reduce this to 99 objects it correctly saved the settings but reintroducing any field type to take the count back to 100 caused it to fail.

    Is there a limit on the number of fields (ie array index limited to 2 digits perhaps) that can exist in a group like this? If so, how do I extend the limit?

    in reply to: An error is occurring on one of my Field Groups #34237
    MartinMartin
    Participant

    Thanks Long.

    I already have max_input_vars set to 10000 which has always been enough before. This is set in php.ini in the root of public_html. I'm assuming this is the right place for it. The file only contains the max_input_vars setting.

    in reply to: Select Advanced field not showing as an Admin Column #31379
    MartinMartin
    Participant

    It looks like there was a bug somewhere in the field generation code. I tried a number of the other fields in the form and they were all fine as an admin column. I also tried changing the field type of the one that wasn't working and it still wouldn't appear. I then created a new field using the same ID (having changed the ID of the non-working one) using all the same settings and it worked fine. All I can conclude is that there was some error behind the scenes but it is working fine now so all good.

    in reply to: User Meta not being saved #31290
    MartinMartin
    Participant

    Are there specific capabilities that should be used to allow one user (with the Supervisor role) to be able to edit meta data against another user? As far as I can see I've set everything but may have missed something.

    in reply to: User Meta not being saved #31289
    MartinMartin
    Participant

    I've been using the role editor part of Members for this which I assume is doing the same thing.

    in reply to: Select Advanced field not showing as an Admin Column #31288
    MartinMartin
    Participant

    I see what the problem is - it's not generating the code from the builder for the field.

    My code is generated as:

                [
                    'name'    => __( 'Job Status', 'your-text-domain' ),
                    'id'      => $prefix . 'job_status',
                    'type'    => 'select_advanced',
                    'options' => [
                        'Active'          => __( 'Active', 'your-text-domain' ),
                        'Not Going Ahead' => __( 'Not Going Ahead', 'your-text-domain' ),
                        'Completed'       => __( 'Completed', 'your-text-domain' ),
                        'Cancelled'       => __( 'Cancelled', 'your-text-domain' ),
                    ],
                    'std'     => 'Active',
                ],
    

    It does, however, still save the settings against the field in the builder.

    in reply to: Custom Fields Order for Users #30778
    MartinMartin
    Participant

    In fact I just solved my immediate ordering issue. I simply changed the publish dates of the carious field groups and that changes the order they appear in. A bit of a 'hack' I suppose but it does what I want for now 😉

    in reply to: Custom Fields Order for Users #30777
    MartinMartin
    Participant

    OK. Thanks Long. It wasn't the individual fields so much as the order that each of the whole field groups appeared in but it sounds like there's no mechanism for it so I'll drop that line of thought and create a frontend view for admin purposes instead.

    in reply to: Custom Fields Order for Users #30762
    MartinMartin
    Participant

    Hi Long,

    So here's an example. In the User admin screen in the WP Dashboard you get the various WP generated fields appearing first. Then you get any connections created with MB Relationships. After this you get any Custom Field Groups created that are set to appear for Users - these appear in reverse order of when they were created by the looks of it.

    I'd like to be able to change these orders so that I can place the most commonly accessed Custom Field Groups at the top and have the less commonly accessed ones lower down.

    In Views there is an Order setting which handles the order priority. I was looking for something similar to this perhaps. Or if there's some code snippet I can pop in to choose the order if there's no priority in there. It seems that the order is set by creation date now which makes me think there's something behind the scenes somewhere that handles it.

Viewing 15 posts - 1 through 15 (of 49 total)