Profile Fields Variables for Postprofile
3 posters
Page 1 of 1
Profile Fields Variables for Postprofile
Me again,
Forum version: ModernBB
I'm looking for a way to separate and dissect custom profile fields from each other on the posts for so long, so that I can design them freely or move things around. I finally came across something like this in a discussion here, sent by @pedxz ,
https://ajuda.forumeiros.com/t117089-criacao-de-novas-variaveis
But this code is taking the value from the account that is logged in, if I'm not mistaken. I can use it to do things in mainpage or navbar or widgets etc. Is there a way to make it so that it takes the value from whoever have sent the post so that I can use this variable in the postprofile section? Currently, when I place the variable in the postprofile section, under the avatar, it gives the same value to each post, taking it from the logged in user.
I know next to nothing about javascript but I can imagine if it's possible to take this data from logged in user and since we have sections on topic lists like "last posts", there must be a way to get data from the poster too, this should be possible as well.
Thanks in advance.
Forum version: ModernBB
I'm looking for a way to separate and dissect custom profile fields from each other on the posts for so long, so that I can design them freely or move things around. I finally came across something like this in a discussion here, sent by @pedxz ,
https://ajuda.forumeiros.com/t117089-criacao-de-novas-variaveis
But this code is taking the value from the account that is logged in, if I'm not mistaken. I can use it to do things in mainpage or navbar or widgets etc. Is there a way to make it so that it takes the value from whoever have sent the post so that I can use this variable in the postprofile section? Currently, when I place the variable in the postprofile section, under the avatar, it gives the same value to each post, taking it from the logged in user.
I know next to nothing about javascript but I can imagine if it's possible to take this data from logged in user and since we have sections on topic lists like "last posts", there must be a way to get data from the poster too, this should be possible as well.
Thanks in advance.
Last edited by SirLaplace on December 20th 2022, 12:51 am; edited 1 time in total
Re: Profile Fields Variables for Postprofile
Hello @SirLaplace,
What is your objective? Personalisation?
But any existing field in profile can be added to the messagesI can use this variable in the postprofile section
What is your objective? Personalisation?
Re: Profile Fields Variables for Postprofile
@pedxz Yes, I know that but when I do that all fields are staying together as it is.
If I can create variables for each custom field, I can divide the fields into two boxes for instance.
Or I can keep some of the fields out of the box.
Or maybe I can create a field for people to place a personal gif URL and then I can code it so that it can show on another place on their posts.
These are just ideas, possibilities, I'm not asking for any of the particular situations I just want to know If we can do that
If I can create variables for each custom field, I can divide the fields into two boxes for instance.
Or I can keep some of the fields out of the box.
Or maybe I can create a field for people to place a personal gif URL and then I can code it so that it can show on another place on their posts.
These are just ideas, possibilities, I'm not asking for any of the particular situations I just want to know If we can do that
Last edited by SirLaplace on December 20th 2022, 12:47 am; edited 1 time in total
Re: Profile Fields Variables for Postprofile
@SirLaplace: Use in topics this code
element
- Code:
(function($) {
'use strict';
$(function() {
$('.postprofile-name').each(function() {
var $this = $(this);
var $user = $this.find('a').attr('href');
if (!$user.length) return;
$.get($user, function(data) {
$('dl[id^="field_id"]', data).each(function() {
const label = $(this)
.find('dt')
.text()
.toUpperCase()
.normalize('NFD')
.replace(/[\u0300-\u036f]/g, '')
.replace(/[^a-z0-9]+/gi, '-')
.replace(/^-|-$/gi, '');
const content = $(this).find('.field_uneditable').text();
const img = $(this).find('.field_uneditable > img');
$this.parents('.post').find('[data-user-field="' + label + '"]')
.replaceWith((/\bhttps?:\/\/\S*?\/[^\/.]+\.(jpg|png)\b/g.test(content) ? '<img src="' + content + '" alt="' + label + '" title="' + label + '" loading="lazy" style="max-width: 100%;" />' : img.attr('src') ? img.clone() : content));
});
});
});
});
}(jQuery));
|
skouliki, Ape and SirLaplace like this post
Re: Profile Fields Variables for Postprofile
@pedxz You are like a god to me. You don't know how long I tried to find something like this, make this happen. Thank you, thank you so very much. It works like a charm.
Ape likes this post
Re: Profile Fields Variables for Postprofile
Problem solved & topic archived.
|
Similar topics
» Proposal: RPG/Profile PHP Variables
» Custom Profile Entries as Variables?
» Retrieve specific profile field variables.
» Profile tabs + separated profile fields
» Profile fields, profile notifications, and system
» Custom Profile Entries as Variables?
» Retrieve specific profile field variables.
» Profile tabs + separated profile fields
» Profile fields, profile notifications, and system
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum