happycog / VMG-Chosen-Member

VMG Chosen Member - Fieldtype for Expression Engine 2 and 3
http://vectormediagroup.com
23 stars 11 forks source link

Error Displaying Associated Entries #18

Closed shaunthompson closed 8 years ago

shaunthompson commented 8 years ago

Hey there,

I'm currently using the ee3 branch in a new installation of ExpressionEngine 3.3.3. We have a bunch of entries from an old site that I was able to bring in to the new one and everything looks good on the backend. When I try to display associated entries for a given member on the frontend though, I get the error below:

Exception Caught

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db215353_ee.exp_matrix_cols' doesn't exist: SELECT cf.field_id AS field_id, mc.col_id, IF(mc.col_id IS NULL, cf.field_name, mc.col_name) AS field_name FROM (exp_channel_fields AS cf) LEFT JOIN exp_matrix_cols AS mc ON mc.field_id = cf.field_id WHERE ((cf.field_type = 'vmg_chosen_member' || cf.field_type = 'matrix') AND cf.field_name = 'allowed_users') AND cf.field_type = 'vmg_chosen_member'

mysqli_connection.php:119

We're currently not using any matrix fields - not sure why it's looking for one. Here's the basic template:

{exp:vmg_chosen_member:assoc_entries
    field="allowed_users"
    member_id="120"
    channel="reports-client-projects"
    display_entries="yes"
}

   <li>{title}</li>

{/exp:vmg_chosen_member:assoc_entries}`

I would expect this to display a list of all entries in channel reports-client-projects where member ID 120 is selected in field allowed_users but instead get the error above.

I saw that there was an issue similar a few years ago for an older build – not sure if it's related?

Appreciate the help! Shaun

mrw commented 8 years ago

It looks like exp:vmg_chosen_member:assoc_entries calls $this->chosen_helper->convertFieldName on Line 116 of the module, and convertFieldName() assumes Matrix is installed (it can be seen in this range here). This is something we can fix but it may take some time because we're committed to a few other projects right now. If you want to fix it (by checking for Matrix, similarly to as done here) feel free to send a pull request -- otherwise we'll give this a look as soon as possible!

shaunthompson commented 8 years ago

@mrw – thanks so much for getting back to me on this!

I've tried to fix it using the example you sent, but my knowledge is pretty limited so I'm not having much luck. Do you have an idea of when you'd be able to take a look at this? I totally get you're committed to other things – sorry to ask, but this plugin could be a life saver for us on a site we're having issues with.

I don't think this is related – but we're also experiencing an issue where on creating a new entry, all of the available members are selected in the Chosen Member Field. We're currently using a list of 1400+ members so it's pretty unmanageable. Any ideas here? Is it a setting?

Thanks again!

mrw commented 8 years ago

Give this branch a download and see if it fixes things for you-- let me know either way. If it works I'll merge it into the main EE3 branch: https://github.com/vector/VMG-Chosen-Member/tree/bugfix/18

shaunthompson commented 8 years ago

Yes, that fixed the issue! Thank you so much for your help with this!