Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Member Fields Breaks {exp:member:edit_profile} tag #1644

Closed
mcfarlandonline opened this issue Dec 11, 2021 · 6 comments
Closed

Custom Member Fields Breaks {exp:member:edit_profile} tag #1644

mcfarlandonline opened this issue Dec 11, 2021 · 6 comments
Labels
Bug: Accepted Bug has been confirmed, is reproducible, and ready to work on. member-functionality

Comments

@mcfarlandonline
Copy link
Contributor

mcfarlandonline commented Dec 11, 2021

EE: 6.1.6
PHP: 7.3

ROBIN NOTE- Still can happen on EE 6.3.4. Happens if the member field id is the same as a grid field.

I built these two custom member fields...

Screen Shot 2021-12-10 at 4 14 16 PM

...and then revisited my frontend "Edit my profile" page to find the error message below.

I tried:

  • Removing my profile's data from those two fields
  • Changing "Organization's Name" to "Organization Name", just in case there were sanitization issues.

The errors remained.

Deleting the fields altogether seems to be the only fix at this point. Am I missing something?

Oh, and I'm not yet calling for the custom fields in my {exp:member:edit_profile} tag. It's pretty boring at this point...

{exp:member:edit_profile
    return="{segment_1}/confirmation/updated/13"
    include_assets="yes"
    }

    <p>* Required fields</p>

    <fieldset>
        <h4>Profile</h4>
        <p>
            <label for="username">Username*:</label><br />
            <input type="text" name="username" id="username" value="{username}"/><br />
        </p>

        <p>
            <label for="email">Email:</label><br />
            <input type="text" name="email" id="email" value="{email}"/><br />
        </p>

        <p>
            <label for="password">Password:</label><br />
            <input type="password" name="password" id="password" value=""/>
        </p>

        <p>
            <label for="password_confirm">Confirm password*:</label><br />
            <input type="password" name="password_confirm" id="password_confirm" value=""/>
        </p>

        <p>
            <label for="current_password">Current password*:</label><br />
                <em>You <b>must</b> enter your current password to change your password, username or email.</em>
             <input type="password" name="current_password" id="current_password" value="" data-validation="required" required/>
        </p>
    </fieldset>
    <input type="submit" value="Save" />
{/exp:member:edit_profile}

screencapture-npprofessionals-prototype-job-posters-edit-profile-2021-12-10-16_16_04

Notice
Undefined index: grid_min_rows
ee/ExpressionEngine/Addons/grid/ft.grid.php, line 172

Severity: E_NOTICE
Notice
Undefined index: grid_max_rows
ee/ExpressionEngine/Addons/grid/ft.grid.php, line 173

Severity: E_NOTICE
Warning
Cannot modify header information - headers already sent by (output started at ee/legacy/core/Exceptions.php:120)
ee/ExpressionEngine/Boot/boot.common.php, line 475

Severity: E_WARNING
Exception Caught
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'foo-db-name.exp_member_grid_field_4' doesn't exist:
SELECT * FROM (exp_member_grid_field_4) WHERE entry_id IN (1) AND fluid_field_data_id = 0 ORDER BY row_order asc
ee/legacy/database/drivers/mysqli/mysqli_connection.php:114

