Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Favourites


_ck_
Participant

@_ck_

It’s just a query, doesn’t write anything so can’t hurt your db. Only bad thing it could do if it you used it on a frequently accessed page, might slow down your site a little bit.

I’ll double check why it’s not working in 0.9

update: oh they changed the name of the field from “favorites” to “bb_favorites” so it’s like this now:

function get_topic_favorites_count( $topic_id=0) {
global $bbdb, $topic;
if (!$topic_id) $topic_id = (int) $topic->topic_id;
return $bbdb->get_var("SELECT COUNT(*) FROM ".$bbdb->usermeta." WHERE meta_key='bb_favorites' AND meta_value REGEXP ':<:".$topic_id.":>:'");
}

Skip to toolbar