TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 455
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 260
  • Total: 260

Custom Memberslist

Started by fenris_w0lf, January 31, 2006, 01:54:13 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

fenris_w0lf

aha...

so in a php u can have:

function A()
    blabla
    function B

function B()
    moreblabla


and A will call and excecute B ?

Anyways, In my AFKMemberlist.php I changed the :


// Load all the members for display.
AFKloadMemberData($members);


to

// Load all the members for display.
AFKloadMemberData($members);


and added my version of that function with this change:


if ($set == 'normal')
{
$select_columns = "
IFNULL(lo.logTime, 0) AS isOnline, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType,

mem.rank_aok, mem.rank_aoe3,

mem.signature, mem.personalText, mem.location, mem.gender, mem.avatar, mem.ID_MEMBER, mem.memberName,
mem.realName, mem.emailAddress, mem.hideEmail, mem.dateRegistered, mem.websiteTitle, mem.websiteUrl,
mem.birthdate, mem.memberIP, mem.ICQ, mem.AIM, mem.YIM, mem.MSN, mem.posts, mem.lastLogin,
mem.karmaGood, mem.ID_POST_GROUP, mem.karmaBad, mem.lngfile, mem.ID_GROUP, mem.timeOffset, mem.showOnline,
mem.buddy_list, mg.onlineColor AS member_group_color, IFNULL(mg.groupName, '') AS member_group,
pg.onlineColor AS post_group_color, IFNULL(pg.groupName, '') AS post_group,
IF(mem.ID_GROUP = 0 OR mg.stars = '', pg.stars, mg.stars) AS stars" . (!empty($modSettings['titlesEnable']) ? ',
mem.usertitle' : '');
$select_tables = "
LEFT JOIN {$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}membergroups AS pg ON (pg.ID_GROUP = mem.ID_POST_GROUP)
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = mem.ID_GROUP)";
}



notice the extra line with the two custom fields.

But...hmm...no values gets displayed in that url I pm'd you... hmmmm

Rasyr

I am a very big newb when it comes to SQL, especially things as complex as that one seems to be (I have no idea at all about JOINs), so I am about at the end of the help that I can give.

fenris_w0lf

#12
Well, Im pretty good with SQL and i believe this SQL code is just fine.

You see I've added:

mem.rank_aok, mem.rank_aoe3,

the phrase "mem" is just an alias for smf_members and the "rank_aok" and "rank_aoe3" is two of the custom columns (I've later added "mem.afk_picture" but that didnt help either)

So...I've come to conclude that its either:

-------------------------------------------
1) the order of the fields is imperative

or

2) adding the function like that is problematic (I get no errors tho)

or

3) for some odd reason the if/else clause: "if ($set == 'normal')" doesnt "gets filled"

or

4) something we've overlooked.....  ;D
-------------------------------------------

I also found this one:

http://www.simplemachines.org/community/index.php?topic=22260.msg177889#msg177889

Its in french tho, but it seems we're on the right track.

The problem is if the order of the fields is important. I'm not sure how to verify that :(

The SQL is now:

Quote
if ($set == 'normal')
   {
      $select_columns = "
         IFNULL(lo.logTime, 0) AS isOnline, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType,
         mem.rank_aok, mem.rank_aoe3, mem.afk_picture, mem.signature, mem.personalText, mem.location, mem.gender, mem.avatar, mem.ID_MEMBER, mem.memberName,
         mem.realName, mem.emailAddress, mem.hideEmail, mem.dateRegistered, mem.websiteTitle, mem.websiteUrl,
         mem.birthdate, mem.memberIP, mem.ICQ, mem.AIM, mem.YIM, mem.MSN, mem.posts, mem.lastLogin,
         mem.karmaGood, mem.ID_POST_GROUP, mem.karmaBad, mem.lngfile, mem.ID_GROUP, mem.timeOffset, mem.showOnline,
         mem.buddy_list, mg.onlineColor AS member_group_color, IFNULL(mg.groupName, '') AS member_group,
         pg.onlineColor AS post_group_color, IFNULL(pg.groupName, '') AS post_group,
         IF(mem.ID_GROUP = 0 OR mg.stars = '', pg.stars, mg.stars) AS stars" . (!empty($modSettings['titlesEnable']) ? ',
         mem.usertitle' : '');
      $select_tables = "
         LEFT JOIN {$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)
         LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = mem.ID_MEMBER)
         LEFT JOIN {$db_prefix}membergroups AS pg ON (pg.ID_GROUP = mem.ID_POST_GROUP)
         LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = mem.ID_GROUP)";
   }


Getting this to work would be awesome, opens up for "modding" without modding anything else than index.html !!!

Rasyr

My suggestion would be to study what the function is actually doing. Then, as Bloc suggested to me for something or other that I was trying to do, strip it down to the bare essentials of what you need. You know what you want it in. You have both a simple (what I wrote gave you) and a complex (the SMF Memberlist) example of various ways of doing this.

Since you are making a custom mod, then don't worry too much about creating an extra page or two.

Sit down and decide what you need to get what you want, and then design it to grab the information that you need, and only the information you need.

That SQL call is far beyond my skills at the moment, so I am not sure how much help I am going to be from this point.

fenris_w0lf

Yeah, you're probably right. It'll take soooo much longer tho. On the bright-side I'll prolly learn LOTS !!! :)

Thanks for your help Rasyr!!

fenris_w0lf

hmmm...I had another look at this one:

http://www.simplemachines.org/community/index.php?topic=22260.msg177889#msg177889

and...well..take a look at the third "recherche:" and "remplace avec:"  (both code blocks start with "// Select the members from the database.")

I cant seem to find this anywhere in my files !!?? Is this due to me running:

SMF 1.1 RC1.
Oxygen / TinyPortal v.0.75 by Bloc

??

Rasyr

Your version of TinyPortal will have nothing to do with it, however, your version of SMF most likely does have something to do with it.

The date on that post you linked to is Dec 25, 2004. That, IIRC, was before 1.1 RC1 was released, and is most likely for either 1.05 or the 1.1 Beta3 version.


fenris_w0lf

Ah, that explains it. So I've actually got a newer version !!! weeeeeeee  ;)

This website is proudly hosted on Crocweb Cloud Website Hosting.