ansonphong / postworld

Wordpress Theme Development Framework
GNU General Public License v2.0
7 stars 0 forks source link

DB Table Name References #12

Closed ansonphong closed 11 years ago

ansonphong commented 11 years ago

Hi Haidy, In the main postworld.php file, there is a global object $pw_table_names which defines the names of the databases, depending on what the user has set their default wordpress db prefix (default is 'wp_') as well as the default Postworld prefix (default is 'postworld_')

Since the user may have customized their wp_ prefix, or we may choose to change the Postworld prefix to pw_ in the future, we should reference this object in all the functions where the table names are required.

This would involve making $pw_table_names GLOBAL in all functions which use the database, and then referencing the tables by $pw_table_names['post_meta']. Do you think this is this the best way to do it, or is there a better method?

hmikhail commented 11 years ago

Yes, that's what I am using now in all classes. And also we can add a customized prefix for postworld in $wpdb; ex: $wpdb -> pw_prefix = "wppostworld"; and then use $wpdb->pw_prefix."post_meta" .

ansonphong commented 11 years ago

Oh great, I really like that solution. Let's do that.

$wpdb->pw_prefix."post_meta"

Can you implement? Thanks!

hmikhail commented 11 years ago

Done in Commit: c16f4d4212bdbd09a7940688f04919a2b854e8ab and under testing