Ok, here are the changes required to be able to allow the user to select if
they want to not be shown in the Random User Block and to also not show
them if they so choose... Sorry it took me so long but I had problems with
getting the options in the profile to work correctly.
God Luck.
Be sure to add the a column to your users table named
Code: Select all
user_showuser VARCHAR(3) NOT NULL default 'off'
This code change limits the result set to include only the users that
want to be seen in the Block.
random_member.php:
In the section with your SQL, add this to the existing WHERE clause
(on the line before the ORDER BY:
And, if you want to limit to only users with > 5 posts, add this to the
WHERE clause:
I'll look into how to limit to only users that have logged in in the last month.
Now, to add the option for the user to select if they want to be seen
in the Random User block, make these changes:
language/<lang>/common.php
Code: Select all
$lang = array_merge($lang, array(
<!- SNIPPED CODE -->
'SETTINGS' => 'Settings',
'SHOWUSER' => 'Show In Random User Block',
<!- SNIPPED CODE -->
));
includes/ucp/ucp_main:
Code: Select all
$template->assign_vars(array(
'USER_COLOR' => (!empty($user->data['user_colour'])) ? $user->data['user_colour'] : '',
<!- SNIPPED CODE -->
'SHOWUSER' => ($user->data['user_showuser'] == 'on' ? 'checked="checked"' : '')
));
includes/ucp/ucp_profile:
Code: Select all
$data = array(
'icq' => request_var('icq', $user->data['user_icq']),
<!- SNIPPED CODE -->
'showuser' => utf8_normalize_nfc(request_var('showuser', 'off')),
);
<!- SNIPPED CODE -->
if ($submit)
{
$validate_array = array(
'icq' => array(
array('string', true, 3, 15),
array('match', true, '#^[0-9]+$#i')),
<!- SNIPPED CODE -->
'showuser' => array('string', true, 2, 3),
); );
<!- SNIPPED CODE -->
'showuser' => utf8_normalize_nfc(request_var('showuser', 'off')),
<!- SNIPPED CODE -->
$sql_ary = array(
'user_icq' => $data['icq'],
<!- SNIPPED CODE -->
'user_showuser' => $data['showuser']
);
<!- SNIPPED CODE -->
$template->assign_vars(array(
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
<!- SNIPPED CODE -->
'SHOWUSER' => (($data['showuser'] =='on') ? 'checked="checked"' : ''),
));
styles/<style>/template/ucp_profile_profile_info.html:
Code: Select all
<tr>
<td class="row1" width="35%"><b class="genmed">{L_SHOWUSER}: </b></td>
<td class="row2"><input type="checkbox" class="radio" name="showuser" value="on" {SHOWUSER}/></td>
</tr>