• Resolved udelledo

    (@udelledo)


    Hi everyone,

    I’m developing a site for a sport association and I need to assign to the registering users an ID that is provided by an external system.

    Since I receive the IDs in ranges (ie. membership ID from 130 to 250) I can’t use the standard ID provided by WordPress.

    Using some plugins and some code hack I managed almost to finish the setup as I was able to store the additional information (external ID) and to show the field in the standard administration page (so the admin can make manual adjustments).

    However I would like to add a configuration value available to the administrator user to store the available range so that the assignement of the ID to the user can be attached to a standard hook requiring less work from the administration perspective.

    I was also able to customize WP in order to automatically update the property with a random value after the registration using simple hacks that didn’t require a creation of a plugin.

    To keep it simple I’d like to avoid the need of developing one.

    Reading the documentation I learn how to add attributes for all user as user meta, however this specific configuration requires a single value in the database editable only by the administrators.

    Checking the DB structure and looking at the codex I think altering the wp_options table would be my best option, but I’m not sure how to implementing without creating a plugin or how it would be affected by future update.

    Could you please give me some suggestion on which is the best approach to achieve my goal?

    Any help will be appreciated.

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    Yes, use the options table. You might be able to use the Settings APto place the value in the admin screens somewhere and save any changes to the DB. To protect your code from updates, it should reside in a plugin or child theme.

    Some commercial themes are actually child themes, if so, your only option is a plugin. Developing a simple plugin is quite easy, it’s mainly just placing a proper header in a file. You can use it to contain all of your little hacks and tweaks, it’s actually a good thing to have. If you still hate the plugin idea, the Settings API should work fine from a child theme functions.php file.

    Thread Starter udelledo

    (@udelledo)

    Hi bcworkz! thanks for your suggestion!!!

    I’ll look into your approach and will post an update

    Thread Starter udelledo

    (@udelledo)

    Developing the Settings functions inside a plugin and adding them to an existing group ‘misc’ worked like a charm!!!!

    Thanks a lot bcworkz

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘configuration value definition and management’ is closed to new replies.