User languages user filter post content

eric redegeld Posted in Component Development 6 months ago

If using OSSN:
OSSN version: 8.1
Website URL (optional):

If facing any bug:
PHP Version :
Error Log if any:
Browser:
OS (Window/Linux/Android/iOS/Mac):

no bug, just testing.

What makes the user language and where can i find it.

Now user set his language to English. the whole site is in English so i can presume that he/here want to see alle data in English.

Working on filter component that user can set to see all posting in his language, or see all

But, for now stuck in this section

any tips?

Replies
Dutch Eric redegeld Replied 6 months ago

mean insight, feedback etc

Dutch Eric redegeld Replied 6 months ago

i put the code in my github
what i got so far. think could be an great asset to make ossn multi language(not the items)
give user the option to see post in there own language instead off using translation
https://github.com/compie67/LanguageFeed

inside, help etc would be great

Dutch Eric redegeld Replied 6 months ago

again, fun testing this

Status & Goal of the LanguageFeed Component
Status (current progress):
Component is installable and working without database schema changes.
Users can already open a separate LanguageFeed page (/languagefeed) that lists posts filtered by language.
Posts are automatically tagged with a language code when created (via entity metadata).
A badge with the post’s language appears on each wall item.

Users can choose filter modes:
All (default, show everything)
My language (based on profile setting)
Selected languages (custom subset from preferences page).
Preferences page (/languagefeed_prefs) saves per-user language filter settings.
Filtering works, but the feed is still a static list:
You see the posts but can’t interact yet (likes, comments).
Standard OssnWall view is attempted, but fallback renders simplified cards.

Goal (what we want to achieve):

A multi-lingual social site where every user decides which languages of content they want to see — independently from the site’s UI language.
Make the LanguageFeed behave like the normal newsfeed:
Full interactivity (like, comment, share, notifications).
Infinite scroll / pagination.
Consistent styling across themes.
Ensure retro-tagging tools for admins (add language metadata to older posts).
Provide a seamless opt-in experience: users can set language preferences once, and their feed automatically adapts.

Future: integration into the main newsfeed, not only a separate page.

Dutch Eric redegeld Replied 6 months ago

thank you!!!

almost thereImage

German Michael Zülsdorff Replied 6 months ago

Start phpmyadmin and display the structure of ossn_users:
Indeed, only a minimum of user attributes are stored in this table. Any other additional user attributes are stored as ossn_entities | ossn_entities_metadata pairs of type user

You may fetch all of your own (admin with guid 1) attributes that have been stored so far by running a query like
SELECT e.owner_guid, e.guid, e.type, e.subtype, emd.value FROM ossn_entities AS e JOIN ossn_entities_metadata AS emd ON e.guid = emd.id WHERE e.owner_guid = 1 AND e.type = 'user'
which will return a result like
Image

among a lot of other rows...
And as we can already guess, the chosen language of a user is stored as subtype language (in my case 'en')

Okay, so how to programmatically retrieve that value?
Let's assume you already fetched the user object some way like

$my_very_own_admin_user_object = ossn_user_by_guid(1);

then you will get your stored language this way

$my_language = $my_very_own_admin_user_object->language;