Uutiset:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu
Advertisement:

Add data to $message['member']

Aloittaja madzilla, tammikuu 27, 2014, 03:01:23 IP

« edellinen - seuraava »

madzilla

Hello all,

I need to add another variable to the $message['member'] array. This will either be a 0 or 1 based on a query to another table to check for a custom status for each user. Could someone point me in the right direction as to where I can find it? I can't seem to locate where the array is being populated.

Thanks!

Arantor

It's populated by $memberContext, which in turn is populated by loadMemberContext() in Load.php, which in turn itself is populated by loadMemberData() also in Load.php.

Changing it is not a good idea without a serious amount of due care and caution. What do you need to add?
Holder of controversial views, all of which my own.


madzilla

We've got a feature that allows users to donate the site for certain perks and are looking for a way to highlight these users.  That data is stored in a non-SFM table.

Another option would be to add them to a new membergroup. I'm thinking that this may be a better approach as I could simply customize the template and not make any core SMF modifications. Thoughts?

Arantor

That would certainly be easier... or even use paid subscriptions to automate it ;)
Holder of controversial views, all of which my own.


madzilla

Quick follow up...

I've created our new membergroup and have updated the template to show our "flair" for these users. This is working well for normal users but I also have a few Administrators who need to be in this usergroup. When I add the new group as an additional group, I don't see any mention of it in the $message['member'] array. Only Primary group is listed there. Any suggestions on how to handle this?

Arantor

Additional groups do not get loaded for the topic display, there's no reason for them to be because there's no ability to display them anyway.

And it's not a simple table join because additional groups are stored as a text column in the members table with commas between the groups which can't be converted to a table join >_<
Holder of controversial views, all of which my own.


margarett

Although there are MODs to do that, currently none in our modsite IIRC.
https://github.com/MissAllSunday/showCustomMembergroups
(and probably others out there)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Advertisement: