MyBB Community Forums

Full Version: Unusual Request
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I know you guys want us to request mods that will benefit everyone, but I just can't seem to wrap myself around this mod that I've been trying to do in the past week. I *think* it's easy to do, but haven't gotten anywheres with it. Here's what I want to do...

Create a new field in the registration called "Tracker ID". In that field, it will have a variable of lets say $tuid. In that tracker field, whatever their "Tracker ID" is, it will take that and I will put this in the postbit:

<a href="http://aaotracker.4players.de/usertracker.php?userid=$tuid><img border=0 src=http://aaotracker.4players.de/trackericon.php?userid=$tuid&style=6></a>

If done correctly, that site will automatically parse the tracker ID placed on the tracker field and will show an image of you either online or offline playing a game. (Keep the "style=6" part as it's the style of offline and online I like).

This would then be also available to be edited via the user cp and possibly a field in the admin cp too. I just hope may be someone can put a little time into this? I'm completely not going anywheres with it.

If you're not quite sure what I meant about taking the tracker field and placing it on the URL above, then please download the file below. Upload it to a server and you'll see that there is going to be a small red icon saying "offline" or green saying "online" depending if that person is playing. With that, it took the '$tuid' value and placed it on the URL, which then parsed and it gave you an image.

Would be nice too if you could incorporate a "default" type thing, but I feel I'm asking a lot already.
What exactly do you want us to do?
I have a bit here, but it can be possible it doesn't work exactly. I haven't tested (lack of time). But I'll update my post later.

We have to insert the piece of code you wanted in the postbit?
Let's say you have already added the filed in the table mybb_users. You better rename the field in tuid (just to make it easier)
Adding it to the postbit can easily be done with adding this string in the template postbit_away.
<br><a href="http://aaotracker.4players.de/usertracker.php?userid=$post[tuid]><img border=0 src=http://aaotracker.4players.de/trackericon.php?userid=$post[tuid]&style=6></a>
Then it'll appear under the status. This is not the same as your code

And make a section in the UserCP?
This will come later

But what do you mean with a section in the AdminCP?
I won't add the "default" type thing, because some users may not have the game and they would be offline all the time.

Forget all this, I'm working on it right now and it will be as you wanted Smile
Not sure what you want to do =/
Ok, I have managed to do what you asked.
I did not add the default picture (because there is no picture shown when there is no tuid)

You may want to change some stuff to your own language, I don't care about that.
You may change some strings like "Game Tracker User ID" to whatever you want. I used that name for the tracker thing you wanted.
I advise to use a program like Frontpage or Dreamweaver to edit the files.

Doesn't work at the moment. It doesn't show the image when I do it. I'm going to look over my edits again and edit this post if I find anything wrong...my god, you really gave this an effort, and I commend that Big Grin. Thanks bud

EDIT: Ok, it was my fault. After carefully reading the whole instructions file again, I noticed that the eval code asked for a "postbit_tuid" template and I just made a template called "tuid" and thats why it wouldn't show the images. Thanks a bunch! You're l33t in my library. You get two good reps from me :mrgreen:

EDIT #2: I found a way to give them a default if they don't have a tracker ID

find:

$queryb = $db->query("SELECT tuid FROM ".TABLE_PREFIX."users WHERE 

uid='$post[uid]'");
		$usert = $db->fetch_array($queryb);
		if($usert['tuid'])
		{
			$user[tuid] = $usert['tuid'];
			eval("\\$tuid = \\"".$templates->get("postbit_tuid")."\\";");
		}

add below:

else
		{
		eval("\\$tuid = \\"".$templates->get("postbit_tuid_noid")."\\";");
		}

Make a new template called "postbit_tuid_noid" and just put in n/a or an image you want.

Edit #3: Oh yeah...I just realized, I asked in my first post if there could be a field in the registration for this. hmmm...it'd be nice, but this seems to work pretty nice I must say.
Well, I don't care if you added the default image. You're free to edit everything you want in this mod.
Cory Wrote:Edit #3: Oh yeah...I just realized, I asked in my first post if there could be a field in the registration for this. hmmm...it'd be nice, but this seems to work pretty nice I must say.
Oh, sorry. I forgot that one.
Open member.php and find:
		$db->query("INSERT INTO ".TABLE_PREFIX."users (uid,username,password,email,usergroup,regdate,lastactive,lastvisit,website,icq,aim,yahoo,msn,birthday,allownotices,hideemail,emailnotify,invisible,style,timezone,threadmode,receivepms,pmpopup,daysprune,regip,showcodebuttons $queryad $queryad2 $queryad3) VALUES (NULL,'$username','$md5password','$email','$usergroup','$timenow','$timenow','$timenow','$website','$icq','$aim','$yahoo','$msn','$bday','$allownotices','$hideemail','$emailnotify','$invisible','$style','$timezoneoffset','$threadmode','$receivepms','$pmpopup','$daysprune','$ipaddress','1' $queryadd $queryadd2 $queryadd3)");
replace it with:
		$db->query("INSERT INTO ".TABLE_PREFIX."users (uid,username,password,email,usergroup,regdate,lastactive,lastvisit,website,icq,aim,yahoo,msn,tuid,birthday,allownotices,hideemail,emailnotify,invisible,style,timezone,threadmode,receivepms,pmpopup,daysprune,regip,showcodebuttons $queryad $queryad2 $queryad3) VALUES (NULL,'$username','$md5password','$email','$usergroup','$timenow','$timenow','$timenow','$website','$icq','$aim','$yahoo','$msn','$tuid','$bday','$allownotices','$hideemail','$emailnotify','$invisible','$style','$timezoneoffset','$threadmode','$receivepms','$pmpopup','$daysprune','$ipaddress','1' $queryadd $queryadd2 $queryadd3)");
Find:
		else
		{
			$referrer = "";
		}
and after it, add:
		// Game Tracker User ID
		eval("\\$tuid = \\"".$templates->get("member_register_tuid")."\\";");
Add a template called member_register_tuid in Default Templates(!) with this code:
<br />
<fieldset class="trow2">
<legend><strong>[b]"Game tracker User ID"[/b]</strong></legend>
<table cellspacing="0" cellpadding="$theme[tablespace]">
<tr>
<td><span class="smalltext">[b]"Enter your Game Tracker User ID"[/b]</span></td>
</tr>
<tr>
<td>
<input type="text" name="tuid" />
</td>
</tr></table>
</fieldset>
<br />
Then open the template member_register (under the template set "Member Templates"), find $requiredfields and after it, add $tuid.
This should work Smile
EDIT: sorry for the messed up table in this post
thank you very much. Works like a charm. It's EXACTLY how I imagined it to work. thank you again.