Home Forums Add-ons Repeater Field User multi-select field in a nested repeater field in an options page.


User multi-select field in a nested repeater field in an options page.

  • Hi,

    I LOVE this plugin and the add-ons, and am usually a really happy camper….but I’m sending up the white flag. I’ve spent 2 1/2 days working on this and digging around in the documentation and can’t see straight. I have no idea how to get this to work. Any guidance would be sooooo greatly appreciated.

    I have a user field with multi select within a nested repeater on an options page. I would like output a list of first name and last name wrapped in their email. Like this
    only nested on this page

    My field structure is: (label/field name/type)

    Daily Booth Schedule / btg_daily_booth_schedule / Repeater
    — Date / btg_show_date / date_picker
    — AM/PM / btg_am_pm / select
    — Start Time / btg_timeslot_start_time / date_time_picker
    — End Time / btg_timeslot_end_time / date_time_picker
    — Location or Additional Information / btg_additional_information / text
    — Full Team / btg_full_team / checkbox
    — Team / btg_booth_team / repeater
    — Booth Team Member / btg_booth_team_member / user with multi-select

    My code is:

    <?php // Get Booth Schedule ?>
    <table width="50%" border="1" cellspacing="0" cellpadding="0" class="btg-agenda-info-display">
    <?php if(get_field('btg_daily_booth_schedule', 'option')): ?>
    	<?php while(has_sub_field('btg_daily_booth_schedule', 'option')): ?>
    				<?php if( get_sub_field('btg_show_date') ): // Check date?>
        				<td colspan="2" class="date-agenda"><?php the_sub_field('btg_show_date'); //Show date ?></td>
                    <?php endif; ?>
        				<td><?php the_sub_field('btg_am_pm'); //Show AM/PM Time Slot?></td>
        				<td><?php the_sub_field('btg_timeslot_start_time'); ?> - <?php the_sub_field('btg_timeslot_end_time'); //Display Time Slot Block?></td>
        			<td><?php // Get list of booth staff  ?>
    							// check for rows (sub repeater)
    							if( get_sub_field('btg_booth_team') ): ?>
    								<?php // loop through rows (sub repeater)
    								while( has_sub_field('btg_booth_team') ): // display each name as a list 
    									$value = get_sub_field('btg_booth_team_member', 'user_2');
    									echo '<li><a href="mailto:' . $value["user_email"] . '"><div class="icon-envelope-alt"></div>' . $value["user_firstname"] .' '. $value["user_lastname"] . '</a></li>';
     								<?php endwhile; ?>
    							<?php endif; //if( get_sub_field('btg_booth_team') ): ?>
                   <?php the_sub_field('btg_full_team'); //Display Full Team Required ?></td>
                    <?php if( get_sub_field('btg_additional_information') ): // Check for additional information?>       
        				<td><?php the_sub_field('btg_additional_information'); // Display additional information?></td>
    				<?php endif; ?>
    	<?php endwhile; ?>
    <?php endif; ?>
    <td colspan="2">Logo</td>

    Thank you,


  • Hi @M Squared Graphics

    Is the issue that the nested has_sub_field does not work?
    Does the data save correctly, but the loop doesn’t work?

    I think it is a current bug that is caused by the $post_id param being different to the parent loop.

    Your parent has_sub_field loop uses the $post_id of ‘options’, but your child loop doesn’t. This is logical and I don’t blame you for coding this, it’s how I would too.

    I think that if you ad ‘options’ to your nested has_sub_field loop, then it will work!

    I’ve experienced and fixed this with the next version of ACF 4.3 which should be out soon.

    Hope that helps.


  • Hi Elliot,

    Thank you for the quick response. Your second question is actually the important one. I had assumed the the data was saving (may bad) but I just double checked and it’s not saving the data.

    Any ideas what to do?



  • Hi @M Squared Graphics

    Perhaps your server is hitting a limit during the save poccess and terminating early?

    How much data are you trying to save at one time.
    With the repeater field save correctly if there is only 1 row of data?

  • Hi Elliot,

    I tested it with a single select and multi-select. Neither is saving regardless if it’s one user name or 10. Either way it’s not enough that should cause a server limit.

    However, If I take the user field out of the nested repeater and move it up one level it saves the data.

    If I do this to get around the problem and achieve what I need to do. Then I have to use the multi-select for the user list. But I have been completely unsuccessful in getting that list of users to show on the screen. I’m trying to get first name, last name and email.

    Is there something different about retrieving user from a multi-select? I’ve got the single user select working on other pages as in the links mentioned above. I don’t see much about the user field in the documentation.

    Thanks a bunch for the help.



  • Hi @M Squared Graphics

    The only difference between multi and single select is that the multi-select will return an ARRAY of users, instead of just 1.

    You mentioned something about ‘move it up one level’. Does this mean you are working in a nested repeater environment?

    Can you please show a screenshot that demonstrates the data being saved?


  • Hi Elliot,

    I had deconstructed the field group since I’m trying to find a another way around what I need to do…deadline approaching.

    I went to reconstruct it to send you the screenshot and started getting this error
    Fatal error: Cannot unset string offsets in /nfs/c03/h02/mnt/167131/domains/ on line 698

    I then deleted all the fields and started over and the error was gone but the original issues persists. In the screenshot the Teams sub-field is the multi-select. If I make selections and then leave the page and then come back they are still there and selected. The field Teams Test is the nested repeater with the User select field. If I select users from that sub-field and add rows when I leave the page and come back the rows are there but the selections are gone. Reset to the null -Select-.

    The screenshot is



  • And sorry incomplete answer, yes it is a nested repeater environment.

    The structure is:
    repeater                 btg_daily_booth_schedule_test
          date_picker        btg_show_date
          select             btg_am_pm
          date_time_picker   btg_timeslot_start_time
          date_time_picker   btg_timeslot_end_time
          text               btg_additional_information
          user               btg_booth_team_2
          repeater           teams_test
             user            user_test 



  • Hi @M Squared Graphics

    Thanks for the info.

    I think the issues is that WP cannot save the data of the teams_test (nested repeater) because the field name is too long!

    the wp_postmeta table has a character limit on the meta_key value, and to save a value in that nested repeater, the name would have to be:


    Perhaps you will need to rename your fields to make it shorter?
    You will loose any current data in doing this however… It’s worth a test with a new repeater field though.


  • Hi Elliot,

    I got caught up in finishing my project but I did wanted to close out this support request.

    I did shorten the names and it did solve my last issue.

    Also using “options” on the child loop as well did solve most of the first problem.

    So thank you very much for your patience and support.

    I could not have completed this project without your excellent plugins and assistance. Thank you!


    Sandra Christie

  • Hi Guys,

    Spent an evening with exactly the same problem, and after finding @Elliot Condon’s point about character limits, bingo, problem solved, so THANK YOU. Just a thought, do you reckon it’s worth adding the comment about the character limit in the documentation, or maybe even enforcing one to prevent this from happening?

    Thanks again,


Viewing 11 posts - 1 through 11 (of 11 total)

The topic ‘User multi-select field in a nested repeater field in an options page.’ is closed to new replies.