hardcoded saasta_faves table in functions.php -- is there a way to make this work the same way as other tables?
GoogleCodeExporter opened this issue · comments
See below for a hardcoded saasta_faves table (functions.php in default theme):
{{{
get_currentuserinfo();
if ($user_ID != '') {
$foo = $wpdb->get_results("select post_id from saasta_faves where user_id=".
$user_ID." and post_id=".get_the_ID());
}}}
Would it be possible to use the "WordPress way" of doing this, so that instead
of saasta_faves
you'd write `$wpdb->faves`?
If we ever need to move the blog somewhere else, it might be good if we could
configure it to
use some other DB prefix than `saasta_`.
Original issue reported on code.google.com by jjhel...@gmail.com
on 15 Jul 2007 at 7:50
I'm a bit hesitant to touch the wpdb innards.. Granted, it does have stuff like
$wpdb->posts which equals to
saasta_posts in our case, but gotta see if it has something like
$wpdb->table_prefix. If it does, then yeah we
should definitely use that.
Original comment by mikko.ur...@gmail.com
on 15 Jul 2007 at 9:09
Original comment by jjhel...@gmail.com
on 17 Jul 2007 at 3:45
- Added labels: Maintainability
Lo' and behold, I got up my arse and fixed this. All occurences to saasta_posts
should be replaced w/ $wpdb-
>posts and saasta_faves w/ $wpdb->prefix."faves".
See r124.
Original comment by mikko.ur...@gmail.com
on 4 Feb 2008 at 6:55
- Changed state: Fixed
Woohoo!
Original comment by jjhel...@gmail.com
on 4 Feb 2008 at 7:29
- Changed state: Verified