Problem With New Users
-
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
https://www.ads-software.com/extend/plugins/user-meta-manager/
-
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?
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 : https://www.screencast.com/t/zFi62CxnJwXe
Liz
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.
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!
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.
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 –
- In User Meta Manager settings I set the option Retain Saved Data On Uninstall: to No
- Deactivated and deleted the old version.
- Installed the new version
- Created a new custom meta key with a blank default value.
- Added the test key to the Home table Columns.
- Added a new test user via the User > Add New dialogue.
- 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?
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.
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. ??
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.
All that key info you just described makes perfect sense. We’re doing the data manipulations now.
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!
Wait, I did that wrong.
Replaceif($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'):
Hi Liz, Did we resolve this issue?
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 …
<?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.
- The topic ‘Problem With New Users’ is closed to new replies.