News:

Wondering if this will always be free?  See why free is better.

Main Menu

Display additional membergroups in the post

Started by Zockaaa, March 29, 2010, 08:04:02 PM

Previous topic - Next topic

Zockaaa

Hi All!
I have some trouble with this mod and decided to open a new thread instead of using the old one.
Well, the mod works well, but how can I display additional membergroups in the Post, not only in the profile.
I tried some things, I just entered this code into the Display.template.php:
// Show other primary Groups
foreach ($message['member']['additionalGroups2'] as $additionalGroup)
{
// Output this membergroup
echo '
', $additionalGroup, '<br />';
}

I also tried with $context and $profile, but it didn't work. The variable additionalGroups2 could not be found here. What files do I need to modify, so this will work?
Have fun,

Zockaaa

Arantor

But you should use the mod's dedicated thread. The maintainer won't see it here...
Holder of controversial views, all of which my own.


Zockaaa

The topic does actually not refer directly to this mod (because the original mod works well), it is just based on it. If the moderation thinks that it should be posted in the old thread, they can write me a PM.
The bigger problem is, that the old topic is marked as solved.

Kill Em All

It would probably be best to ask in the mod's dedicated support topic like Arantor suggested. But I would imagine that if you put this code:

// Begin modification - Additional membergroups on profile
$x = 1;
// Loop through each additional group
foreach ($context['member']['additionalGroups2'] as $additionalGroup)
{
// Add one to our counter
$x++;
// Output this membergroup
echo '
<tr>
<td><b>', $txt[87], ' ', $x, ': </b></td>
<td>', $additionalGroup, '</td>
</tr>';
}
// End modification


in the appropriate place in the Display.template.php located in your themes directory, it might work. If not, you should probably ask the mod author for some help as I'm sure they know the solution...


My Site: KEAGaming.com

Manual Installation of Mods
Prevent Spam and Forum Attacks
Please do not PM or email me for support unless offered, help should be publicly displayed to others.

Arantor

Or not, because the data for $context['member']['additionalGroups2'] isn't loaded there... and the original mod's code is where this will be located...
Holder of controversial views, all of which my own.


Zockaaa

Quote from: Arantor on March 30, 2010, 05:22:05 AM
Or not, because the data for $context['member']['additionalGroups2'] isn't loaded there... and the original mod's code is where this will be located...
Exactely, that is the problem. How to solve it? I will contact the mod's author soon, lets see if he can help me.

If I am sucessfull, I might add it to the mod (if the author has no problems with it).

Arantor

So did you look at the changes made by that mod and where they were added, and in fact what they were actually doing?
Holder of controversial views, all of which my own.


Zockaaa

Yes I did long before (even before I opened this thread). I think the problem is in the array of Load.php

// Begin modification - Additional membergroups on profile
'additionalGroups2' => $profile['additionalGroups2'],
// End modification

This is what the mod adds to the array, maybe something else has to be added?

Arantor

Did you look at the *other* bit, like the edit to Load.php... you know, where the data is loaded from the database...?
Holder of controversial views, all of which my own.


Zockaaa

#9
Load.php edit...
// Begin modification - Additional membergroups on profile
// Let's start with an empty array
$user_profile[$row['ID_MEMBER']]['additionalGroups2'] = array();

// Any additional membergroups for this user?
if (isset($row['additionalGroups']) && $row['additionalGroups'] != '')
{
// There is? Great! Get the names of the groups
$result_groups = db_query("
SELECT groupName
FROM {$db_prefix}membergroups
WHERE ID_GROUP IN (" . $row['additionalGroups'] . ')
ORDER BY groupName ASC', __FILE__, __LINE__);

// Loop through all the groups...
while ($row_groups = mysql_fetch_assoc($result_groups))
// ... and add them to the user's list
$user_profile[$row['ID_MEMBER']]['additionalGroups2'][] = $row_groups['groupName'];

mysql_free_result($result_groups);
}
// End modification


Could I need another array after this?$user_profile[$row['ID_MEMBER']]['additionalGroups2'][] = $row_groups['groupName'];

Something like...$message[$row['ID_MEMBER']]['additionalGroups2'][] = $row_groups['groupName'];

And - of course - a new empty array at start?
... didn't work. Also tried with $context. Other suggestions?

Arantor

You're trying to run before you're walking at this point.

So, we have a bunch of code that loads the data. It's loading it for the profile, it deliberately doesn't load it in the display view because of the significant performance hit that is entailed if you're not careful.

There is a good reason I directed you to the mod's author in the first instance...
Holder of controversial views, all of which my own.


Advertisement: