Inline Edit of usermata-values in Wordpress-Plugin

Inline Edit of usermata-values in Wordpress-Plugin

Wolfgang_MertzWolfgang_Mertz Posts: 1Questions: 1Answers: 0
edited July 2022 in Free community support

Loading of the data runs very well

but not the server-side updating of the data

Request after submitting

data[1086][um_vorname][meta_value] "Celine"

action "edit"

1086 is the pc_users.ID or user_id in pc_usermeta and the PXUID of the view.

Below is my Editor, which is created dynamically, depending on which columns are configured for this list.

What do i have to change in my EDITOR?

// Here determining the list-ID or VIEW-ID (with the encapsualted where-clauses/filters)  
if(isset($_REQUEST["data_id"]) && is_numeric($_REQUEST["list_id"]) )
{
    $ID = (int)$_REQUEST["list_id"];
}
$_POST = wp_unslash( $_POST);

Editor::inst( $db, "pc_listview_".$ID." as plv","plv.PXUID" )
->field( 
Field::inst( "plv.PXUID" ),
Field::inst( "ul.ID" ),
Field::inst( "um_vorname.meta_key" ),
Field::inst( "um_vorname.meta_value" ),
Field::inst( "um_nachname.meta_key" ),
Field::inst( "um_nachname.meta_value" ),
Field::inst( "um_email.meta_key" ),
Field::inst( "um_email.meta_value" )
)
 ->leftJoin( "pc_users as ul", "plv.PXUID", "=", "ul.ID"  )
 ->leftJoin( "pc_usermeta as um_vorname", "um_vorname.user_id", "=", "plv.PXUID AND um_vorname.meta_key = 'vorname'"  )
 ->leftJoin( "pc_usermeta as um_nachname", "um_nachname.user_id", "=", "plv.PXUID AND um_nachname.meta_key = 'nachname'"  )
 ->leftJoin( "pc_usermeta as um_email", "um_email.user_id", "=", "plv.PXUID AND um_email.meta_key = 'email'"  )
 ->process( $_POST )
->debug(true)
->json();

ANSWER after REQUEST is ( with my old value of first name(=vorname) )

data    [ {…} ]

0   Object { DT_RowId: "row_1086", plv: {…}, ul: {…}, … }

{
DT_RowId    "row_1086"
plv Object { PXUID: 1086 }
ul  Object { ID: 1086}
um_vorname  Object { meta_key: "vorname", meta_value: "Simone" }
um_nachname Object { meta_key: "nachname", meta_value: "Test" }
um_email    Object { meta_key: "email", meta_value: "user1086@petest.de" }
}

How configure the update on 2 columns (user_id = 1086 and first array-key and meta_value of second array-key

TABLE pc_usermeta has the following columns

umeta_id | user_id  | meta_key | meta_value

I'm sorry that i cant't open access to this wordpress-instance.

Thanks for help in advance!

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Answer ✓

    To edit a nested table, you’d probably be best using a nested DataTable and Editor.

    Editor won’t work directly on your current structure with key value pairs like that.

    Allan

Sign In or Register to comment.