Stack Trace: Please include when reporting this error
#0 ee/legacy/database/drivers/mysqli/mysqli_driver.php(112): CI_DB_mysqli_connection->query('SELECT *\nFROM (...')
#1 ee/legacy/database/DB_driver.php(260): CI_DB_mysqli_driver->_execute('SELECT *\nFROM (...')
#2 ee/legacy/database/DB_driver.php(175): CI_DB_driver->simple_query('SELECT *\nFROM (...')
#3 ee/legacy/database/DB_active_rec.php(1076): CI_DB_driver->query('SELECT *\nFROM (...')
#4 ee/legacy/models/grid_model.php(416): CI_DB_active_record->get('member_grid_fie...')
#5 ee/ExpressionEngine/Addons/grid/libraries/Grid_lib.php(66): Grid_model->get_entry_rows(Array, 4, 'member', Array, false, 0)
#6 ee/ExpressionEngine/Addons/grid/ft.grid.php(186): Grid_lib->display_field(Object(ExpressionEngine\Library\CP\GridInput), 'NetRaising')
#7 ee/legacy/fieldtypes/EE_Fieldtype.php(320): Grid_ft->display_field('NetRaising')
#8 ee/legacy/libraries/api/Api_channel_fields.php(377): EE_Fieldtype->display_publish_field('NetRaising')
#9 ee/ExpressionEngine/Model/Content/FieldFacade.php(250): Api_channel_fields->apply('display_publish...', Array)
#10 ee/ExpressionEngine/Model/Content/Display/FieldDisplay.php(70): ExpressionEngine\Model\Content\FieldFacade->getForm()
#11 ee/ExpressionEngine/Addons/member/mod.member_settings.php(791): ExpressionEngine\Model\Content\Display\FieldDisplay->getForm()
#12 ee/ExpressionEngine/Addons/member/mod.member.php(541): Member_settings->edit_profile()
#13 ee/legacy/libraries/Template.php(1725): Member->edit_profile()
#14 ee/legacy/libraries/Template.php(1409): EE_Template->process_tags()
#15 ee/legacy/libraries/Template.php(576): EE_Template->tags()
#16 ee/legacy/libraries/Template.php(229): EE_Template->parse('{!-- ra:0000000...', true, 1, false)
#17 ee/legacy/libraries/Template.php(1086): EE_Template->fetch_and_parse('site2020_forms', '_job_poster_pro...', true, 1)
#18 ee/legacy/libraries/Template.php(1094): EE_Template->process_sub_templates('{!-- ra:0000000...')
#19 ee/legacy/libraries/Template.php(1094): EE_Template->process_sub_templates('{!-- ra:0000000...')
#20 ee/legacy/libraries/Template.php(618): EE_Template->process_sub_templates('{!-- ra:0000000...')
#21 ee/legacy/libraries/Template.php(229): EE_Template->parse('{!-- ra:0000000...', false, 1, false)
#22 ee/legacy/libraries/Template.php(164): EE_Template->fetch_and_parse('', Array, false)
#23 ee/legacy/libraries/Core.php(654): EE_Template->run_template_engine('', '')
#24 ee/legacy/controllers/ee.php(53): EE_Core->generate_page()
#25 [internal function]: EE->index()
#26 ee/ExpressionEngine/Core/Core.php(255): call_user_func_array(Array, Array)
#27 ee/ExpressionEngine/Core/Core.php(111): ExpressionEngine\Core\Core->runController(Array)
#28 ee/ExpressionEngine/Boot/boot.php(161): ExpressionEngine\Core\Core->run(Object(ExpressionEngine\Core\Request))
#29 public_html/prototype/index.php(164): require_once('...')
#29 public_html/prototype/index.php(164): require_once('...')

@intoeetive
Copy link
Contributor

@mcfarlandonline this is really interesting!

It looks like the parser is trying to parse grid field called 'NetRaising' - and Members do not support grid fields! Do you know what that field is, where it is assigned to etc.?
Also, do you get the same error if you try to use legacy member templates?

@robinsowell is this something you've seen someone encounter before?

@robinsowell
Copy link
Contributor

@intoeetive Weird, and it's not ringing bells and didn't show up in a search. I would have thought NetRaising is the value in the Organization Name field BUT sounds like she has cleared out the content and it's still throwing the error. WHY it is trying to bring grid into the mix, I'm not sure.

I'd be super curious to see if there is a field with that name. Or even a global or something? Really odd one.

@mcfarlandonline
Copy link
Contributor Author

Yes, I had inputed "NetRaising" as the value of the Organization Name field.

This morning, I cleared out NetRaising from that field, but didn't delete the field, and still got this error messaging...

Exception Caught
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'hbn2103_hbn21ee6.exp_member_grid_field_4' doesn't exist:
SELECT * FROM (exp_member_grid_field_4) WHERE entry_id IN (1) AND fluid_field_data_id = 0 ORDER BY row_order asc
ee/legacy/database/drivers/mysqli/mysqli_connection.php:114

