News:

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

Main Menu

Avatars on Board and/or MessageIndex

Started by Pipke, April 05, 2016, 06:27:00 PM

Previous topic - Next topic

Pipke

Quote from: Rock Lee [BC] on April 05, 2016, 07:21:03 PM
A really great job this change had something different when you need it but I think more than one will leave you the translation into Latin Spanish I hope you help :D


Regards!

thank you ;)

Quote from: DSystem on April 06, 2016, 08:45:35 PM
Brazil Portuguese translation attached.

thank you ;)

"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

Pipke

Quote from: JerzyLS on April 07, 2016, 07:08:23 AM
Okay, here is the solution for child boards.

Themes/default/MessageIndex.template

Find:

/* The board's and children's 'last_post's have:
time, timestamp (a number that represents the time.), id (of the post), topic (topic id.),
link, href, subject, start (where they should go for the first unread post.),
and member. (which has id, name, link, href, username in it.) */
if (!empty($board['last_post']['id']))
echo '
<p><strong>', $txt['last_post'], '</strong>  ', $txt['by'], ' ', $board['last_post']['member']['link'], '<br />
', $txt['in'], ' ', $board['last_post']['link'], '<br />
', $txt['on'], ' ', $board['last_post']['time'],'
</p>';

echo '
</td>
</tr>';


And replace:

/* The board's and children's 'last_post's have:
time, timestamp (a number that represents the time.), id (of the post), topic (topic id.),
link, href, subject, start (where they should go for the first unread post.),
and member. (which has id, name, link, href, username in it.) */
if (!empty($board['last_post']['id']))
$abm_img_style = 'width:42px; height: 42px; float:left; margin-right: 6px; padding: 0px;';
if (!empty($modSettings['abm_boardindex']))
{
if ((filter_var($board['last_post']['member']['avatar'], FILTER_VALIDATE_URL) === false) || (empty($board['last_post']['member']['avatar'])))
echo'', $board['last_post']['member']['id'] ? '<a href="' .$board['last_post']['member']['href']. '">' : '', '<img style="',$abm_img_style,' border-radius:',$modSettings['abm_avatar_layout'] ? '50' : '0','%;" src="'.$settings['images_url']. '/abm_avatar.gif" alt="[?]" />', $board['last_post']['member']['id'] ? '</a>' : '';
else
echo'<a href="' ,$board['last_post']['member']['href'], '"><img style="',$abm_img_style,' border-radius:',$modSettings['abm_avatar_layout'] ? '50' : '0','%;" src="'. $board['last_post']['member']['avatar'].'" alt="[?]" /></a>';
}
echo '
<p><strong>', $txt['last_post'], '</strong>  ', $txt['by'], ' ', $board['last_post']['member']['link'], '<br />
', $txt['in'], ' ', $board['last_post']['link'], '<br />
', $txt['on'], ' ', $board['last_post']['time'],'
</p>';

echo '
</td>
</tr>';



thx for letting me know, i missed this one!!  :P

Quote from: igirisjin on April 06, 2016, 09:42:37 PM
Thanks, its an improvement. Not quite there yet.

The topic poster is displaying a [?]  on the left, and previous members also same rather than a default avatar.


should be fixed in v1.3 wich is the latest for now i hope  :o , otherwise shoot me lol.
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

DSystem

@Pipke,  It was perfect

1.3 version working 100% -> http://eletronicabr.com/treinamento-eletronica/16/50

It would be great avatars in unread:

Recent.php
Recent.template.php


OCJ

Well, the first poster is working now on my site but there is a problem.

Only 8 topics show on the board index (set for something like 30). On the second page almost everything does not display - all titles gone. It does not process previous members whose accounts have been closed but name still displays - they are still [?].
That is maybe where it fails as it stops at the no.8 topic with a (last) reply from previous member.
On the 2nd page there is another previous member last reply in the first topic and the board is trashed after that.
Any combination of mod settings produce it.

Andy

Wellwisher

Quote from: Pipke on April 07, 2016, 05:16:33 PM
Quote from: JerzyLS on April 07, 2016, 07:08:23 AM
Okay, here is the solution for child boards.

Themes/default/MessageIndex.template

Find:

/* The board's and children's 'last_post's have:
time, timestamp (a number that represents the time.), id (of the post), topic (topic id.),
link, href, subject, start (where they should go for the first unread post.),
and member. (which has id, name, link, href, username in it.) */
if (!empty($board['last_post']['id']))
echo '
<p><strong>', $txt['last_post'], '</strong>  ', $txt['by'], ' ', $board['last_post']['member']['link'], '<br />
', $txt['in'], ' ', $board['last_post']['link'], '<br />
', $txt['on'], ' ', $board['last_post']['time'],'
</p>';

