MyBB Community Forums

Full Version: Variable to "call" in global templates?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
(2015-07-11, 02:54 PM)Ad Bakker Wrote: [ -> ]Replace line 292 of  viewgroups.php:
$query = $db->simple_select("users", "*",$search_sql, array('limit' => "{$start}, {$per_page}"));
by:
$query = $db->query("SELECT u.*, f.*
		FROM ".TABLE_PREFIX."users u
		LEFT JOIN ".TABLE_PREFIX."userfields f ON (f.ufid = u.uid)
		WHERE {$search_sql}
		LIMIT {$start}, {$perpage}
");

I believe I did'n make a syntax error, when I do (curly brackets are tricky sometimes)  .m. will see Big Grin .

I received this error:

SQL Error:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 5
Query:
SELECT u.*, f.* FROM mybb_users u LEFT JOIN mybb_userfields f ON (f.ufid = u.uid) WHERE (usergroup='4' OR CONCAT(',',additionalgroups,',') LIKE '%,4,%') LIMIT 0,

(2015-07-11, 08:15 PM)dragonexpert Wrote: [ -> ]You need to redefine $search_sql to use u.usergroup not usergroup because of using aliasing on the mybb_users table.  You'll also need to look at $additional_sql and change it to u.additionalgroups. Finally, in $total_rows you need to change
($db->simple_select("users", "COUNT(uid) as users", $search_sql), "users");
to
($db->simple_select("users u", "COUNT(u.uid) as users", $search_sql), "users");

I received this error:
SQL Error:
1054 - Unknown column 'u.usergroup' in 'where clause'
Query:
SELECT * FROM mybb_users WHERE (u.usergroup='4' OR CONCAT(',',u.additionalgroups,',') LIKE '%,4,%') LIMIT 0, 15

I was only supposed to change 'usergroup' to 'u.usergroup' on line 284 and 'additonalgroups' to 'u.additionalgroups' on lines 279 and 282 right?
(2015-07-11, 10:12 PM)brandkast Wrote: [ -> ]I received this error:

I will test it.

Sorry, typing error.


        LIMIT {$start}, {$perpage}

must be (note the underscore)
        LIMIT {$start}, {$per_page}

I tested it, and it seems to work now.

(2015-07-11, 10:12 PM)brandkast Wrote: [ -> ]I was only supposed to change 'usergroup' to 'u.usergroup' on line 284 and 'additonalgroups' to 'u.additionalgroups' on lines 279 and 282 right?

No, also line 288 to:
$total_rows = $db->fetch_field($db->simple_select("users u", "COUNT(u.uid) as users", $search_sql), "users");

I would also change (original) line 382 to:


$user['avatar'] = '<img src="'.htmlspecialchars_uni($user['avatar']).'" height="70" />';

Because as it is now, non-square avatars are stretched to make them square.
Done, but still getting the same error. Everyone is showing the same thing. Sad
Try it with the attached viewgroups.php file (first unzip it) in your plugin directory.
(2015-07-13, 02:39 PM)Ad Bakker Wrote: [ -> ]Try it with the attached viewgroups.php file (first unzip it) in your plugin directory.

Did you attach a file?
(2015-07-13, 03:28 PM)brandkast Wrote: [ -> ]Did you attach a file?

Sorry, apparently I did not attach it Huh . Now it is Smile .
No luck still. Sad
(2015-07-13, 03:33 PM)brandkast Wrote: [ -> ]No luck still. Sad

Strange, I just tried this version with me, and it works.

What exactly do you see?
(2015-07-13, 03:45 PM)Ad Bakker Wrote: [ -> ]What exactly do you see?

Figured out it's actually showing the profile field of the user that is logged in (the person viewing the page). Therefore, as a Guest, nothing shows.
So, is it OK now? I see nothing wrong.
Pages: 1 2 3