Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Aiheen aloitti: D.Rich99 - heinäkuu 30, 2019, 03:32:47 IP

Otsikko: Join date in postbit?
Kirjoitti: D.Rich99 - heinäkuu 30, 2019, 03:32:47 IP
How do I add join date to the postbit?

Thank you for any help.
Otsikko: Re: Join date in postbit?
Kirjoitti: Shambles - heinäkuu 30, 2019, 03:40:41 IP
This any good?

https://custom.simplemachines.org/mods/index.php?mod=2889

or this?

https://custom.simplemachines.org/mods/index.php?mod=2531

possibly even this?

https://custom.simplemachines.org/mods/index.php?mod=3975
Otsikko: Re: Join date in postbit?
Kirjoitti: D.Rich99 - heinäkuu 30, 2019, 04:06:18 IP
Thank you, but I am not looking for a mod, I would like someone to teach me how to do it myself.

This way I can also make other edits to the postbit, such as controling the order in which information (such as postcount) is displayed.

Those mods you posted put join date under the avatar, I would like it after postcount.
Otsikko: Re: Join date in postbit?
Kirjoitti: Shambles - heinäkuu 30, 2019, 04:09:15 IP
Wouldn't scrutinising those mods not give you a head start on techniques?
Otsikko: Re: Join date in postbit?
Kirjoitti: D.Rich99 - heinäkuu 30, 2019, 04:11:10 IP
You can probably tell from my postcount that I'm extremely new to SMF and I have no idea how to 'scrutinise' a mod.

Could someone at least tell me which template I need to edit and how to call the join date?

Thank you.
Otsikko: Re: Join date in postbit?
Kirjoitti: Shambles - heinäkuu 30, 2019, 04:20:44 IP
Download one or more of those mods, unzip it/them and look at the code changes proposed within.

The unzipped files are just text files - have a browse of them :)
Otsikko: Re: Join date in postbit?
Kirjoitti: Sir Osis of Liver - heinäkuu 30, 2019, 04:26:25 IP
It's in Display.template.php, look for 'poster'.  But you have to add 'registered_date' to the correct array, that takes a bit of doing.
Otsikko: Re: Join date in postbit?
Kirjoitti: Arantor - heinäkuu 30, 2019, 04:31:16 IP
Which is why you look at the mods and the code in them to see how they do it.

This is how I started writing mods and I wrote a few...
Otsikko: Re: Join date in postbit?
Kirjoitti: D.Rich99 - heinäkuu 30, 2019, 04:41:15 IP
What I did was install one of those mods and then look at display.template.php.

I found the following;
// Show the join date in post
if (!empty($modSettings['show_join_date_post']) && !empty($message['member']['joined']))
echo '
       <li class="date_registered">', $txt['date_registered'], ': ', $message['member']['joined'], '</li>';

I copy/pasted it to to under the postcount part, and now it appears as I wanted it.

Good job there were existing compatible mods though, because without that code I'd literally have no idea what to do.
Otsikko: Re: Join date in postbit?
Kirjoitti: Shambles - heinäkuu 30, 2019, 06:03:23 IP
You're welcome.