echo '
</td>
</tr>';


And replace:

/* The board's and children's 'last_post's have:
time, timestamp (a number that represents the time.), id (of the post), topic (topic id.),
link, href, subject, start (where they should go for the first unread post.),
and member. (which has id, name, link, href, username in it.) */
if (!empty($board['last_post']['id']))
$abm_img_style = 'width:42px; height: 42px; float:left; margin-right: 6px; padding: 0px;';
if (!empty($modSettings['abm_boardindex']))
{
if ((filter_var($board['last_post']['member']['avatar'], FILTER_VALIDATE_URL) === false) || (empty($board['last_post']['member']['avatar'])))
echo'', $board['last_post']['member']['id'] ? '<a href="' .$board['last_post']['member']['href']. '">' : '', '<img style="',$abm_img_style,' border-radius:',$modSettings['abm_avatar_layout'] ? '50' : '0','%;" src="'.$settings['images_url']. '/abm_avatar.gif" alt="[?]" />', $board['last_post']['member']['id'] ? '</a>' : '';
else
echo'<a href="' ,$board['last_post']['member']['href'], '"><img style="',$abm_img_style,' border-radius:',$modSettings['abm_avatar_layout'] ? '50' : '0','%;" src="'. $board['last_post']['member']['avatar'].'" alt="[?]" /></a>';
}
echo '
<p><strong>', $txt['last_post'], '</strong>  ', $txt['by'], ' ', $board['last_post']['member']['link'], '<br />
', $txt['in'], ' ', $board['last_post']['link'], '<br />
', $txt['on'], ' ', $board['last_post']['time'],'
</p>';

echo '
</td>
</tr>';



thx for letting me know, i missed this one!!  :P

Quote from: igirisjin on April 06, 2016, 09:42:37 PM
Thanks, its an improvement. Not quite there yet.

The topic poster is displaying a [?]  on the left, and previous members also same rather than a default avatar.


should be fixed in v1.3 wich is the latest for now i hope  :o , otherwise shoot me lol.

Wasn't working for me but after I introduced this code, it only showed up in the child boards. Am I missing something? Do I have to set permissions or what? Also seeing some "?" next to some avatars in child boards.  Like @igirisjin mentioned. ???

Pipke

@Wellwisher can you post your site url(with mod installed), so i can take look?
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

Wellwisher

Quote from: Pipke on April 20, 2016, 07:38:07 AM
@Wellwisher can you post your site url(with mod installed), so i can take look?

Much respect @Pipke but I always run new mods locally to test against my latest live production set-up.

Pipke

Quote from: Wellwisher on April 20, 2016, 03:27:17 PM
Quote from: Pipke on April 20, 2016, 07:38:07 AM
@Wellwisher can you post your site url(with mod installed), so i can take look?

Much respect @Pipke but I always run new mods locally to test against my latest live production set-up.

Wich setting are you using for your profile avatar...
-No avatar
-Choose avatar from gallery
-Specify avatar by URL
-Upload an avatar

url your using for avatar? etc wich folder you use etc?
Well i'm not a mind taker, if i dont get more details i cannot help?
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

Pipke

To all who use my mod and see [?] instead of an avatar on there board(child)messageindex, the most common possible problem is that the particular user used in on his/her profile setting avatar to 'Upload an avatar' and used a link/url to a picture/image wich does not exists anymore(deleted or removed from the host) or has no link/url added in the input box, solution to fix that (so no more display [?]) is set the users profile avatar to 'No avatar' or ask the user in question to change the url.
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

nend

@ Pipke, I would suggest a fallback avatar. I know it is impossible to check every avatar, but here is a little trick I have done.

First you don't want to use the img tag, you want to use a div. With the div you can put a style tag in it with two background images, one will be the users avatar URL and the other will be a generic avatar. So if the first one doesn't load it will fall through to the generic.

Also be sure to set the div and image demensions accordingly and I would suggest only using this for linked avatars. ;)

*edit
I would also suggest putting the fallback in a class in the CSS.

foropimiento

I have a problem with de installation...

in the last modification, give me an error

cant find:
<td class="lastpost ', $alternate_class, '">

what can I do?

thanks..

NukeWorker.com

When I install this mod, for some weird reason it hides all but sticky topics in some boards.

Makes me sad, because I like this mod.  Looks nice.  Just can't use it if it hides thousands of posts.

Wellwisher

Really wanted this mod to work, but it's too much hassle for me to tinker around with and get it working. Also I feel it's another "over-kill", for it to show a simple avatar on the display.template.php and index.template.php?

