2021-10-12, 11:22 PM
I had originally posted this in the discord server but realized it would probably do better as a support thread just incase someone else comes across a similar issue as I've had no success at finding similar support threads (or I am not typing in the right keywords).
I'm building a plugin that will display a list/directory based upon a set of restrictions via plugin settings. I haven't figured out how to implement the settings into the query just yet so for the time being I am testing this with usergroup 4 and profile field id 4.
The plugin works just fine when I leave out the guts: https://gyazo.com/190821328f68fc20f99ea104b73afd6b
However, when I add the query the page says:
What am I doing wrong here? This same query works fine as a page of its own when I had it all inside faceclaims.php file like you would create any other custom page. I'm attempting to turn this into a plugin so I can not only change these values from the ACP without file editing but so I can share it with other forum RPG users to make their lives easier.
I'm building a plugin that will display a list/directory based upon a set of restrictions via plugin settings. I haven't figured out how to implement the settings into the query just yet so for the time being I am testing this with usergroup 4 and profile field id 4.
The plugin works just fine when I leave out the guts: https://gyazo.com/190821328f68fc20f99ea104b73afd6b
function fc_directory_start()
{
global $mybb, $templates, $lang, $header, $headerinclude, $footer;
if($mybb->get_input('action') == 'fcdirectory')
{
// if its disabled go back to index
if ($mybb->settings['fc_enable'] != 1) {
redirect("index.php");
}
// do guests have permission to view this page? if not display error no perm
if ($mybb->settings['fc_gvisibility'] != 1 && $mybb->user['uid'] == 0) {
error_no_permission();
}
// breadcrumb because where are we?
add_breadcrumb('Face Claim Directory', "misc.php?action=fcdirectory");
// Using the misc_help template for the page wrapper
eval("\$page = \"".$templates->get("fc_directory")."\";");
output_page($page);
}
}
However, when I add the query the page says:
Quote:This page isn’t working
websitename.com is currently unable to handle this request.
HTTP ERROR 500
function fc_directory_start()
{
global $mybb, $templates, $lang, $header, $headerinclude, $footer;
if($mybb->get_input('action') == 'fcdirectory')
{
// if its disabled go back to index
if ($mybb->settings['fc_enable'] != 1) {
redirect("index.php");
}
// do guests have permission to view this page? if not display error no perm
if ($mybb->settings['fc_gvisibility'] != 1 && $mybb->user['uid'] == 0) {
error_no_permission();
}
// breadcrumb because where are we?
add_breadcrumb('Face Claim Directory', "misc.php?action=fcdirectory");
// now do the query thing
$query = $db->query("
SELECT *
FROM ".TABLE_PREFIX."users
LEFT JOIN ".TABLE_PREFIX."userfields
ON ".TABLE_PREFIX."users.uid = ".TABLE_PREFIX."userfields.ufid
WHERE ".TABLE_PREFIX."users.usergroup IN (4)
ORDER BY username ASC
");
while($users=$db->fetch_array($query)) {
$users['avatar'] = $users['avatar'];
$users['profilelink'] = $users['uid'];
$users['username'] = format_name($users['username'], $users['usergroup'], $users['displaygroup']);
$users['faceclaim'] = $users['fid4'];
// does fc exist or no? if not they don't need to be displayed
if(!$users['faceclaim']) {
// do nothing
}
else {
eval("\$fc_directory .= \"".$templates->get("fc_entry")."\";");
}
}
// if directory is empty display the empty template
if(!$fc_directory) {
eval("\$fc_directory .= \"".$templates->get("fc_entry_empty")."\";");
}
eval("\$fcdirectory = \"".$templates->get("fc_directory")."\";");
output_page($fcdirectory);
}
}
What am I doing wrong here? This same query works fine as a page of its own when I had it all inside faceclaims.php file like you would create any other custom page. I'm attempting to turn this into a plugin so I can not only change these values from the ACP without file editing but so I can share it with other forum RPG users to make their lives easier.