By comparison I have another WooCommerce site with 120 users and the usermeta table size is 420kb with 4039 rows.
I have tried using LiteSpeed Cache database tools to clean up the database (delete trainsients, optimise tables etc). I also used Advanced Database Cleaner. Neither of these plugins flag anything up about the usermeta table.
To me it seems like something huge is being stored in the usermeta table for it to be at 1.2gb. I’m not sure how I can find out what is using all that space! Any help/suggestions gratefully accepted!
It seems I need to change form_id for all users in wp_usermeta table. The form_id value needs to be updated in two places for each user:
1. in the ‘form_id’ field
2. inside the serialized array in the ‘submitted’ field
This can be done programmatically by using update_user_meta() – function.
Something along these lines:
$user_id = $some_user_id;
$toupdate= array(
'form_id' => $some_form_id,
'submitted' => ????
);
foreach( $toupdate as $k => $new_val ){
update_user_meta($user_id, $k, $new_val );
}
I can’t figure out how to target ‘form_id’ inside the serialized submitted array.
Any help here is very appreciated.
Regards
]]>I found an issue with this plugin version 5.13.0.
My debug.log show an error when trying to use the usermeta-table: $wpdb->prefix . ‘usermeta’. It should be $wpdb->usermeta.
I created a costum page that, given the link of a csv file uploaded to the media, updates me a meta data of the users. I used jquery (ajax) and php.
I thought of inserting the ajax post call within the loop of the csv lines to progressively update the metadata per user. I do not think it is the correct way to proceed, however, because the console gives me error 502 and 429. What am I doing wrong?
Previously I had managed the loading of the csv and the update of the users only through php but with a large number of users it becomes a very heavy operation and gives me a 502 error. I was looking for a less cumbersome solution
Jquery
Query(document).ready(function( $ ){
$( "#test-click" ).click(function() {
$.ajax({
type: "GET",
url: 'FILE-CSV.csv',
dataType: "text",
success: function(data) {processData(data);}
});
function processData(allText) {
var allTextLines = allText.split(/\r\n|\n/);
var headers = allTextLines[0].split(';');
//var lines = [];
for (var i=1; i<allTextLines.length; i++) {
var data = allTextLines[i].split(';');
if (data.length == headers.length) {
var tarr = [];
for (var j=0; j<headers.length; j++) {
//tarr.push(headers[j]+":"+data[j]);
tarr[headers[j]] = data[j];
//console.log(tarr['n']);
$.ajax({
url:"/wp-json/bluenext/updatelesson",
method: "POST",
//data: post_id,
data: {id : tarr['id'], id_lezione : tarr['id_lezione']},
success: function(response){
console.log(response);
}
})
}
//lines.push(tarr);
}
}
//console.log(lines);
}
});
});
PHP
function updatelesson(){
$user_id = json_decode($_POST['id']);
$idlesson = json_decode($_POST['id_lezione']);
llms_mark_complete( $user_id, $idlesson, 'lesson');
return $user_id;
}
]]>sudo wp wc customer update 141 --meta_data="[{"key":"test_meta1","value":"test_meta_value"}]" --user=1
However, this does not work.
The result I get is
Success: Updated customer 141.
However,
sudo wp wc customer get 141 --fields=meta_data --user=1 | grep test_meta
returns blank.
curl -X PUT https://www.example.com/wp-json/wc/v3/customers/141 \ -u consumer_key:consumer_secret \ -H "Content-Type: application/json" \ -d '{"meta_data": [{"key": "test_meta1","value": "test_meta_value"}]}'
would work, but I’d prefer to use the wp wc CLI if possible, rather than the REST API.
I’ve also tried adding meta_data to products, with similar challenges – eg
sudo wp wc product create --name="test2" --sku="test2" --regular_price=10 --meta_data="[{"meta_data": [{"key": "test_meta1","value": "test_meta_value"}]}]" --user=1
What’s the right format for supplying meta_data on the wp wc CLI command line interface? I get it needs to be an array… but what format does that actually mean? Can anyone product a working example?
]]>I’ve recently noticed that our wp_usermeta table is filled with entries of the following form:
‘{“umeta_id”:”264186″,”user_id”:”1229″,”meta_key”:”ecs_instalation”,”meta_value”:”1645654611″}’
Specifically, some of our users have HUNDREDS of “ecs_instalation” keys with slightly different meta_values. And I’m not 100% certain, but this may be at the root of a site-breaking issue some of our users are experiencing with PHP 8.0. Recently we upgraded our site to use PHP 8.0, and the layout was completely broken for a subset of our users. It seems that these are the same users that have all of the “ecs_instalation” meta keys.
Any idea what could be causing all of these keys to be added to the meta table, and how that might break the site when it’s on PHP 8.0?
]]>I’m hoping to get some insight on an odd issue that *may* be contributing to a site-breaking bug for some of our users.
The context is that after upgrading to PHP 8.0, a subset of our users began experiencing a totally broken version of our site (layout completely destroyed on front-end, Page Source missing thousands of lines of HTML, including the closing </body> tag, etc.). We’ve downgraded to 7.4, which has temporarily fixed the issue, but I’m still trying to get to the root cause.
And I don’t know if this is it, but I’ve noticed that for all of our users experiencing this issue, the wp_usermeta table is cluttered with hundreds of iterations of the entries like the following:
{"umeta_id":"264186","user_id":"1229","meta_key":"ecs_instalation","meta_value":"1645654611"}
That is, user 1229, one of our affected users, has hundreds of lines like this in the User Meta table, with slightly different umeta_id and meta_value values.
I did a Google search for meta_key “ecs_instalation” (and yes, there’s only one L in the actual table), but nothing came up.
Any ideas? Even if this isn’t the cause of the site-breaking PHP issue, I’d like to know what’s spamming our usermeta table and why.
Thanks!
Tashi
https://www.cozmoslabs.com/docs/profile-builder-2/developers-knowledge-base/shortcodes/display-user-meta/
How do I fix the Issue
]]>