Stack Trace: Please include when reporting this error
#0 ee/legacy/database/drivers/mysqli/mysqli_driver.php(112): CI_DB_mysqli_connection->query('SELECT *\nFROM (...')
#1 ee/legacy/database/DB_driver.php(260): CI_DB_mysqli_driver->_execute('SELECT *\nFROM (...')
#2 ee/legacy/database/DB_driver.php(175): CI_DB_driver->simple_query('SELECT *\nFROM (...')
#3 ee/legacy/database/DB_active_rec.php(1076): CI_DB_driver->query('SELECT *\nFROM (...')
#4 ee/legacy/models/grid_model.php(416): CI_DB_active_record->get('member_grid_fie...')
#5 ee/ExpressionEngine/Addons/grid/libraries/Grid_lib.php(66): Grid_model->get_entry_rows(Array, 4, 'member', Array, false, 0)
#6 ee/ExpressionEngine/Addons/grid/ft.grid.php(186): Grid_lib->display_field(Object(ExpressionEngine\Library\CP\GridInput), '')
#7 ee/legacy/fieldtypes/EE_Fieldtype.php(320): Grid_ft->display_field('')
#8 ee/legacy/libraries/api/Api_channel_fields.php(377): EE_Fieldtype->display_publish_field('')
#9 ee/ExpressionEngine/Model/Content/FieldFacade.php(250): Api_channel_fields->apply('display_publish...', Array)
#10 ee/ExpressionEngine/Model/Content/Display/FieldDisplay.php(70): ExpressionEngine\Model\Content\FieldFacade->getForm()
#11 ee/ExpressionEngine/Addons/member/mod.member_settings.php(791): ExpressionEngine\Model\Content\Display\FieldDisplay->getForm()
#12 ee/ExpressionEngine/Addons/member/mod.member.php(541): Member_settings->edit_profile()
#13 ee/legacy/libraries/Template.php(1725): Member->edit_profile()
#14 ee/legacy/libraries/Template.php(1409): EE_Template->process_tags()
#15 ee/legacy/libraries/Template.php(576): EE_Template->tags()
#16 ee/legacy/libraries/Template.php(229): EE_Template->parse('{!-- ra:0000000...', true, 1, false)
#17 ee/legacy/libraries/Template.php(1086): EE_Template->fetch_and_parse('site2020_forms', '_job_poster_pro...', true, 1)
#18 ee/legacy/libraries/Template.php(1094): EE_Template->process_sub_templates('{!-- ra:0000000...')
#19 ee/legacy/libraries/Template.php(1094): EE_Template->process_sub_templates('{!-- ra:0000000...')
#20 ee/legacy/libraries/Template.php(618): EE_Template->process_sub_templates('{!-- ra:0000000...')
#21 ee/legacy/libraries/Template.php(229): EE_Template->parse('{!-- ra:0000000...', false, 1, false)
#22 ee/legacy/libraries/Template.php(164): EE_Template->fetch_and_parse('', Array, false)
#23 ee/legacy/libraries/Core.php(654): EE_Template->run_template_engine('', '')
#24 ee/legacy/controllers/ee.php(53): EE_Core->generate_page()
#25 [internal function]: EE->index()
#26 ee/ExpressionEngine/Core/Core.php(255): call_user_func_array(Array, Array)
#27 ee/ExpressionEngine/Core/Core.php(111): ExpressionEngine\Core\Core->runController(Array)
#28 ee/ExpressionEngine/Boot/boot.php(161): ExpressionEngine\Core\Core->run(Object(ExpressionEngine\Core\Request))
#29 public_html/prototype/index.php(164): require_once('...')
#29 public_html/prototype/index.php(164): require_once('...')

But then I deleted that member field, and the error went away.

I rebuilt it and then got this error message (below).
It doesn't seem to change, no matter what I input as the value for the Organization's Name.
It does disappear when I remove the preceding {partial} that calls in a channel entries tag.
If I remove the {exp:member:edit_profile} tag from the page, the partial/channel entries tag is happy and the error goes away.

Notice
Undefined index: field_channel_fields
ee/ExpressionEngine/Addons/fluid_field/ft.fluid_field.php, line 349

Severity: E_NOTICE
Warning
Cannot modify header information - headers already sent by (output started at ee/legacy/core/Exceptions.php:120)
ee/ExpressionEngine/Boot/boot.common.php, line 475

Severity: E_WARNING

@mcfarlandonline
Copy link
Contributor Author

mcfarlandonline commented Dec 16, 2021

For whatever reason, these are working for me now! It was really odd...

I tried outputting the custom fields within the {exp:member:edit_profile} tag like this:

{custom_profile_fields}
    <p>
        <label>{lang:profile_field}</label><br>
        {form:custom_profile_field}
    </p>
{/custom_profile_fields}

Although both fields were built as "text input" fields, the first one {member_phone} output as a textarea field. The second {member_org_name} only output the label.

I ended up deleting both custom member fields, clearing caches, and then rebuilding. (This time, making double-sure that "text input" was selected as the member field type. It defaults to this, but I made sure to manually select it. Not sure if that was the issue).

Now everything's happy and the fields on the frontend look as expected. Closing this for now, until I can get more consistent behavior.

@robinsowell
Copy link
Contributor

AHHHHHH! This happened again and I finally figured out how to trigger it. It happens if your member field has the same id as a grid field. I basically deleted member fields and added new ones until they no longer matched up to a grid field and it got rid of the problem.

Obscure bug is obscure.

I'm ... going to open this one back up and tweak the description so it's clear it's still an issue.

@robinsowell robinsowell reopened this Jun 21, 2022
@robinsowell robinsowell added the Bug: Accepted Bug has been confirmed, is reproducible, and ready to work on. label Jun 22, 2022
@intoeetive
Copy link
Contributor

For EE7 this has been resolved with #2534 which was released in 7.2.2

Adding same fix for EE6 now

intoeetive added a commit that referenced this issue Feb 6, 2023
bryannielsen added a commit that referenced this issue Feb 7, 2023
…-grid

Resolved #1644 where Edit Profile form could show error when used on same page with channel entries tag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Accepted Bug has been confirmed, is reproducible, and ready to work on. member-functionality
Projects
None yet
Development

No branches or pull requests

3 participants