Instant change avatar or signature buttons on profiles and mini profiles.

Started by wynnyelle, September 03, 2013, 06:23:59 PM

Previous topic - Next topic

Arantor

Um... what?

So you want a button under every avatar on every post for the user to edit their own avatar?

That's just not logical, sorry.

Burke ♞ Knight

Uh... I thought that's what we were talking about.
Especially since OP said that the other way would be too hard to be done at the moment.

Arantor

How would it be logical to put it under *every* post? Under the user's *own* avatar, sure. But not *every* avatar.

Burke ♞ Knight

Well, I have no idea how to set it for only the user to see the link...

I did not even think of it, to be honest... LOL

Good find. I thought being in the user's avatar coding, it would be that way, but guess not...
My test site only has one member and one post, so did not get what you meant til now.

Arantor

Doing it just for the current user:

// Show avatars, images, etc.?
if (!empty($settings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image']))
echo '
<li class="avatar">
<a href="', $scripturl, '?action=profile;u=', $message['member']['id'], '">
', $message['member']['avatar']['image'], '
</a>
</li>';

if ($message['member']['id'] == $context['user']['id'])
echo '
<li>
<a href="', $scripturl, '?action=profile;area=forumprofile">
Click Here to Change Avatar
</a>
</li>';

// Show how many posts they have made.

Burke ♞ Knight

Thank you, old friend... Sorry I did not get what you meant the first time.

Dang test site's shortness of test user accounts and posts...LOL

By the way, I never said I was a master coder, and this proves it. But with friends like you, Colin, K@, ChalkCat, etc, I am learning well. :)

Arantor

We all had to start somewhere :) I have the habit of forgetting I've been doing this what feels like a lifetime :/

It's always worth just looking around the bit you're editing to see what else it's doing and how it's being invoked. There are quite a few gotchas like this in SMF's miles of code.

wynnyelle

Thanks to both of you!

...I too had considered the button problem. I figured it would look okay IF it was added to an already existing array of buttons. Then, it wouldn't be adding any new awkward elements.

Do I upload a button image for this and if so, where should I put it?

Arantor

That really depends first of all on where you actually want this new button. The code above will add it into the area on the left next to a post under where their avatar would be.

But you might want to put it somewhere else... depending on *that* affects whether you make a button or not.

Burke ♞ Knight

If make a button, maybe add it to where the PM button is?
That might work, if keep the user fix Arantor made. :)

wynnyelle

Right, it could go next to there. And it'd only show for the owner of the profile. It's just one more easier way for this to work.

Also, could it go into the full profile too? For consistency? Or do you guys not think this would be a good thing to do?

Arantor


Burke ♞ Knight

In profile, I'd suggest putting it as the text, right under the image of the avatar.

By the way, I added an idea for the change avatar button in last post.

wynnyelle

Good ideas :) thanks!

Here is how our mini profiles look, or are going to look once this new skin is done:

Something close to this anyway. This is what I meant by adding it to the button array. If added as text, it creates a new element {and therefore clutter} rather than adding to an existing array. {This example has no avatar, but an avatar would be right above the 5 buttons}. There is room there for 2 or 3 more buttons.

What do you think?

Burke ♞ Knight

I see no reason why can't add it there.
Would have to make new button, and add the code Arantor fixed, making it as much like the code for the other buttons as can, to not mess up alignment, etc.

wynnyelle

Do you think it should be on the far left? Or....?

It'd only be there for the profile's owner, if that influences the design in any way.

I am hesitant because then it'd be the only control there that works to alter one's own profile immediately. That leads me to wonder whether I should add anything else as well to make it consistent.

Since it'll link to the page where avatar AND sig gets changed, maybe the rollover text should say "Change Avatar and Signature."

Burke ♞ Knight

Problem I see, is it basically takes them to the whole forum profile edit screen.

Why not say "Edit Forum Profile"

Or maybe "Edit Profile - Avatar - Signature"

wynnyelle

Because "forum profile" isn't specific enough. There's a lot more on the profiles to edit than just avatar and signature.

"Edit Avatar and Signature" sounds good to me, though! :)

Burke ♞ Knight

If make the change, please post the change here, so I can also add it to my TIP on BK Modding site, where I added the text link version already. :)

wynnyelle

Quote from: Arantor on September 03, 2013, 08:20:47 PM
Doing it just for the current user:

// Show avatars, images, etc.?
if (!empty($settings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image']))
echo '
<li class="avatar">
<a href="', $scripturl, '?action=profile;u=', $message['member']['id'], '">
', $message['member']['avatar']['image'], '
</a>
</li>';

if ($message['member']['id'] == $context['user']['id'])
echo '
<li>
<a href="', $scripturl, '?action=profile;area=forumprofile">
Click Here to Change Avatar
</a>
</li>';

// Show how many posts they have made.


This would be in display.template.php?

Advertisement: