WordPress.org

Ready to get started?Download WordPress

Forums

User Meta Manager
[resolved] Problem With New Users (17 posts)

  1. diywebmastery
    Member
    Posted 1 year ago #

    When I add a new user, the meta fields are not added to their profile. So if I try to update a field it says it does not exist, and if I try to add it, it says it already exists.

    I pressed the button to synch but that made no difference.

    Am using 2.2.1

    http://wordpress.org/extend/plugins/user-meta-manager/

  2. President McCheese
    Member
    Plugin Author

    Posted 1 year ago #

    Hi again. :)

    So, just so I'm clear on this -

    1) You add a new member via Dashboard > Users > Add New
    2) You go to Dashboard > Edit Users > {the new user}

    - and your custom meta profile fields are not there for the new user? Or, is this not what you mean?

    Did you select a "Field Type" for each Custom Meta field you created?

  3. diywebmastery
    Member
    Posted 1 year ago #

    Hi Jason

    Thanks for coming back to me.

    In wp_usermeta there is a record for each custom meta key for each user, including the new users. But the meta_value is blank for each. The user meta manager editor does not allow me to edit the blank values and it does not allow me to add them either.

    So what I have had to do is go into the database manually, change the meta_value from blank to xxxxxx, and when I refresh the editor I am able to edit the xxxxxx away with the value I actually want.

    I was on the latest version of the plugin up until today, but I reverted to the last version that worked consistently for me (which I am still on : 2.0.9) and the problem remained.

    Here is a quick video to show you : http://www.screencast.com/t/zFi62CxnJwXe

    Liz

  4. President McCheese
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks for the detailed explanation and video!

    The plugin's data structure changes between versions. Upgrading and downgrading probably will not return favorable results. The data from the newer version should be deleted before an older version is installed, or the saved data can become corrupted.

    Your custom meta keys may have been deleted from the plugin's saved data, or the data structure doesn't match the current version.

    I haven't been able to reproduce this issue yet. However, I will keep looking.

  5. diywebmastery
    Member
    Posted 1 year ago #

    Yes - I realise that (we are also plugin developers) - but given that the problem arose before I went back to the older version, I figured I didn't have anything to lose!

  6. diywebmastery
    Member
    Posted 1 year ago #

    We can probably help with the fix? We can look at the code of the latest version and try to see what could be happening? One way would be to change the code to include allowing it to recognise and therefore edit blank values.

  7. President McCheese
    Member
    Plugin Author

    Posted 1 year ago #

    Yes - I realise that (we are also plugin developers)

    I didn't intend to insult your intelligence. :)

    You will probably need to start from fresh because your saved data is corrupted somehow.

    I reached this conclusion because on a clean install, I could not reproduce this bug.

    Here were my steps -

    1. In User Meta Manager settings I set the option Retain Saved Data On Uninstall: to No
    2. Deactivated and deleted the old version.
    3. Installed the new version
    4. Created a new custom meta key with a blank default value.
    5. Added the test key to the Home table Columns.
    6. Added a new test user via the User > Add New dialogue.
    7. Returned to User Meta Manager to edit the test key for the test user, using the table actions.

    The test worked without a glitch. The test meta key which had a blank default value was visible and editable in all screens. So, the plugin does recognized blank values.

    Have you tested this on a clean install on a different website?

  8. President McCheese
    Member
    Plugin Author

    Posted 1 year ago #

    If your data IS indeed corrupted, and you are unable to start from fresh, I can write a script to help you recover, if you want.

  9. President McCheese
    Member
    Plugin Author

    Posted 1 year ago #

    I think what may have happened is, during an upgrade or downgrade, your custom keys were deleted from the plugin's saved options. The custom meta keys still exist in the database, but do not exist in User Meta Manager's saved data. So, when you attempt to recreate the key, it fails because the key DOES already exist in the database. And, when you attempt to edit the key, it fails because the key is no longer in the plugin's saved data.

    The custom key exists in one area but not the other. It must exist in both database AND User Meta Manager saved data. The data is out of sync.

    So what we need to do is copy the existing custom keys over to the new data structure, or delete the existing custom keys from the database and start fresh.

    I hope that makes sense. :)

  10. diywebmastery
    Member
    Posted 1 year ago #

    Jason - sorry I did not for a moment think you were insulting my intelligence. Not sure how much of that I have at 3:30am when I last wrote to you anyway!

    I will do as you suggest. The corruption could have occurred when I went back to an older version about a month ago after an upgrade that didn't work. I was aware it might cause an issue but with so few records I was willing to do it.

    You fixed the problem at the time and I was able to re-upgrade. Then I didn't get a new user into my membership site until now, and have only just discovered the problem. That might explain it.

    I'll do that today and let you know how it goes.

  11. diywebmastery
    Member
    Posted 1 year ago #

    All that key info you just described makes perfect sense. We're doing the data manipulations now.

  12. President McCheese
    Member
    Plugin Author

    Posted 1 year ago #

    Actually, I have a solution that might work easily.

    Open wp-content/plugins/user-meta-manager/user-meta-manager.php

    Find on line 1390
    if($meta_key_exists && $_POST['mode'] == 'add'):

    Replace with

    //if($meta_key_exists && $_POST['mode'] == 'add'):
    if($_POST['mode'] == 'add'):

    Save.

    Then go add the missing custom meta keys.
    That SHOULD override the check which stops the process if the meta key already exists.

    Backup your data first though!

  13. President McCheese
    Member
    Plugin Author

    Posted 1 year ago #

    Wait, I did that wrong.
    Replace

    if($meta_key_exists && $_POST['mode'] == 'add'):
               // Key already exists
               $output = '<span class="umm-error-message">' . __('Error: Meta key already existed. Choose a different name.', UMM_SLUG) . '</span>';
            else: // Key doesn't exist

    With
    if($_POST['mode'] == 'add'):

  14. President McCheese
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Liz, Did we resolve this issue?

  15. diywebmastery
    Member
    Posted 1 year ago #

    No Jason. I want to get some time to re-visit this today. I could not see how to uninstall the plugin so as to wipe all data clean. Some was left behind and we couldn't find it. I wanted to do a clean install ...

  16. President McCheese
    Member
    Plugin Author

    Posted 1 year ago #

    <?php
    
    require('wp-load.php');
    
    $delete_meta_keys = array('key1', 'key2'); // Array of meta keys to delete
    
    global $wpdb, $user_ID, $table_prefix;
    
    if ('' == $user_ID){
       wp_die("Login first!");
    }
    
    foreach($delete_meta_keys as $meta_key){
        $query = "SELECT * FROM ".$wpdb->users;
        $data = $wpdb->get_results($query);
        foreach($data as $user){
            delete_user_meta($user->ID, $meta_key);
        }
    }
    delete_option('umm_singles_data');
    delete_option('user_meta_manager_data');
    delete_option('umm_users_columns');
    delete_option('umm_usermeta_columns');
    delete_option('umm_backup_date');
    delete_option('umm_backup_files');
    delete_option('umm_profile_fields');
    delete_option('umm_settings');
    delete_option('umm_sort_order');
    $wpdb->query("DROP TABLE IF EXISTS " . $table_prefix . "umm_usermeta_backup");
    
    print('Action completed.');
    
    ?>

    Edit the $delete_meta_keys variable to suit your needs and run the script from the root WP directory. That will remove any meta keys you listed in the $delete_meta_keys variable, and any data associated with User Meta Manager.

  17. President McCheese
    Member
    Plugin Author

    Posted 1 year ago #

    For future reference, User Meta Manager settings are located in the plugin's contextual help screen.

    Click the tab in the upper-right corner - "User Meta Manager Help & Settings". Then, Plugin Settings > Retain Saved Data On Uninstall > No.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.