MyBB Community Forums

Full Version: Group php script
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
(2011-07-07, 08:55 PM)SergeMorel Wrote: [ -> ]This is for a visual basic program, a loader.
I need it as simple as possible, not in a user profile, it's to hard to get.
& I pay nothing :s

Well, to my knowledge, I'm the Visual Basic guru here Toungue I assume you're using vb.NET?

Ok, a question:
- are you trying to gather info from the profile to display in the application?


If so, please reply and I'll help you further. I have done something much like this before Smile
Well, getting it from the user profile, is hard & slow
Yes I use vb.net & I want to display it in a listview
like
username
usergroup
postcount
etc ...

EDIT : getting the script & just split some things would be MUCH faster

EDIT 2 : going to get some sleep, I'll see if you answered tomorrow :p
To be honest I would use XML Smile

Then you can call the specific parameters when you need them:
EG:

<site>
     <user>
          <username>Tom</username>
          <usergroup>Admins</usergroup>
     </user>
</root>

It would be generated by the php, and then you can easily read it in vb.NET using the "system.XML" namespace.

If you want I can work on the code in the morning (it's late here - off to bed Smile)
I can write you this in just a second. I do agree with the above post about XML though - it should be slightly more efficient and certainly more easy to do. Saying that, I haven't used vb.net in a long time now Wink
Well, download the file locally and then read it using System.XML Smile there's plenty of documentation. Type "vb.net read XML" and you get plenty of hits.

Then you should create a php script that outputs the data in an XML form (which I can also help with) Smile
Well, I'll figure the reading XML myself

It's the php part I need help with.
Anyone?
Here you go:

<?php
header ("Content-Type:text/xml"); 
define("IN_MYBB", 1);
require_once "./global.php";

if($mybb->input['uid'])
{
	$user = get_user(intval($mybb->input['uid']));
	$usergroupcache = $cache->read("usergroups");
	
	$doc = new DOMDocument();
	$doc->formatOutput = true;

	$u = $doc->createElement("user");
	$doc->appendChild($u);
	
	$uid = $doc->createElement("uid");
	$uid->appendChild($doc->createTextNode($user['uid']));
	
	$name = $doc->createElement("username");
	$name->appendChild($doc->createTextNode($user['username']));
	
	$usertitle = $doc->createElement("usertitle");
	$usertitle->appendChild($doc->createTextNode($user['usertitle']));
	
	$postcount = $doc->createElement("postcount");
	$postcount->appendChild($doc->createTextNode($user['postnum']));
	
	$usergroup = $doc->createElement("usergroup");
	$usergroup->appendChild($doc->createTextNode($usergroupcache[$user['usergroup']]['title']));
	
	$u->appendChild($uid);
	$u->appendChild($name);
	$u->appendChild($usertitle);
	$u->appendChild($postcount);
	$u->appendChild($usergroup);
	
	echo $doc->saveXML();
}
?>

Works fine for me anyway Smile
Sweet, that works, gives me this output :
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<user>
<uid>1</uid>
<username>SergeMorel</username>
<usertitle>
<img src="/images/usertitles/admin.png" alt="Administrator"/>
</usertitle>
<postcount>29</postcount>
<usergroup>4</usergroup>
</user>

Now, can you make that with username ?
So I do myforum.com/userinfo.php?username=SergeMorel

Because I login in my program & then get the info with their username.
The usergroup number is pretty useless , but whatever.
Is there any other things you can add ?
Like posted threads & stuff.
I can make it use the username no problem Smile I can add just about anything that's stored in the database - just name what you want.
euhm :
Join Date
Total Threads
Post counts (already have)
Online Status
Members Referred
What he/she is doing now on the forum (Can be together with online status)
Last visit (If they didn't visit for 2 days, I want to prevent them using the loader)

& getting it with username
Thanks !!!!!!!!!!
Pages: 1 2 3 4 5