News:

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

Main Menu

Need to move avatars from attachments

Started by semimedia, November 04, 2010, 11:33:21 AM

Previous topic - Next topic

semimedia

Hi,
I'm trying to connect two smf site (same host, different domain, SMF2 RC3). I shared members, personal_messages, pm_recipients, membergroups and changed prefixes from subs files successfully.
Now, for connection perfectly, I need to share avatars too but for this I need seperate avatars table from attachments table from database.

How can I do it?
If I create new table for avatars and copy only avatars datas to this, which files to be edited after this?

Thanks for your helps,
Regards.

Kays

HI, I don't know if this will work, but you can separate the avatars from the attachments and store them in a separate folder. I wonder if you can share that folder with the two forums as the paths to that folder are defined in the avatar settings.

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

semimedia

Yes, I shared this folders with avatar and attachment settings.
In standart, attachments and avatars folders already seperated.
I must create new database table for uploaded avatars. When attachments table is shared, attachments are showing with all forums. (showing at all post with same id)

Kays

By default, uploaded avatars are stored with the attachments. You can store them in a separate folder also which you should be able to share. First item in this post.

http://www.simplemachines.org/community/index.php?topic=293441.0

Unless I'm misunderstanding what you wish to do. ::)

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

semimedia

Well, I tried this but confused.

For example forums stored in /public_html/forum1/ (www.forum1.com) and /public_html/forum2/ (www.forum2.com), what upload directory must be?

Kays

If it's for the user's uploaded avatars. It shouldn't matter as long as both forums point at this folder.

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

semimedia

Ok, I moved uploaded avatars to different directory but avatars using same table with the attachments in the database. So if I share attachments table and attach a file in topic with forum1, it will be saved attachments table with id_msg and it will be displayed in forum2's topic which has same same id_msg but this topics are not same.

Kays

Drat, although it doesn't use the info, it does check the attachments table to see if it's a member uploaded avatar.

I agree, you shouldn't need to share the attachments folder or table since they are unique to each forum.

There should be a way around it since it's only a check and the avatars are stored (physically) with the file name of avatar_{member id}.file_extension. So if a member uploads an avatar in both forums. Then the last uploaded avatar should show in both forums. Try it and see if it does work. ???

One solution might be to include both attachment tables when the members info is loaded.


$request = $smcFunc['db_query']('', '
SELECT mem.*, IFNULL(a.id_attach, 0) AS id_attach, a.filename, a.attachment_type
FROM {db_prefix}members AS mem
LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = {int:id_member})
WHERE mem.id_member = {int:id_member}
LIMIT 1',
array(
'id_member' => $id_member,
)
);


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

semimedia

Which file this codes are in?
Or which file I must edit for this?

Aleksi "Lex" Kilpinen

Quote from: Kays on November 04, 2010, 03:47:16 PM
the avatars are stored (physically) with the file name of avatar_{member id}.file_extension.
Actually, I don't think it works like that anymore. It adds stuff to the filename other than that.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

semimedia

Yeah, avatars stored with file name like "avatar_13_1279658932.png"

semimedia

#11
For this I seperated avatars from attachments table to a new table.

I think if we edit subs files in sources directory for this (not all {db_prefix}attachments to avatars table, just only related with uploaded avatars), it must be working fine.
But I don't know which are related to uploaded avatars.

Deaks

semimedia do you still require assustance?
~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

semimedia

Quote from: Runic on November 21, 2010, 10:18:24 AM
semimedia do you still require assustance?

Yes, I didn't do what I want yet :(

Deaks

have you run repair_settings.php to point to the new avatar folder?

What is repair_settings.php?
~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

semimedia

I think I don't need to run repair_settings.php because problem is not path of the avatars.

Deaks

well if you have moved avatars to the avatar folder then run this to make sure all paths are correct, it may help with the db :)
~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

semimedia

I already did but avatars stored in attachments table in the database. When I share this database avatars is working fine at both site but attachments is shared too. And this is causing to show same attachment for both site at different topics. For this reason I want to store avatars at different table.

Advertisement: