Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am trying to understand what the following line from wp-signup.php does:

$active_signup = get_site_option( 'registration' );

I can see from the following documentation: http://codex.wordpress.org/WPMU_Functions/get_site_option that this will return the value of the site option 'registration'.

But how do I find where the current value of the option 'registration' in the SQL database? Or in general, how do I find the association between a key and the data in the database?

share|improve this question
add comment

3 Answers 3

up vote 3 down vote accepted

Note that the function get_site_option() works a bit differently from get_option() on its own. On WordPress Multisite (ie, with Network Mode enabled), there are two different kinds of options:

  • site-specific options, which are stored in the individual options tables for each blog (wp_options, wp_5_options, etc). These options are accessed with get_option(), update_option(), etc. Note that this assumes that the current blog - the one set in $wpdb->blog_id - is the blog from which you want to get the option. You can use get_blog_option() etc to get options from the non-current blog.
  • network-wide options, which are shared between all sites on a network, and are stored in wp_sitemeta. These options are accessed with get_site_option(), update_site_option(), etc.

(Note that the 'site' terminology is a bit confusing: before WordPress 3.0 and the merge of WPMU, what we now call 'sites' were called 'blogs', and what we now call 'the network' (ie, the entire installation) was called 'the site'. That's why you use x_site_meta() to get networkwide stuff.)

If you are running Multisite, then registration is stored in wp_sitemeta. Thus the use of get_site_option().

If you are not running Multisite, there is no wp_sitemeta table, and the _site_option() functions simply fall back on _option(), so that get_site_option( 'registration' ) will return the value of get_option( 'registration' ).

For more on the options functions, see wp-includes/options.php https://core.trac.wordpress.org/browser/trunk/wp-includes/option.php (the option.php file was introduced recently into trunk; on a distribution version, look in wp-includes/functions.php).

share|improve this answer
add comment

You'll find every options in the table wp_options

Regarding the association between a key and the data, if you are referring to the "Custom fields", you must use the get_post_meta functions.

In the db you'll find this keys in the table wp_postmeta. To recover a key, you must know the post_id, of course!

share|improve this answer
add comment

registration stores whether or not the site is allowing new users to register. It seems like it will either be none, blog, user, or all. Some of those seem to be wpmu specific, so they may not apply to you, depending on your usage case. I think registration is set somewhere in settings, in case you need to change it.

share|improve this answer
    
Yes that is also my understanding, but I was trying to find my way through the PHP code to the SQL database (where does PHP calls the SQL data, and how). Unfortunately I cannot find documentation, and the code is not obvious to me. –  tucson Mar 29 '12 at 13:54
    
Can you clarify what you're asking then? –  m0r7if3r Mar 29 '12 at 21:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.