• The procedure for inserting custom profile fields by means of editing the file wp-members-install.php is well-documented on the plug-in’s own site, but with release 2.6 comes the ability to add custom fields through a user interface within the admin dashboard of WP. However, adding a new field using this method does not (seem to) add it to the existing array in the database tables and it is therefore not possible to input data to a field generated in this way – even though teh new field appears in the user’s profile. Unhappily a suggested work-round (setting $chk_force = true; in the install file, then deactivating and reactivating the plug-in) does not achieve much either, except that any customising already done is lost. Even leaving this set to ‘true’, then adding a new custom field and updating doesn’t force the new field into the array.

    So, unless I’m doing something wrong – entirely possible – then it does not seem that adding custom fields using the U.I. is working properly? Any advice appreciated.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Michael,

    The entire purpose of the 2.6 release was focused on the ability to add custom fields via the admin interface, so a significant amount of testing went into these features. As such, I’m concerned that something in that area is being reported as not working, so don’t take this the wrong way, but I’m hoping it’s something on your end πŸ˜‰

    Here are some questions:

    • Did you check the “Add” checkbox when you clicked “Update Fields”?
    • Is the field in the list of fields with at “Delete” checkbox next to it?
    • Is the box for “Display” checked?

    If you can answer “yes” to all of the above, but you are not seeing it:

    • What field type was it?
    • Where are you not seeing the field you added that you would expect to be seeing it?
    Thread Starter michael walker

    (@michael-walker)

    Michael,
    The entire purpose of the 2.6 release was focused on the ability to add custom fields via the admin interface, so a significant amount of testing went into these features. As such, I’m concerned that something in that area is being reported as not working, so don’t take this the wrong way, but I’m hoping it’s something on your end πŸ˜‰

    I’m very happy to clarify that the problem I’m describing is specific to my own site/installation/database and does not, so far as I know, relate to the plug-in in general usage – sorry if that wasn’t clear. Here (below) is some more info:

    Here are some questions:

    Did you check the “Add” checkbox when you clicked “Update Fields”?
    Yes.

    Is the field in the list of fields with at “Delete” checkbox next to it?
    Yes.

    Is the box for “Display” checked?
    Yes

    If you can answer “yes” to all of the above, but you are not seeing it:

    What field type was it?
    A textbox

    Where are you not seeing the field you added that you would expect to be seeing it?

    I am seeing the field – it displays in the users’ profiles and everywhere else that it should do. However, if I try and enter some data into it, (let’s say I am editing someone’s profile) and then click on ‘update user’ , I get a message that says ‘User Updated’. So far, so good. But the data I input has not been saved – the field entry is still blank.

    Digging into my database, I now see that the problem is not quite as I described it before. The new field does indeed appear in the array (I can see it listed in ‘wpmembers_fields’ in the ‘wp_options’ table). However, there is no entry of any sort shown in the ‘wp_usermeta’ table which corresponds to it, no matter how many times I enter and re-enter data into my new field through the WPM interface. I hope that’s clarified the situation. For what it’s worth, I can see, and successfully edit, WP native field entries with no problems. I’m assuming this isn’t a problem when you test it yourself, and I am a bit puzzled as to where I go from here. Any thoughts gratefully appreciated.

    That helps narrow things down quite a bit!

    You are correct in looking in the usermeta table as that is where it would be going. The option name that is specified in the WP-Members Manage Fields panel will be in the usermeta table as a meta_key.

    I did some playing around and I did find one possibility to recreate what you are experiencing, so let’s start with that. Did you leave the Option Name for the field blank? This would in essence create a field in the array that does not have a meta_key associated with it and therefore would not be stored.

    Whether or not that’s the case with your situation, it does indicate that I do need to add some additional error checking to the process.

    Thread Starter michael walker

    (@michael-walker)

    thanks again for the response, Chad. No, I’m afraid I didn’t leave the Option Name field blank. I’ve also (optimistically) turned on PHP debugging site-wide, but I’m not getting any clues there as I go through the process. Sorry not to be more help…I’m stuck!

    Thread Starter michael walker

    (@michael-walker)

    A little more information that might help to narrow things down a bit further:

    I just went into my usermeta table and manually input a new meta key to correspond to a new custom field’s option name that I know is in the array. I then put a random value in the corresponding meta value. Now, if I look at that user’s profile, I can see my changes – my new custom field shows up (as it did before) but I can also see the random value I input. So, the right data is being pulled from the DB. However, I still cannot edit/amend/delete this value by means of the WPM UI. It’s just ignoring my input. So, it looks like the plug-in is just not writing to the usermeta table, either at the time the custom field is created, nor when the data value is subsequently edited.

    I’m still stuck – just a bit better informed πŸ™

    Bummer! I thought for sure that would be it. Well, at least I know that I do need to add some additional error checking in that area anyway… probably a 2.6.2 code improvement release.

    Since this is a new feature, I don’t have a good list of “if this, then try this” possibilities yet (your’re the first). It might be helpful for me to take a look under the hood so to speak. If you don’t mind setting me up with at least an admin login to start (and possibly a login to look at the database – hopefully we won’t need to go that far), that would be helpful for me. If you are willing to do that, contact me via the contact form on my site and I’ll email you back with my direct email address.

    Thanks Michael for getting me a login to look at this. Once I logged in, I knew right away what the problem was, and honestly we could have gone around on here for a long time before I would have figured it out.

    The problem for you is not actually inherent in the plugin. It had to do with a modification that we had discussed and I had quite forgotten about… specifically regarding the displayed fields. There’s one other thing that needs to be changed.

    The process that updates a user on the admin side only handles fields that are displayed (as in the past those were all that were being used). So, similar to the other lines that need to be updated for this mod, wp-members-admin.php needs to be changed at line 118 from this:

    if ($wpmem_fields[$row][6] == "n" && $wpmem_fields[$row][4] == "y") {

    to this:

    if( $wpmem_fields[$row][6] == "n" ) {

    I originally tested with two fields where one was marked as displayed and the other was not. The displayed field obviously updated and the other did not. I made this change on your site via the plugin editor window and when the change is applied, both fields updated.

    Let me know how it works for you now.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘]Plug-In: WP_Members 2.6] Custom Fields Problem’ is closed to new replies.