Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • Sign Up

Face Claim Listing
   (0 reviews)

isoldehn
  • Face Claims are a big part of the RPG community, an automatic listing of who has who will make every ones lives much easier. Ooo and did I mention this list was searchable!?

    Software: MyBB

Face Claim Listing

Tutorial Created By: isoldehn
Tutorial Permissions: Please do not re-post this tutorial else where, instead link someone to this thread.

- Additionally, you are NOT required to credit me if you use these codes on your board BUT I do wish for you to share this with those that ask about it if they ever do (share the knowledge, be kind).
Tutorial Needs: Overall, the ability to copy and paste.
- FTP/File Access To Web Space

 

Step One

Create the face claim file. Open your FTP client or file manager/file area of your web space. In your MyBB directory (usually located directly in public_html) create a new file called faceclaims.php and insert the following code.

<?php
// *********************************************************
// * Face Claim Listing by Isoldehn Affairs 2018.          *
// * Free for for general public usage and change!         *
// * Please do not claim as your own nor charge money to   *
// *  install this for others.                             *
// * If any issues contact isoldehn#4139 on Discord or     *
// *  visit https://isoaff.com/ for other contact options. *
// *********************************************************

define("IN_MYBB", 1);
define('THIS_SCRIPT', 'faceclaims.php');
$templatelist = "faceclaims,faceclaims_entry,faceclaims_empty";
require "./global.php";
add_breadcrumb("Face Claim Listing", "faceclaims.php");


$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 (#,#,#,#)
	ORDER BY username ASC
");
// WHERE ".TABLE_PREFIX."users.usergroup IN (#,#,#,#)
// ^ # = group id for usergroups you want to show on this listing, if only one group just put a number with no commas
// ORDER BY fid# ASC
// ^ if you don't want to order by username, # = field id for face claim profile field


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['fid#'];
	// fid# = # = field id for face claim profile field
	if(!$users['faceclaim']) {
    }
	else {
	    eval("\$directory .= \"".$templates->get("faceclaims_entry")."\";");
	}
}
if(!$directory) {
    eval("\$directory .= \"".$templates->get("faceclaims_empty")."\";");
}

eval("\$faceclaims = \"".$templates->get("faceclaims")."\";");
output_page($faceclaims);
?>

NOTE(S):

  • Be sure you change all traces of # to the correct ids needed.
    • The file contains // notes for you to follow along to. Please find the notes and edit as suggested.

 

 

Step Two

Create new templates for our listing. Navigate to Admin CP --> Templates & Style --> Templates --> Global Templates --> Add New Template (for each one).

 

Template Name: faceclaims

<html>
	<head>
		<title>{$mybb->settings['bbname']} - Face Claim Listing</title>
		{$headerinclude}
	</head>
	<body>
		{$header}
		
		<table width ="100%" border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}">
			<tr>
				<td colspan="2" class="thead"><strong>Face Claim Listing</strong><input type="text" id="faceSearch" onkeyup="myFunction()" placeholder="Search for a face..." class="float_right" style="box-sizing: border-box; padding: 5px;"></td>
			</tr>
			<tr>
				<td class="tcat" width="50%">Character</td>
				<td class="tcat" width="50%">Face Claim</td>
			</tr>
		</table>
		<table width ="100%" border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" id="faceTable">
			{$directory}
		</table>
		
		{$footer}
		<script>
			function myFunction() {
			var input, filter, table, tr, td, i;
			input = document.getElementById("faceSearch");
			filter = input.value.toUpperCase();
			table = document.getElementById("faceTable");
			tr = table.getElementsByTagName("tr");
			for (i = 0; i < tr.length; i++) {
				td = tr[i].getElementsByTagName("td")[2];
				if (td) {
					if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
						tr[i].style.display = "";
						}
					else {
						tr[i].style.display = "none";
						}
					}       
				}
			}
		</script>
		<!--
				FILTER TABLE SCRIPT BY W3SCHOOLS
				https://www.w3schools.com/howto/howto_js_filter_table.asp
		-->
	</body>
</html>

 

Template Name: faceclaims_entry

<tr>
	<td class="trow1" width="50px">
		<a href="{$users['profilelink']}">
			<img src="{$users['avatar']}" onerror="this.onerror=null;this.src='/images/default_avatar.png';" width="50px" height="50px" style="border-radius: 50%;" />
		</a>
		<!-- You may have to change the default avatar file name/type. Depending on your default avatar URL. -->
	</td>
	<td class="trow1">
		<a href="/member.php?action=profile&amp;uid={$users['profilelink']}">
			{$users['username']}
		</a>
	</td>
	<td class="trow1" width="50%">
		{$users['faceclaim']}
	</td>
</tr>

NOTE(S):

  • Ensure that the onerror part of the avatar links to the correct default avatar URL for your board.

 

Template Name: faceclaims_empty

<tr>
	<td class="trow1" colspan="2" align="center">
		<i>There are currently no characters with face claims applicable. Please check back at a later date.</i>
	</td>
</tr>

 




User Feedback

Create an account or sign in to leave a review

You need to be a member in order to leave a review

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

There are no reviews to display.


×

Important Information

By using this site, you agree to our Terms of Use, Guidelines and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.