Support

Account

Home Forums ACF PRO ACF User role field value not moving with row

Solving

ACF User role field value not moving with row

  • Hi all, question is regarding John Huebners plugin ACF User Role Field Setting.

    I’ve got a text field only visible to administrators, within a repeater which currently has 7 rows.

    When logged in as the administrator, if I were to change the order of the rows, the field obviously moves with the row and all is fine.

    But when logged in as a user, the field is not visible (so behaving correctly) but if I were to change the order of the rows, the value of the field does not move with the row, and I know this because the value of the field determines the file name of an icon that displays on the front end for that row, but the icon does not change order.

    Is this a bug?

    Thanks.

  • Hmmm, that’s a bug I was not aware of. I understand why it’s happening but I don’t know if I can fix it.

    I’ve started a new issue here https://github.com/Hube2/acf-user-role-field-setting/issues/10 since this is not related to ACF itself.

  • I’m not an advanced developer but can sort of understand why it’s happening myself, the user doesn’t have write permissions to that field but requires it to write the value to another row ID in the repeater (something along those lines?)

    So if I were to make the text field visible to all, but read-only to users, would this have the same issue?

    Adrian

  • It is the same issue that is causing this https://support.advancedcustomfields.com/forums/topic/acf-repeater-sub-fields-are-losing-swapping-content-when-re-ordered/

    Since the value is not submitted it cannot be updated. Yes, if you made the field read only then I think that would effectively correct the problem.

    I’m attempting to fix the error in my plugin, but it’s not an easy fix.

  • Hi John

    I’ve just noticed on github that you’ve updated the plugin so have updated this on site, tested it and it works a charm, that’s great work considering you weren’t confident you could do it. I’d like to buy you a beer, how can I donate…

  • When you’re editing a field group there is a little box on the right (if you haven’t removed it) with a link to send a gift.

    It wasn’t so much that I didn’t think it was possible, it was more of the amount of code that might be required to get it done. A lot of complicated code would just be difficult to maintain. Luckily, I was able to find a simple, efficient way to do this. I posted the basics of what I did here https://support.advancedcustomfields.com/forums/topic/acf-repeater-sub-fields-are-losing-swapping-content-when-re-ordered/#post-52834. For my plugin it’s a little more specific, limited to only the fields that are removed, so there’s much less chance it will cause performance issues.

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

You must be logged in to reply to this topic.