News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Display Additional Membergroups on Profile

Started by vbgamer45, January 09, 2007, 10:16:18 PM

Previous topic - Next topic

petesky

I know what you mean but you have to search for the correct position. My text editor can do this very fast and i don't know if dreamweaver is the ideal programmers tool editing PHP files :-) So don't worry about; if you have any questions please let me know.

Fiery

Quote from: petesky on November 10, 2010, 10:10:47 AM
I don't have RC3 because i recently updated to RC4.
I assume, that my single line change now also works on RC3 as expected now.
Just install the orginal mod from the author and replace in /sources/load.php :

// Get any additional membergroups to show on their profile.
if (!empty($new_loaded_ids) && $set === 'profile'


with

// Get any additional membergroups to show on their profile.
if (!empty($new_loaded_ids[0]) && !empty($user_profile[$new_loaded_ids[0]]['additional_groups']) && $set === 'profile')


Hello,

I just installed the newer version, your modification appears to be a bit different then mine:

        // Get any additional membergroups to show on their profile.
        $user_profile[$new_loaded_ids[0]]['list_additional_groups'] = cache_quick_get('membergroup_list_' . $new_loaded_ids[0], 'Subs-Membergroups.php', 'cache_getMembergroupListForProfile', array($user_profile[$new_loaded_ids[0]]['additional_groups']));


Would I just need to add in
if (!empty($new_loaded_ids[0]) && !empty at the beginning

and

&& $set === 'profile' after ['additional_groups'])?

petesky

#82
The three lines should be finally:

// Get any additional membergroups to show on their profile.
if (!empty($new_loaded_ids[0]) && !empty($user_profile[$new_loaded_ids[0]]['additional_groups']) && $set === 'profile')
$user_profile[$new_loaded_ids[0]]['list_additional_groups'] = cache_quick_get('membergroup_list_' . $new_loaded_ids[0], 'Subs-Membergroups.php', 'cache_getMembergroupListForProfile', array($user_profile[$new_loaded_ids[0]]['additional_groups']));


...but i can't see the difference  :o

In the original mod the lines are as follow..

if (!empty($...
// Get any ...
$user_profile[...

The comment is between the if and the variable which is not so good readable - so i changed only the comment to the top.

Fiery


David8

Can we expect a new version that fixes this bug?  It is a total show-stopper without the patches.

hcfwesker

Will this also display extrra groups in the on the display page for posts/messages?

I have group titles removed from the display template, but have it where group images show, and would like those displyed.

Fiery

Hello,

I am getting tons of: 8: Undefined index:  list_additional_groups errors

The line that is reported as causing the issues is:

'list_additional_groups' => $profile['list_additional_groups'],

I currently have the following in the same file, but it doenst seem to fix the issue.

// Loads an array of users' data by ID or member_name.
function loadMemberData($users, $is_name = false, $set = 'normal')
{
global $user_profile, $modSettings, $board_info, $smcFunc, $list_additional_groups;



Any ideas?

live627

While I respect those who want to help mod authors out, that attached package is incomplete. Programming an application is complicated: if a fix isn't applied right, something else breaks.

So uninstall it and get the new package I just uploaded.

! Would generate database error when trying to view a member's profile when given member had no additional groups

(petesky can you remove your attached package to avoid confusion?)

Fiery

Quote from: Fiery on February 09, 2011, 02:54:49 AM
Hello,

I am getting tons of: 8: Undefined index:  list_additional_groups errors

The line that is reported as causing the issues is:

'list_additional_groups' => $profile['list_additional_groups'],

I currently have the following in the same file, but it doenst seem to fix the issue.

// Loads an array of users' data by ID or member_name.
function loadMemberData($users, $is_name = false, $set = 'normal')
{
global $user_profile, $modSettings, $board_info, $smcFunc, $list_additional_groups;



Any ideas?

Anyone?

Yngwiedis

Quote from: Fiery on March 19, 2011, 04:10:34 PM
Quote from: Fiery on February 09, 2011, 02:54:49 AM
Hello,

I am getting tons of: 8: Undefined index:  list_additional_groups errors

The line that is reported as causing the issues is:

'list_additional_groups' => $profile['list_additional_groups'],

I currently have the following in the same file, but it doenst seem to fix the issue.

// Loads an array of users' data by ID or member_name.
function loadMemberData($users, $is_name = false, $set = 'normal')
{
global $user_profile, $modSettings, $board_info, $smcFunc, $list_additional_groups;



Any ideas?

Anyone?


I have the exact same problem...
AmityHost.com - The Affordable Host

Yngwiedis

AmityHost.com - The Affordable Host

Yngwiedis

AmityHost.com - The Affordable Host

Yngwiedis

Is there any chance to receive some help here ?
AmityHost.com - The Affordable Host

Yngwiedis

AmityHost.com - The Affordable Host

ascaland

Your probably getting that error because of this snippet,
if (!empty($new_loaded_ids) && $set === 'profile')
// Get any additional membergroups to show on their profile.
$user_profile[$new_loaded_ids[0]]['list_additional_groups'] = cache_quick_get('membergroup_list_' . $new_loaded_ids[0], 'Subs-Membergroups.php', 'cache_getMembergroupListForProfile', array($user_profile[$new_loaded_ids[0]]['additional_groups']));


When loadMemberData() is called, if the $set variable is set to something other than 'profile' $user_profile[$new_loaded_ids[0]]['list_additional_groups'] isnt set to a value. This could explain why your getting errors in places other than where this function is requesting member data other than profile (such as the memberlist).

What you can do as a quick fix is to replace,
'list_additional_groups' => $profile['list_additional_groups'],

With,
'list_additional_groups' => !empty($profile['list_additional_groups']) ? $profile['list_additional_groups'] : '',

So that if $profile (which gets its data from $user_info) didnt have anything set in the list_additional_groups element, it just sets an empty string so your not getting an error.

Yngwiedis

Thank you thank you thank you !!!!
This quick fix vanish all the errors :)

Thank you very very very much.
AmityHost.com - The Affordable Host

ascaland

Quote from: Yngwiedis on April 30, 2011, 05:47:41 PM
Ehmmm...
The problem now is that Additional Membergroups are not displayed in the profile :(

Im not sure if you have any additional edits to the mod from before, but it works fine for me with the latest package (RC5) and the simple edit.

Yngwiedis

I already delete my previous post.
Ignore it :)
AmityHost.com - The Affordable Host

C4G-TK

Quote from: Project Evolution on April 30, 2011, 05:23:45 PM
Your probably getting that error because of this snippet,
if (!empty($new_loaded_ids) && $set === 'profile')
// Get any additional membergroups to show on their profile.
$user_profile[$new_loaded_ids[0]]['list_additional_groups'] = cache_quick_get('membergroup_list_' . $new_loaded_ids[0], 'Subs-Membergroups.php', 'cache_getMembergroupListForProfile', array($user_profile[$new_loaded_ids[0]]['additional_groups']));


When loadMemberData() is called, if the $set variable is set to something other than 'profile' $user_profile[$new_loaded_ids[0]]['list_additional_groups'] isnt set to a value. This could explain why your getting errors in places other than where this function is requesting member data other than profile (such as the memberlist).

What you can do as a quick fix is to replace,
'list_additional_groups' => $profile['list_additional_groups'],

With,
'list_additional_groups' => !empty($profile['list_additional_groups']) ? $profile['list_additional_groups'] : '',

So that if $profile (which gets its data from $user_info) didnt have anything set in the list_additional_groups element, it just sets an empty string so your not getting an error.

I have had no errors in my error log for 3 months.  I installed this mod last night and woke up to 7 pages of that error being pulled in Load.php.  Thanks for the fix/workaround.  My error log thanks you, too. ;)

-img removed-

C4G-TK

I'm only getting one error now.  It happens when someone views a profile.

in Profile.Template.php it occurs on line 124
2: Invalid argument supplied for foreach()

104: </p>';
105:
106: echo '
107: </div>
108: <span class="botslice"><span></span></span>
109: </div>
110: </div>
111: <div id="detailedinfo">
112: <div class="windowbg2">
113: <span class="topslice"><span></span></span>
114: <div class="content">
115: <dl>';
116:
117: if ($context['user']['is_owner'] || $context['user']['is_admin'])
118: echo '
119: <dt>', $txt['username'], ': </dt>
120: <dd>', $context['member']['username'], '</dd>';
121:
122: // If they are assigned to additional membergroups, show them.
123: $x = 1;
==>124: foreach ($context['member']['list_additional_groups'] as $list_additional_group)
125: {
126: echo '
127: <dt>', $txt['position'], ' ', $x, ': </dt>
128: <dd>', $list_additional_group, '</dd>';
129:
130: $x++;
131: }
132:
133:
134: if (!isset($context['disabled_fields']['posts']))
135: echo '
136: <dt>', $txt['profile_posts'], ': </dt>
137: <dd>', $context['member']['posts'], ' (', $context['member']['posts_per_day'], ' ', $txt['posts_per_day'], ')</dd>';
138:
139: // Only show the email address fully if it's not hidden - and we reveal the email.
140: if ($context['member']['show_email'] == 'yes')
141: echo '
142: <dt>', $txt['email'], ': </dt>
143: <dd><a href="', $scripturl, '?action=emailuser;sa=email;uid=', $context['member']['id'], '">', $context['member']['email'], '</a></dd>';
144:



-img removed-

Advertisement: