MyBB Community Forums

Full Version: "Style: XXX"
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
In the post bit, this'll display the user's current style, like this:

Style: Light

It won't say Light always, it'll say the name of the user's current theme / style.

Admin CP >> Templates >> Modify >> Template To Edit >> Expand >> Add template

Title: postbit_style

Template: $theme['name']

"Update Template"

Admin CP >> Templates >> Modify >> Template To Edit >> Expand >> Postbit Templates >> Postbit

Find:

$lang->postbit_status $onlinestatus$replink<br />


Add Under:

$lang->postbit_status $onlinestatus$replink<br />
Style: $style<br />

root/inc/functions_post.php

Find:

// Dont want any little 'nasties' in the subject
$post['subject'] = htmlspecialchars(stripslashes($post['subject']));

$post['author'] = $post['uid'];

Replace With:

// Dont want any little 'nasties' in the subject
$post['subject'] = htmlspecialchars(stripslashes($post['subject']));

$post['author'] = $post['uid'];
	
$themequery = $db->query("SELECT * FROM ".TABLE_PREFIX."themes WHERE tid = ". $mybbuser['style'] ."");
$theme = $db->fetch_array($themequery);

Done! Please report any bugs you find to me.
What exactly does this do?
Shows the current style/theme the user has selected.
Nice idea. I used this in my "own" piece of forum software that i created.... just so others can see what theme is more popular.
Cory Wrote:Shows the current style/theme the user has selected.
Can I get a screenshot of the final result? Does it move the style chooser to the index page, like on vBulletin and IPB?
That's odd.... the query is fine.
Instead of "Place Under," I put "Replace With," in the instructions. Silly me.

IMPORTANT Only do this if you installed this and you had received an error!!!

root/inc/functions_post.php

Find:

/*
User Style
*/

$themequery = $db->query("SELECT * FROM ".TABLE_PREFIX."themes WHERE tid = ". $mybbuser['style'] ."");
$theme = $db->fetch_array($themequery);

/*
/ User Style
*/

Replace With:

// Dont want any little 'nasties' in the subject
$post['subject'] = htmlspecialchars(stripslashes($post['subject']));

$post['author'] = $post['uid'];

/*
User Style
*/

$themequery = $db->query("SELECT * FROM ".TABLE_PREFIX."themes WHERE tid = ". $mybbuser['style'] ."");
$theme = $db->fetch_array($themequery);

/*
/ User Style
*/

Sorry. :p