I try to create a component showing some info beside the username on wall
I already managed to show the information in profile using .ossn-profile .user-fullname in JS
var element = document.querySelector('.ossn-profile .user-fullname');
But I cannot find the correct class for the wall
I already tried .ossn-wall-item .meta .user a
and
something like
var element = document.querySelector('[data-username=\"{$user->username}\"]');
and
var element = document.querySelector('.ossn-wall [data-username=\"{$user->username}\"]');
and also
var elements = document.querySelectorAll('.ossn-wall .ossn-output-user-url[data-username=\"{$user->username}\"]');
And yes, I am using ChatGPT and it works well, but I cannot find the correct css for username on wall
Thank you @Arsalan, the url.php file helped me
Callbacks must not echo anything this will break your site.
You need to edit wallpost template or look this https://github.com/opensource-socialnetwork/opensource-socialnetwork/blob/master/system/plugins/default/output/user/url.php
I tried
this:
function ossn_wall_age_display($callback, $type, $params) {
if (isset($params['post']->poster_guid)) {
$user = ossn_user_by_guid($params['post']->poster_guid);
if ($user && !empty($user->birthdate)) {
$age = calculate_age($user->birthdate);
echo "<script>
document.addEventListener('DOMContentLoaded', function() {
var users = document.querySelectorAll('.ossn-wall-item .meta .user a');
users.forEach(function(userElement) {
if (userElement.textContent.trim() === '{$user->fullname}') {
userElement.setAttribute('data-age', '{$age}');
userElement.setAttribute('data-birthdate', '{$user->birthdate}');
if ({$age}) {
userElement.textContent += ' (' + {$age} + ')';
}
}
});
});
</script>";
}
}
}
this:
function ossn_wall_age_display($callback, $type, $params) {
if (isset($params['post']->poster_guid)) {
$user = ossn_user_by_guid($params['post']->poster_guid);
if ($user && !empty($user->birthdate)) {
$age = calculate_age($user->birthdate);
echo "<script>
document.addEventListener('DOMContentLoaded', function() {
var users = document.querySelectorAll('.ossn-wall .ossn-output-user-url');
users.forEach(function(userElement) {
if (userElement.textContent.trim() === '{$user->fullname}') {
userElement.setAttribute('data-age', '{$age}');
userElement.setAttribute('data-birthdate', '{$user->birthdate}');
if ({$age}) {
userElement.textContent += ' (' + {$age} + ')';
}
}
});
});
</script>";
}
}
}
and this:
function ossn_wall_age_display($callback, $type, $params) {
if (isset($params['post']->poster_guid)) {
$user = ossn_user_by_guid($params['post']->poster_guid);
if ($user && !empty($user->birthdate)) {
$age = calculate_age($user->birthdate);
echo "<script>
document.addEventListener('DOMContentLoaded', function() {
var users = document.querySelectorAll('.ossn-output-user-url');
users.forEach(function(userElement) {
if (userElement.textContent.trim() === '{$user->fullname}') {
userElement.setAttribute('data-age', '{$age}');
userElement.setAttribute('data-birthdate', '{$user->birthdate}');
if ({$age}) {
userElement.textContent += ' (' + {$age} + ')';
}
}
});
});
</script>";
}
}
}
But class is correct. Make sure and verify that of your newseed have these classes for user link or not
User url have class .ossn-output-user-url
var Users = $('.ossn-output-user-url');
and yes, I have to use chatgpt, because i am not a programmer and i have nobody to help me
Rafael is not available anymore and there are no other programmers for me, so I have to help myself and 90% of the time chatgpt works
I also tried ossn-output-user-url but with no success
Because you are using chatgpt. Is it so hard to simply right click and see browser console for correct class? :) simply open browser console and see correct class.
Due to the many requests in the past for additonal features and components we have decided to develope a premium version. Features like Hashtags, Videos, Polls, Events, Stories, Link Preview, etc included in it.
$199 (Life Time)