WordPress.org

Ready to get started?Download WordPress

Forums

WP-Members
[resolved] Dropdown array won't save (10 posts)

  1. Digma
    Member
    Posted 1 year ago #

    WP-members version: 2.8.1 (patched for pre PHP 5.3)

    I intended to add a dropdown field for my profiles page and it stores all the information just fine apart from the:

    "For dropdown, array of values:"

    From my point of view I entered it correctly:
    Please select|,
    Option number 1|1,
    Option number 2|2,
    Option number 3|3

    Also tried it without the "Please select|,"

    But for some reason it won't store the information for that field.

    It's probably something stupid simple, but I haven't been able to find what is causing this, let alone solve it.

    Any idea on what is going on and how to make it store the information?

    Thanks in advance.

    EDIT:
    when opening the 'edit profile' page. I see the following line above the field I added:

    Warning: Invalid argument supplied for foreach() in /home/public_html/wp_test/wp-content/plugins/wp-members/wp-members-core.php on line 812

  2. han
    Member
    Posted 1 year ago #

    im having a similar issue but instead i keep getting fatal error
    "Fatal error: Call to undefined function str_getcsv() in /home/skim89/public_html/wp-content/plugins/wp-members/admin/tab-fields.php on line 206"

    line 206 - $arr[7] = str_getcsv( $str, ',', '"' );

    what does your 206 line say or do u have any idea why its doing this?

  3. han
    Member
    Posted 1 year ago #

    lol now im having the same exact problem as you

  4. han
    Member
    Posted 1 year ago #

    line 812 - foreach( $value as $option ) {

  5. han
    Member
    Posted 1 year ago #

    i actually think i fixed it. idk if i really did but the error dont show up on my site anymore. the only problem is that the dropdown menu on my site still doesnt show. its just an empty small box with no selections.

    line 812 - foreach( $value as $option ) {

    replace it with

    line 812 - foreach( (array) $value as $option ) {

  6. Digma
    Member
    Posted 1 year ago #

  7. Digma
    Member
    Posted 1 year ago #

    Before the wrong idea is being raised here. The patch did not solve the initial problem of the dropdown array not saving.

  8. Chad Butler
    Member
    Plugin Author

    Posted 1 year ago #

    As an update to this, I did some further work with some premium support clients that were experiencing issues and I have changed the patch.

    At this time, it is just not going to work to try to retro-fit str_getcsv into PHP 5.2 installs. Yes that is my fault for changing the process to incorporate str_getcsv in the first place - this was a case of putting your finger in the dike to plugin one hole, but the water will find some other place to leak out as a result.

    The reason for the change was to more easily allow commas into the dropdown values. But this leaves out users of PHP 5.2 and the current WP requirements are PHP 5.2.4.

    So... I've been searching for a solution that will parse the string into an array appropriately for the 5.2 users. But that has yet to meet with success. So I've updated to the patch to simply roll back to the way that the plugin operated before.

    See: http://rocketgeek.com/blog/wp-members-2-8-1-str_getcsv-patch-for-php-5-3/ for the updated version.

    As I mentioned, this eliminates str_getcsv altogether, so for those users, the dropdown will be what it used to be - no commas in the dropdown values.

    The 2.8.2 update for the plugin will look at the user's PHP version and adjust accordingly - that way, we can use str_getcsv in 5.3+ installs and still function in 5.2 without errors.

    I will continue searching for a solution that will provide the same functionality for PHP 5.2 users, but that may not make it into the 2.8.2 release.

  9. han
    Member
    Posted 1 year ago #

    okay thank you so much!

  10. Digma
    Member
    Posted 1 year ago #

    Many thanks for supplying this solution. It solved both problems together.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic