WordPress.org

Ready to get started?Download WordPress

Forums

Associated database tables? (3 posts)

  1. TrevorNet
    Member
    Posted 3 years ago #

    With the addition of a new network site, I noticed that additional database tables were added (shows you how new I am to this). How do I know which tables belong to the current site? I checked out get_current_site();, but it always returns the super-site and not the hosted network site's information.

    Goal/Reason: My users are able to click on a link that generates a PDF document on the fly. The file, rewards.php, exists outside of WordPress. I need to be able to pass the networked site's id so that rewards.php knows which table to pull the information from.

    Thoughts: I know that the wp_2_* tables belongs to the first hosted site. Can I create the table name with 'wp_' . $site_id . '_postmeta' with $site_id pulled from a native WP API call? The resulting link to rewards.php being something like: rewards.php?sid=1&pid=23 (actually I would use some sort of pathetic 2-way encryption to at least give the impression that a person can't simply change the values and get every 'reward' posted to each network site. rewards.php?generate=c2lkPTEmcGlkPTIz )

    Note: I will worry about security and the fact that it is pretty dumb to generate table names from the query string later.

    Stumped and tired of google...

  2. stvwlf
    Member
    Posted 3 years ago #

  3. Yep. It says site in the admin area, but the tables are blogID. :) (legacy terms ;) )

Topic Closed

This topic has been closed to new replies.

About this Topic