Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Post count-based titles


M
Member

@box87

Wow, so much hate… I’m not trying to insult anyone’s sense of intelligence by making this appear easier than it is. It’s just dead simple. I see no great complexity in it. It’s still a “basic MySQL query.”

Why muck around in the usermeta? That’s far too much work if you ask me.

Perhaps I’m wrong.

function get_user_title( $id ) {
global $bbdb;

$pc_query = "SELECT COUNT(post_id)
FROM $bbdb->posts
WHERE poster_id = $id
AND post_status = 0";
$post_count = $bbdb->query( $pc_query );

if( $post_count <= 10 ) {
$title = "Noob";
} elseif( $post_count <= 20 ) {
$title = "Might stick around";
} elseif( $post_count <= 30 ) {
$title = "Title for 30";
} elseif( $post_count <= 40 ) {
$title = "Over the hill";
.
.
.
} elseif( $post_count <= 90 ) {
$title = "Post whore";
} elseif( $post_count > 100 ) {
$title = "Regular";
} else {
$title = "Error";
}

return $title;
}

This way you don’t have to mess around with updating anything… it’s generated on the fly.

Do take note that I haven’t tested the code. I wrote it in about 5 minutes, so I didn’t get around to testing. It’s the concept I’m talking about though.

Skip to toolbar