Problem with the function "connect_get_participant_type around line 454
| Project: | Connect |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | steve.m |
| Status: | closed |
Jump to:
I first want to thank and congratulate Mike Gillford on his connect module. From what I have understood, it has a very a very powerful potential as it will enable drupallers to rapidly develop all different kind of many-to-one elements.
However, I am only a newbie to Drupal and I have some difficulties in finding out how to assign children nodes to parent nodes.
The readme.txt says we have to create a field type called parent_id on the children child, but I would be thankful for more info.
Later in this post, I describe as precisely as possible the problem I have encountered. However, what I would be most grateful to would be a HOWTO section describing with a concrete example how to use this module.
If I could get more info that solves the problem described late, I could myself gladly contribute to explain how we are supposed to use this module.
Thanks i advance,
Samguyver
Here follows a description of my problem:
Trying to build a petition element, I created with CCK a parent node type called "conpetition".
Added the following fields to the title and body:
participant_type (textfield)
petition_text (textfield)
Then, I created a children node type called "conpetitioner":
Added the following fields to the title and body:
parent_id (node reference)
email (email text)
Then I went to the connect module settings and chose "conpetion" as parent node and "competitioner" as children node.
I created a new "conpetition" content called "petitiontest1"
Then I went back to the conpetitioner type to edit the default value of the parent_id and chose "petitiontest1"
However, the petitiontest1 node is complaining:
# user warning: Table 'dbtestwebsite.content_field_participant_type' doesn't exist query: SELECT field_participant_type_value AS value FROM content_field_participant_type WHERE nid = 3 in C:\wamp\www\testwebsite\includes\database.mysql.inc on line 172.
# warning: Invalid argument supplied for foreach() in C:\wamp\www\testwebsite\modules\connect\connect.module on line 313.
# user warning: Table 'dbtestwebsite.content_field_participant_type' doesn't exist query: SELECT field_participant_type_value AS value FROM content_field_participant_type WHERE nid = 3 in C:\wamp\www\testwebsite\includes\database.mysql.inc on line 172.
# warning: Invalid argument supplied for foreach() in C:\wamp\www\testwebsite\modules\connect\connect.module on line 313
Thanks a lot!
/Samguyver

#1
I have found the reason for the bug which caused me first to ask for an :
In connect.module, the function "connect_get_participant_type" around line 454 is not correct:
On line 456, the SQL query calls for the column "field_participant_type_value" of the row whose nid is that of the parent node in the table "content_field_particiant_type.
// what type of participant does this parent use?function connect_get_participant_type($parent_nid) {
$type = null;
$sql = "SELECT field_participant_type_value AS value FROM content_field_participant_type WHERE nid = %d";
if ($result = db_query($sql, $parent_nid)) {
$type = db_result($result);
}
return $type;
}
The problem is that the name of the table is not always "content_field_participant_type" and mainly depends on the name of the type created.
Does anyone know how to rewrite this code so that the SQL query will look in the right table depending of the type of the parent node?
Thanks in advance,
Samuel
#2
Unfortunately a lot of stuff is still hard-coded into the module because this is very early days yet. I'm moving more of these settings into the UI as I get time to do so, but at the moment, many of the fields need to be named exactly as is described in the the README file.
#3
Bump. Just assigning this to myself.
#4
Closing. Fixed in 2.x