Searchable database of members using multiple criteria / filters

I just had the same problem, and solved it using the Participants Database plugin. The pdb_list shortcode supports filters, e.g. [pdb_list filter=”state=NY”]. You can generate any shortcodes from a PHP script by running a script with the do_shortcode() function, like this: echo do_shortcode(‘[pdb_list filter=”state=NY”]’); Now you have all the building blocks you need to generate … Read more

wp_postmeta – lot of meta fields

Those are not Core entries so far as I know. That means that a plugin or a theme has inserted them. Since I don’t know which plugin or theme it is, or whether you are still using that plugin/theme, I can’t say whether you should delete the entries. If you are still using the plugin … Read more

Pulling values from a sepcific row in table

$leader_result = $wpdb->get_results(“SELECT user_first_name, user_last_name FROM “.$wpdb->prefix.”mro_attendees WHERE event_id = “.$project_id.” AND user_role=”team_leader” LIMIT 0,1″) foreach($leader_result as $row=>$value) { echo $value->column_name; }

Database Name Change

Ok… So after some more research I found: http://andrewapeterson.com/2012/08/fix-wordpress-media-library-and-attachments-broken-after-movingcloning-site/ which explains that you can’t just do a find and replace in a text editor and be good to go. Fortunately, I still had the original database, so I dropped all the tables in the tsi_ database and restored the original wp_ database. All my images … Read more

Database connection close

You don’t have to worry about closing connection to you DB because it will be automatically closed when a request will be processed by your server. But if you have to close it, then you can do something like this: @mysql_close( $wpdb->dbh ); Pay attention that it could lead to unexpected results because other plugins … Read more

Making CURDATE() recognize current_time()

$current_time = current_time(‘mysql’); $querystr = ” SELECT * FROM {$wpdb->prefix}usermeta WHERE meta_key=’bday_unix’ AND DATE_ADD( from_unixtime(meta_value), INTERVAL YEAR( ‘{$current_time}’ ) – YEAR( from_unixtime( meta_value ) ) YEAR ) BETWEEN ‘{$current_time}’ AND DATE_ADD( ‘{$current_time}’, INTERVAL 30 DAY )”; Should work, I think.