Can I cram this code from boardindextemplate.php into memberlist.php?

Started by Random Username, February 05, 2023, 04:02:14 PM

Previous topic - Next topic

Random Username

Just want to have the membergroup legend display at bottom of memberlist....

// Showing membergroups?
if (!empty($settings['show_group_key']) && !empty($context['membergroups']))
echo '
<span class="membergroups">' . implode(', ', $context['membergroups']) . '</span>';
}

Diego Andrés

Would first need to have that information available in the memberlist action.

Sources/Memberlist.php
Code (Search) Select
global $scripturl, $txt, $modSettings, $context;

// Make sure they can view the memberlist.
isAllowedTo('view_mlist');

loadTemplate('Memberlist');

Code (Replace) Select
global $scripturl, $txt, $modSettings, $context, $settings;

// Make sure they can view the memberlist.
isAllowedTo('view_mlist');

loadTemplate('Memberlist');

// Are we showing all membergroups on the board index?
if (!empty($settings['show_group_key']))
$context['membergroups'] = cache_quick_get('membergroup_list', 'Subs-Membergroups.php', 'cache_getMembergroupList', array());


Memberlist.template.php
Code (Search) Select
// If it is displaying the result of a search show a "search again" link to edit their criteria.
if (isset($context['old_search']))
echo '
<div class="buttonlist floatright">
<a class="button" href="', $scripturl, '?action=mlist;sa=search;search=', $context['old_search_value'], '">', $txt['mlist_search_again'], '</a>
</div>';
echo '
</div>
</div><!-- #memberlist -->';
Code (Replace) Select
// If it is displaying the result of a search show a "search again" link to edit their criteria.
if (isset($context['old_search']))
echo '
<div class="buttonlist floatright">
<a class="button" href="', $scripturl, '?action=mlist;sa=search;search=', $context['old_search_value'], '">', $txt['mlist_search_again'], '</a>
</div>';
echo '
</div>
</div><!-- #memberlist -->';

// Showing membergroups?
if (!empty($settings['show_group_key']) && !empty($context['membergroups']))
echo '
<span class="membergroups">' . implode(', ', $context['membergroups']) . '</span>';

SMF Tricks - Free & Premium Responsive Themes for SMF.


Random Username

I don't suppose you could tell me how to achieve the same result on the edit buddies page? ;)

Diego Andrés

Well I'm don't have a setup to test right now but it would be similar.

Sources/Profile-Modify.php
Code (Search) Select
global $context, $txt, $modSettings;

// Do a quick check to ensure people aren't getting here illegally!
if (!$context['user']['is_owner'] || empty($modSettings['enable_buddylist']))
fatal_lang_error('no_access', false);
Code (Replace) Select
global $context, $txt, $modSettings, $settings;

// Do a quick check to ensure people aren't getting here illegally!
if (!$context['user']['is_owner'] || empty($modSettings['enable_buddylist']))
fatal_lang_error('no_access', false);

// Are we showing all membergroups on the board index?
if (!empty($settings['show_group_key']))
$context['membergroups'] = cache_quick_get('membergroup_list', 'Subs-Membergroups.php', 'cache_getMembergroupList', array());

And since I can't test it right now, I'm not entirely sure but perhaps it would be in Themes/{default_or_yourtheme}/Profile.template.php

Code (Search) Select
function template_editBuddies()
{
global $context, $scripturl, $txt;
Code (Replace) Select
function template_editBuddies()
{
global $context, $scripturl, $txt, $settings;

Code (Search) Select
<script>
var oAddBuddySuggest = new smc_AutoSuggest({
sSelf: \'oAddBuddySuggest\',
sSessionId: smf_session_id,
sSessionVar: smf_session_var,
sSuggestId: \'new_buddy\',
sControlId: \'new_buddy\',
sSearchType: \'member\',
sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
bItemList: false
});
</script>';
Code (Replace) Select
<script>
var oAddBuddySuggest = new smc_AutoSuggest({
sSelf: \'oAddBuddySuggest\',
sSessionId: smf_session_id,
sSessionVar: smf_session_var,
sSuggestId: \'new_buddy\',
sControlId: \'new_buddy\',
sSearchType: \'member\',
sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
bItemList: false
});
</script>';

// Showing membergroups?
if (!empty($settings['show_group_key']) && !empty($context['membergroups']))
echo '
<span class="membergroups">' . implode(', ', $context['membergroups']) . '</span>';

SMF Tricks - Free & Premium Responsive Themes for SMF.

Advertisement: