MyBB Community Forums

Full Version: User title
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, I have a problem with creating a new plugin. Because I will add to the query to retrieve the current u.usertitle (mybb_users) title and would like to update automatically when, for example when you reach X posts varies. Here, I is not working. How to do it? I would not give here the whole code as a plugin for the private. So how do to fetch the titles of default. Maybe to mybb_usertitle? Help.
u.usertitle will only work if you have joined two tables in query and declared "FROM users as u".
Make sure you are doing that way.

Else you can fetch the user details from database in an array, say '$target_user' and get the user title using the vatiable: $target_user['usertitle'].

The current logged in user's title is always available with $mybb->user['usertitle']
So my question is as follows:
$query = $db->query("SELECT  u.username, u.usergroup, u.displaygroup, u.avatar, u.uid FROM ".TABLE_PREFIX."users as u ORDER BY ". $order ." DESC LIMIT " . $mybb->settings['mysettings']);
It takes only the current title (which itself set) and not the default ..
I do not understand what you mean .... : (
IIRC we have a function "get_usertitle". Search for it on http://crossreference.mybboard.de

Edit: it's part of "inc/functions_user.php" (~ line 525)
So how to use eg:
function myplugin()
{
	global $db, $mybb, $theme, $templates;
if($mybb->settings['myplugin'] == 'show'){ $order = 'u.uid'; }

$query = $db->query("
	SELECT
	 u.username, u.usergroup, u.displaygroup, u.avatar, u.uid
	FROM ".TABLE_PREFIX."users as u
	ORDER BY ". $order ." DESC LIMIT " . $mybb->settings['myplugins']);
while($myplugin = $db->fetch_array($query))
	{		
	$plugin = $myplugin['myplugin'];
	
		}

This did it, and maybe someone knows how to get the user title of the group?
It will help anyone? Just as the title to download user -dependent group.