WordPress.org

Ready to get started?Download WordPress

Forums

WP-Members: no result when updating user custom fields (7 posts)

  1. astridman
    Member
    Posted 2 years ago #

    I have added a number of custom fields for Users using the WP-Members plugin.

    When attempting to add info to a given user for ANY of the WP-Members custom fields (in the WP admin), the field(s) remain blank.

    Any ideas why this is happening?

    Craig

  2. Chad Butler
    Member
    Posted 2 years ago #

    Is this only when info is added to the WP-Members fields via the admin? Are these fields "admin-only" (set to not display)?
    If not, do they take data when entered from the front end?
    Are you using any cacheing plugins?

  3. astridman
    Member
    Posted 2 years ago #

    Hi Chad, aha!

    -Fields are not set to admin only (or at least, not the ones I want to populate/update).
    -YES, after testing, I can input data from the /members-area front end
    -No cacheing plugins.

    Hmmm, so how come I can't update data from the WP backend?

    Craig

  4. lu.ci.do
    Member
    Posted 2 years ago #

    Hi Chad
    Got the same problem:
    In the admin interface when I want to edit a user the wp-members additional fields can not be saved. The values stay the same. With the frontend "members-area" the fields can be saved. No Cache-Plugins installed.
    Any solution to this?
    Thanks in advance
    Luc

  5. hammer9600
    Member
    Posted 1 year ago #

    Anyone who found a solution to this problem?
    Neither can I edit user info in wp-members backend, while I can edit in frontend.

  6. Joshua Fredrickson
    Member
    Posted 1 year ago #

    Same for me. I can view but not edit additional fields in admin.
    They work fine in the frontend user profile page.

  7. Chad Butler
    Member
    Posted 1 year ago #

    I recently worked with a user that had this issue and was able to track it down to a specific configuration. So, I suspect that each of you has the plugin set to have a user defined password at registration (i.e. you've added password field to the registration process)?

    In that instance, there is a bug that will miss all the user meta fields that come in the loop of fields *after* the password (which most people will have at the beginning of their form).

    The next release will have a fix for this. In the meantime, if you want to patch it yourself, it is the wpmem_admin_update function in wp-members-admin.php. The function is at line 154.

    Change the beginning of the function from this:

    $user_id = $_REQUEST['user_id'];
    	$wpmem_fields = get_option( 'wpmembers_fields' );
    	for ( $row = 0; $row < count( $wpmem_fields ); $row++ ) {
    		if( $wpmem_fields[$row][2] == 'password' ) { $chk_pass = true; }
    		if( $wpmem_fields[$row][6] == "n" && ! $chk_pass ) {
    			update_user_meta( $user_id, $wpmem_fields[$row][2], $_POST[$wpmem_fields[$row][2]] );
    		}
    	}

    To this:

    $user_id = $_REQUEST['user_id'];
    	$wpmem_fields = get_option( 'wpmembers_fields' );
    	for ( $row = 0; $row < count( $wpmem_fields ); $row++ ) {
    		if( $wpmem_fields[$row][6] == "n" && $wpmem_fields[$row][2] != 'password' ) {
    			update_user_meta( $user_id, $wpmem_fields[$row][2], $_POST[$wpmem_fields[$row][2]] );
    		}
    	}

Topic Closed

This topic has been closed to new replies.

About this Topic