| We hope you enjoy your visit. You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you're already a member please log in to your account to access all of our features: |
| Show Avatar next to Forum's Last Post By; Show user's avatar next to where it shows who was the last person to post in a forum on category view and main page. | |
|---|---|
| Tweet Topic Started: Nov 15 2015, 12:14 PM (1,160 Views) | |
| Epsilekt | Nov 15 2015, 12:14 PM Post #1 |
|
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Show user's avatar next to where it shows who was the last person to post in a forum on category view and main page. This code will add an avatar next to the information shown next to the link and description to a forum in each category on the main index page and when viewing a single category. Here's a link to a working preview test forum: http://s4.zetaboards.com/EPModz1/index/ If you want to play around on the test board there are four member accounts that you can log into that already have avatars so you can post around in the topics and watch the avatars change. NewMember(1) thispassword(1) NewMember(2) thispassword(2) NewMember(3) thispassword(3) NewMember(4) thispassword(4) The code uses an external server that has unlimited bandwidth and space to host the information for the user's avatars so that it does not use extensive amount of bandwidth on the ZetaBoard servers. Place the following code in your Board Wrappers in the Above the copyright section: You must change the first line of this code where you see s4.zetaboards.com/EPModz1 to your forum's address without http:// in front of it and no slashes at the end! There is some CSS code at the beginning of this code that you can change the customize the two areas where the avatar shows up to better suit your forum's appearance. It does not necessarily need to be changed.
The rest of this post is not necessary to read unless you want to host the file on your own server instead of the one this code already uses. Remember after you are done setting this up on your server to update the Board Wrappers code to point the script in the first line to your server instead of mine. The code for the avatardatabase.php is as follows but you must change the parts in ALL CAPS at the beginning of the code, there are four, to your MySQL information.
The table information for the `avatardatabase` table should be like this:
Edited by Epsilekt, Nov 15 2015, 12:24 PM.
|
![]() |
|
| Faylen | Nov 16 2015, 06:20 PM Post #2 |
|
Member
![]() ![]() ![]() ![]()
|
I loved this, but it was slowing the forum's loading speed down tremendously. |
![]() |
|
| Jason | Nov 16 2015, 06:23 PM Post #3 |
|
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
It relies on an external host, so if that host slows down for any reason, so will your forum. |
![]() |
|
| Faylen | Nov 16 2015, 07:59 PM Post #4 |
|
Member
![]() ![]() ![]() ![]()
|
Makes sense. If I host the code on my own server it would be the same, but be dependent on my servers speed? |
![]() |
|
| momahami | Nov 16 2015, 08:04 PM Post #5 |
|
Member
![]() ![]() ![]()
|
This code is awesome. However, it doesn't update the images once I change my avatar. |
![]() |
|
| Epsilekt | Nov 17 2015, 01:02 AM Post #6 |
|
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
lol. I'm surprised someone actually realized that. I will update the code to fix that soon. I was just itching to release it. Uh... It slowed down the forum... hmm... Strange it uses iframes at the bottom of the forum not ajax... So it's loading on it's own time... I don't know my test forum doesn't have like 100 members or anything so I can't tell. As far as I can see in Mozilla it loads just fine. I will look into this in the future, thanks for letting me know. |
![]() |
|
| zbug | Nov 17 2015, 04:41 AM Post #7 |
![]()
Galaxy Friend
![]() ![]() ![]() ![]() ![]()
|
Is there a way when a user doesn't have a avatar it won't show up with all the extra space? As well i do notice it takes a couple of seconds to kick in
Edited by zbug, Nov 17 2015, 04:44 AM.
|
![]() |
|
| Quozzo | Nov 17 2015, 06:35 AM Post #8 |
|
By the blood of Sanguinius!
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
I don't know why you don't use AJAX instead of the iframe, the A stands for asynchronous Also, in the PHP you provided, the data to insert into the table will always have an id of 0, if this is the unique key (and it should be) then it will get angry, instead, you should set it to auto increment. Actually, I'm not quite seeing where you would create the table. Edited by Quozzo, Nov 17 2015, 06:40 AM.
|
![]() |
|
| Ferby | Nov 17 2015, 07:02 AM Post #9 |
![]()
Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
I'd also like to point out that if the user has no avatar the code still creates an image but with no source (aka a broken image). My suggestion is to have the code use a blank image (completely transparent) in the case that a user doesn't have an avatar along with attaching a "no avatar" class, that way you can still create a default user avatar via background CSS for the image. |
![]() |
|
| Epsilekt | Nov 17 2015, 08:45 PM Post #10 |
|
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
As far as the speed issues go, once the avatar is already saved in the database it loads instantly for me. I do have cable internet though... I will try to fix these issues soon. |
![]() |
|
| Ferby | Nov 20 2015, 10:34 AM Post #11 |
![]()
Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Saving the image links in session cookies will also improve performance but not ruin the user experience by looking at outdated profile pictures. |
![]() |
|
| Quozzo | Nov 20 2015, 08:16 PM Post #12 |
|
By the blood of Sanguinius!
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Yup. You could update the "database" in every topic by scanning each avatar and overwriting an old one with a new one. The user would be unaware the change has occurred until they see a new avatar, in which case the database is updated and the new avatar is displayed in future. Although I would opt for localStorage instead of session, and may even dabble in indexedDB using local storage as a fallback. Edited by Quozzo, Nov 20 2015, 08:18 PM.
|
![]() |
|
| Epsilekt | Nov 28 2015, 07:07 PM Post #13 |
|
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
You will have to update the PHP code for what the field for the avatar link is in the mysql table but yeah... I was going to get around to this... Edited by Epsilekt, Nov 28 2015, 07:09 PM.
|
![]() |
|
| mantra effex | Jun 17 2016, 03:06 PM Post #14 |
![]()
Anime Fan
![]() ![]() ![]()
|
truely amazing coding epsilekt
|
![]() |
|
| Skyon Archer | Jun 18 2016, 04:24 AM Post #15 |
![]()
Member
![]() ![]() ![]() ![]() ![]() ![]()
|
Note that the mysql functions used in this script are deprecated and will soon be removed. It is advised to update this code to mysqli or PDO for live use. More information: PHP MySQLi Manual and PDO Manual |
![]() |
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| « Previous Topic · ZetaBoards Codes & Modifications · Next Topic » |
| Track Topic · E-mail Topic |
4:35 AM Jul 11
|



![]](http://b1.ifrm.com/0/1/0/p601690/pipright.png)






truely amazing coding epsilekt

4:35 AM Jul 11