I could come up with a mod but the approval process's a joke and I code for thrills.  :P Which is one of the reason I now just stick everything in "Tips & Tricks board"... but even my simple article based on html and css took 3 days to approve. It was rejected at first because I put the css on the top instead of the bottom.  Like seriously wth?  ::)

Seems like if and when the mods are released, they don't work properly. :laugh: Luckily we dont need to blame the developers, just blame the the Mod who approved it.  :P

nend

Usually all software has unforeseen bugs. In every app store devs release patches all the time. This is also the same for OS'es and even peripherals.

As with them, no problems where discovered during this mods testing phase.

Please also note there has been code changes since this mods initial review. We do not review code changes after a mod has been accepted onto the mod site.

If there is a security issue, users have the ability to report the issue and then we will do our best to get the issue resolved. Until then a modification with problems security wise, would be first pulled from the mod site and the mod author will be given the opportunity to fix the issue. The mod will be treated as a new mod and will have to go through the review process again.

Ask anyone who has been through the process, it isn't a cakewalk.

Arantor

I've seen your "it's overkill" claims before but the reality is often vastly more complex. Avatar information isn't available by default upon loading the thread data, so that had to be added in by this mod, not to mention processing the different types of avatars SMF supports (attached, attached/custom directory, direct URL, gallery) which this looks like it supports.

I don't think it could be written much more simply than it is but I guess I wouldn't know much about that.

Wellwisher

Quote from: Arantor on April 29, 2016, 09:09:13 AM
I've seen your "it's overkill" claims before but the reality is often vastly more complex. Avatar information isn't available by default upon loading the thread data, so that had to be added in by this mod, not to mention processing the different types of avatars SMF supports (attached, attached/custom directory, direct URL, gallery) which this looks like it supports.

I don't think it could be written much more simply than it is but I guess I wouldn't know much about that.

@Arantor it is an over-kill mate. :P A *simple* solution can be developed to easily work on all 2.0 themes (without errors). You basically use .JS to go to the members "index.php?action=profile;u=123" URL, and "fetch" the div container with "avatar img" and stick it to index.template.php. This can be done with just a few lines of .Js code. :)

I'd develop this but the approval process makes me a #SadPanda. In fact, now I can develop pretty nifty mods but the approval team needs to step-down and let develpers, develop and the community govern its own mods. Smf team should only step in *if* and *when* a security risk has been flagged.


qc

Quote from: Wellwisher on April 29, 2016, 12:51:16 PM
@Arantor it is an over-kill mate. :P A *simple* solution can be developed to easily work on all 2.0 themes (without errors). You basically use .JS to go to the members "index.php?action=profile;u=123" URL, and "fetch" the div container with "avatar img" and stick it to index.template.php. This can be done with just a few lines of .Js code. :)
Some men just want to watch the world burn :o

I mean - as long as you do this only on your own website, I am totally ok with that ;D

Playing quizduell? Having quizduell questions? Our german quizduell forum quizcommunity.de is looking for quiz freaks to come and play quizduell with us :)

nend

Quote from: Wellwisher on April 29, 2016, 12:51:16 PM
@Arantor it is an over-kill mate. :P A *simple* solution can be developed to easily work on all 2.0 themes (without errors). You basically use .JS to go to the members "index.php?action=profile;u=123" URL, and "fetch" the div container with "avatar img" and stick it to index.template.php. This can be done with just a few lines of .Js code. :)

I'd develop this but the approval process makes me a #SadPanda. In fact, now I can develop pretty nifty mods but the approval team needs to step-down and let develpers, develop and the community govern its own mods. Smf team should only step in *if* and *when* a security risk has been flagged.

The load that will generate would be tremendous, plus you'd block the users IP through SMF's flood control.  :-\

Wellwisher

Quote from: nend on April 29, 2016, 12:58:56 PM
The load that will generate would be tremendous, plus you'd block the users IP through SMF's flood control.  :-\

I am prepared to build it and prove anyone wrong for $29.99 - with 16 minium pre-paid customers and ofc my life-time support included for 2.0 only and if you run into install bugs with my script, I will solve them free of charge.  ;) My script will show avatars in index.template.php in the last post div and avatars in board posts list.

qc

@Wellwisher You are a special snowflake, aren't you ;D First trashing another mod for being overkill, then boasting about your 'one of a kind' (read: deranged :P) js solution and after being challenged with criticism offering to prove them wrong for just about 500$

I respect that  8)
Playing quizduell? Having quizduell questions? Our german quizduell forum quizcommunity.de is looking for quiz freaks to come and play quizduell with us :)

Advertisement: