News:

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

Main Menu

How to disable Avatar usage?

Started by PLAYBOY, October 20, 2011, 03:07:43 PM

Previous topic - Next topic

PLAYBOY

I dont want my regular members to use any avatar. I know i can disable avatar uploading options from permissions but that doesnt take off the avatars they already use.

So i want to set one membergroup not being able to use any avatar at all. This includes taking off their current avatars also.

How can i do that?

kat

If I send you to Admin>Attachments and Avatars>Avatar settings, I think you can figure the rest out... ;)

PLAYBOY

I tried. But these settings are same of the permission settings. They dont take down the current avatars in use.

kat

So, go to their profiles and remove them. :)

Illori

there is no way to remove existing avatars/signatures etc if they are in place you would need to manually remove them or create a query to do the job for you.

PLAYBOY

I need to go to each profile and remove the avatars??? Thas ridiculous!

Hasnt anybody asked for this before? Isnt there any mod, code, trick whatever?

kat

Quote from: Illori on October 20, 2011, 03:41:50 PMcreate a query to do the job for you.

You do that in phpmyadmin.

No idea how, though. :(

Why not just tell your members to remove them?

Illori

if you have removed the permission to add them, i believe you have removed your members ability to remove them as well

Kays

I think this might do it. In Load/php look for:


'avatar' => array(
'name' => $profile['avatar'],
'image' => $profile['avatar'] == '' ? ($profile['id_attach'] > 0 ? '<img class="avatar" src="' . (empty($profile['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $profile['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $profile['filename']) . '" alt="" />' : '') : (stristr($profile['avatar'], 'http://') ? '<img class="avatar" src="' . $profile['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" />' : '<img class="avatar" src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($profile['avatar']) . '" alt="" />'),
'href' => $profile['avatar'] == '' ? ($profile['id_attach'] > 0 ? (empty($profile['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $profile['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $profile['filename']) : '') : (stristr($profile['avatar'], 'http://') ? $profile['avatar'] : $modSettings['avatar_url'] . '/' . $profile['avatar']),
'url' => $profile['avatar'] == '' ? '' : (stristr($profile['avatar'], 'http://') ? $profile['avatar'] : $modSettings['avatar_url'] . '/' . $profile['avatar'])


And change it to:


'avatar' => array(
'name' => '',
'image' => '',
'href' => '',
'url' => '',


Then all member's avatars won't show. Including yours. :P

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

PLAYBOY

Quote from: K@ on October 20, 2011, 03:58:22 PM
Quote from: Illori on October 20, 2011, 03:41:50 PMcreate a query to do the job for you.

You do that in phpmyadmin.

No idea how, though. :(

Why not just tell your members to remove them?

They are not gonna just listen to me and do what i say. We are talking about thousands of people.

Quote from: Illori on October 20, 2011, 04:01:11 PM
if you have removed the permission to add them, i believe you have removed your members ability to remove them as well

No i havent. I just wish there was an option to prevent them using an avatar.

Quote from: Kays on October 20, 2011, 04:04:10 PM
I think this might do it. In Load/php look for:


'avatar' => array(
'name' => $profile['avatar'],
'image' => $profile['avatar'] == '' ? ($profile['id_attach'] > 0 ? '<img class="avatar" src="' . (empty($profile['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $profile['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $profile['filename']) . '" alt="" />' : '') : (stristr($profile['avatar'], 'http://') ? '<img class="avatar" src="' . $profile['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" />' : '<img class="avatar" src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($profile['avatar']) . '" alt="" />'),
'href' => $profile['avatar'] == '' ? ($profile['id_attach'] > 0 ? (empty($profile['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $profile['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $profile['filename']) : '') : (stristr($profile['avatar'], 'http://') ? $profile['avatar'] : $modSettings['avatar_url'] . '/' . $profile['avatar']),
'url' => $profile['avatar'] == '' ? '' : (stristr($profile['avatar'], 'http://') ? $profile['avatar'] : $modSettings['avatar_url'] . '/' . $profile['avatar'])


And change it to:


'avatar' => array(
'name' => '',
'image' => '',
'href' => '',
'url' => '',


Then all member's avatars won't show. Including yours. :P


Thx. But i want to have an avatar. Plus some membergroups should have an avatar. So basically, using an avatar should be a privilege which not every member have it.

Kays

Then there's no easy way. Since you'll need to find wherever the avatar is shown in the various files, either Sources or theme, and to add a conditional.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

kat

Quote from: PLAYBOY on October 20, 2011, 03:49:14 PMThas ridiculous!
Hasnt anybody asked for this before?

Nope. Not once.

PLAYBOY

Quote from: K@ on October 20, 2011, 04:45:35 PM
Quote from: PLAYBOY on October 20, 2011, 03:49:14 PMThas ridiculous!
Hasnt anybody asked for this before?

Nope. Not once.

Wow. Do you guys (the team) think something like this could be added to the next update?
Because i think you all will agree that it is a useful option which should be in the default (permission) settings.

Illori

if it where to be added it would possibly be a feature for 2.1, not a feature for 2.0 as it is feature locked.

kat

I seriously doubt anyone would use it.

Well, except you. ;)

Most people set those permissions when they install the forum.

PLAYBOY

Cmon guys. There are many option many people never use.
There are few options i dont even know what are they for. So this may not be a very useful and important option but it will definitely fill a gap.

At least, having a mod for this would be very helpful too.

Illori

then you can make a mod request in the proper board

Kays

It took a bit of doing, but I think that this should work.

in Load.php look for:


if ($set == 'normal')
{
$select_columns = '
IFNULL(lo.log_time, 0) AS is_online, IFNULL(a.id_attach, 0) AS id_attach, a.filename, a.attachment_type,


And add at the end of the last line


mem.additional_groups,


Then look for:


// First do a quick run through to make sure there is something to be shown.
$memberContext[$user]['has_messenger'] = false;


And add before it:


$avatar_groups = array(1,24);
$all_groups = explode(',', $profile['additional_groups']);
$all_groups[] = $profile['id_group'];
$all_groups[] = $profile['id_post_group'];
$check = false;

foreach ($avatar_groups as $group)
if (in_array($group, $all_groups))
{
$check = true;
break;
}

if ($check == false)
{
$memberContext[$user]['avatar']['name'] = '';
$memberContext[$user]['avatar']['image'] = '';
$memberContext[$user]['avatar']['href'] = '';
$memberContext[$user]['avatar']['url'] = '';
}


In the first line add the member groups for which you want the avatars to show. Comma separated.

In my testing, the only place it won't disappear it it is at the top of the page. Where only the member can view it.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

PLAYBOY

Quote from: Kays on October 20, 2011, 08:19:41 PM
It took a bit of doing, but I think that this should work.

in Load.php look for:


if ($set == 'normal')
{
$select_columns = '
IFNULL(lo.log_time, 0) AS is_online, IFNULL(a.id_attach, 0) AS id_attach, a.filename, a.attachment_type,


And add at the end of the last line


mem.additional_groups,


Then look for:


// First do a quick run through to make sure there is something to be shown.
$memberContext[$user]['has_messenger'] = false;


And add before it:


$avatar_groups = array(1,24);
$all_groups = explode(',', $profile['additional_groups']);
$all_groups[] = $profile['id_group'];
$all_groups[] = $profile['id_post_group'];
$check = false;

foreach ($avatar_groups as $group)
if (in_array($group, $all_groups))
{
$check = true;
break;
}

if ($check == false)
{
$memberContext[$user]['avatar']['name'] = '';
$memberContext[$user]['avatar']['image'] = '';
$memberContext[$user]['avatar']['href'] = '';
$memberContext[$user]['avatar']['url'] = '';
}


In the first line add the member groups for which you want the avatars to show. Comma separated.

In my testing, the only place it won't disappear it it is at the top of the page. Where only the member can view it.

I really appreciate you tried and come up with some kinda solution. But i have been trying these... Do you think you can help out there?
http://www.simplemachines.org/community/index.php?topic=456666

Eventhough there is no result yet, it looks easier. I just wish there was a check box for that though

Kays

As you noticed, it's not that easy to do. Permissions can't be used since they only pertain to the present user.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Advertisement: