Place the last of profile fields above post message
3 posters
Page 1 of 1
Place the last of profile fields above post message
Technical Details
Forum version : #phpBB3
Position : Founder
Forum link : https://mayo.forumpolish.com/
Description of problem
I wanna add a last of profile fields above a post (near to user name).Like here:
Is it possible to do that and keep the current fields layout?
Last edited by LeChat on October 26th 2023, 7:48 pm; edited 1 time in total
Re: Place the last of profile fields above post message
Good afternoon!
Since you have heavily modified templates, I can't test the code on my test forum and use developer tools.
1) You need to create a field that will be displayed in the user's profile (AP - Users & Groups - Profiles)
For the demonstration, I will use your existing field - Multikonta.
2) You need to change the viewtopic_body template
Find the code fragment that is responsible for displaying the block with the class
.
In this block, add the following code:
3) AP - Modules - Javascript codes management - Create new JavaScript
Title: any
Placement: In the topics
Code:
Save. Result:
Before:
After:
Important!
1) The profile field, which will be outside the information block, should be the last field in the users' profile.
2) This line of code checks for the presence of the field in the profile
The string in quotes must match the name of the field in the profile.
Since you have heavily modified templates, I can't test the code on my test forum and use developer tools.
1) You need to create a field that will be displayed in the user's profile (AP - Users & Groups - Profiles)
For the demonstration, I will use your existing field - Multikonta.
2) You need to change the viewtopic_body template
Find the code fragment that is responsible for displaying the block with the class
|
In this block, add the following code:
- Code:
<div class="special__element"></div>
3) AP - Modules - Javascript codes management - Create new JavaScript
Title: any
Placement: In the topics
Code:
- Code:
$(document).ready(function() {
const listOfPosts = document.querySelectorAll('.post');
listOfPosts.forEach((item) => {
const campoPElements = item.querySelectorAll('.pto-dentro .campo-p');
const lastCampoElements = campoPElements[campoPElements.length - 1];
const layoutSpecialElement = item.querySelector('.special__element');
if (lastCampoElements && layoutSpecialElement) {
const spesialElementTitle = lastCampoElements.querySelector('.campp-label').textContent;
if (spesialElementTitle === 'Multikonta : ') {
const specialElement = lastCampoElements.querySelector('.campp-cont').innerHTML;
layoutSpecialElement.append(specialElement);
lastCampoElements.style.display = 'none';
}
}
});
});
Save. Result:
Before:
After:
Important!
1) The profile field, which will be outside the information block, should be the last field in the users' profile.
2) This line of code checks for the presence of the field in the profile
|
The string in quotes must match the name of the field in the profile.
Razor12345- Support Moderator
- Posts : 1586
Reputation : 268
Language : Ukr, Rus, Eng
Location : Ukraine
SarkZKalie likes this post
Re: Place the last of profile fields above post message
Thank you, I tried to do that, but I think I must did something wrong. Can you check it on Jayden Ray profile?
Re: Place the last of profile fields above post message
Send me the login and password for the admin account by private message, please.
I don't see any errors in the console that are related to this code.
I'll look into this issue tomorrow
I don't see any errors in the console that are related to this code.
I'll look into this issue tomorrow
Razor12345- Support Moderator
- Posts : 1586
Reputation : 268
Language : Ukr, Rus, Eng
Location : Ukraine
Razor12345- Support Moderator
- Posts : 1586
Reputation : 268
Language : Ukr, Rus, Eng
Location : Ukraine
Re: Place the last of profile fields above post message
I styled it myself.
Thank you for your help. <3
Thank you for your help. <3
Razor12345 likes this post
Re: Place the last of profile fields above post message
Problem solved & topic archived.
|
Similar topics
» Private Message, Profile buttons (and any other) in Profile / how to get rid of the boarder under the posts?
» Two fields on one line and using image for field on message profile?
» Profile tabs + separated profile fields
» Profile Fields and Profile layout help.
» Place a contact button below the profile
» Two fields on one line and using image for field on message profile?
» Profile tabs + separated profile fields
» Profile Fields and Profile layout help.
» Place a contact button below the profile
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum