weiz
Forum Replies Created
-
Is it possible to modify the code a bit which you gave Mert Nuhoglu to satisfy my need? And can you let me know at least where I should put this code? In which file? And under which path? Thanks
function pods_teacher_pick_data($data, $name, $value, $options, $pod, $id){ if ($name == "pods_field_teachers") { foreach ($data as $id => &$value) { $p = pods('teacher', $id); $name = $p->display('name'); $city = $p->display('profile.city.name'); $value = $name . ' - ' . $city; } } return $data; } add_filter('pods_field_pick_data', 'pods_teacher_pick_data', 1, 6);[Please post code snippets between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]
For example, I have two PODs types “Customer” and “CustomerContact”, both of which are Post types but table based.
One fields in “Customer” type, “customer_name”, a text field;
Two fields in “CustomerContact” Type, “customer_name_1”, a relationship field and “customer_contact”, a text field.The relationship field “customer_name_1” gets value from the text field “customer_name”. Now, the values of “customer_name_1” are not stored into the database table “wp_pods_CustomerContact”.
Can you give me a complete code on how to insert the value of “customer_name_1” into the table of “wp_pods_CustomerContact” like a text field? And tell me where I should put this code?
Thanks in advance
My php knowledge is limited.
1. Do you mean that I should also use codes below?(Certainly, I know to modify the parameters)
2. If so, where should I put this code? I mean which file under which path should I insert this code into?function pods_teacher_pick_data($data, $name, $value, $options, $pod, $id){
if ($name == “pods_field_teachers”) {
foreach ($data as $id => &$value) {
$p = pods(‘teacher’, $id);
$name = $p->display(‘name’);
$city = $p->display(‘profile.city.name’);
$value = $name . ‘ – ‘ . $city;
}
}
return $data;
}add_filter(‘pods_field_pick_data’, ‘pods_teacher_pick_data’, 1, 6);
You mentioned “for Advanced Content Types”, but I meant the content type is “custom post type” but the storage type is “table based” when adding new types. Is it the same as “Advanced Content Types” or similar to meta-capable for storage that you early talk about?
If it is, I will look forward to Pods 2.3 but is there any way which can solve it for the time being. I found an article http://podsframework.org/forums/topic/relationship-fields-not-in-mysql-database/, however, it seems to mean an early version of PODs, because I can’t find the “pods/ui/input_fields.php”. So any way for current version?
Thanks, Scott, but does it also apply to table based Pods Type. I just want the value of relationship fields can be inserted into the same table as common fields such as a text field.