WordPress.org

Ready to get started?Download WordPress

Forums

Extra User Details
Bugs with adding fields + fix (5 posts)

  1. jrf
    Member
    Posted 3 years ago #

    Hi Vadim,

    Thanks for your plugin! I liked it so much that I couldn't help but give back to it by doing this rewrite. Please provide me with your email address so I can mail you the new code.

    First of all, let me state clearly that I'm not all that familiar with WordPress or the WordPress plugin API, so no doubt there will be things which I have missed as I didn't know that is the way things should be done.
    One thing which comes to mind straight away and which I haven't looked at, is validating that only users with admin-level priviledges can edit the settings.

    The reason I started looking at the code was the none-showing of fields after you've added a new field (I had to go to another screen, then come back to see the list of fields again).
    Additionally, if you would add another field - without first reloading the screen-, all previously defined fields would be gone from the database, which was a pain.

    Also if you would change the 'field label', you would also change the meta key and lose access to the values which users had already provided.

    Ok, so I solved that and as I was working on the code anyway, I solved some other (potential) issues and added some new features.....

    What I've done:

    • Rewritten the whole admin function to solve the bugs. If you change the field label now, only the label will change, not the meta-key. And the field list will show correctly after adding new fields.
    • Replaced some depreciated WP-functions with their replacements and added backward compatibility for those.
    • Replaced all text strings which didn't have this, with the __() function to prepare the plugin for translating. I haven't added a language directory yet nor added any translations, I just made the actual plugin code ready for setting this up.
    • I also corrected some of the English phrases.
    • Added input validation to the admin function. Main restriction: meta keys and labels may now only contain alphanumerical characters within the current locale and spaces.
    • Added output validation wherever output was created.
    • New feature: added a 'help text' input field so admins can define their own help text to be displayed next to the profile field.
    • New feature: added a 'field order' input field so admins can change the order in which the fields are displayed on user profiles. If two fields were given the same order number, they are sorted by their alphabetic meta key.

    I've tried to maintain backward compatibility, but I've only tested in WP 3.0.1.

    I'd appreciate your feedback and hope you will consider these changes as the compliment to your work which they are meant to be.

    It would be great if you would incorporate my changes into a new version of the plugin so that other people can benefit as well ;-)

    Smile,
    Juliette

    http://wordpress.org/extend/plugins/extra-user-details/

  2. syzen
    Member
    Posted 3 years ago #

    Hi,

    This plugin is just great!

    Good job Vadim and nice explanation from Juliette, but I still cant figure out to get rid of those bugs on my own.

    Looking forward for the next version :D

    Regards,
    syzen

  3. Vadym Khukhrianskyi
    Member
    Plugin Author

    Posted 3 years ago #

    Hey, sorry for delay, next version is coming soon.

  4. jaygoldman
    Member
    Posted 3 years ago #

    Notice in WP 3.0.1 that get_option seems to sometimes return an Array, which was tripping up your unserialize call. Replace line 148 in extra_user_details.php with these two lines:

    if ( get_option( 'eud_fields' ) ) $all_fields = get_option( 'eud_fields' );
    if ( !is_Array( $all_fields ) ) $all_fields = unserialize( $all_fields );

    That seems to fix it.

  5. freeop
    Member
    Posted 3 years ago #

    Thanks for the Plug-in Vadim..

    Hey Jay, Thanks a Million.. Couldn't find a fix on the 3.0.1.. Yep that did the trick for me.. Thanks Again.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic