by Razor12345 August 23rd 2023, 1:31 pm
AP - Display - Templates - General - memberlist_bodyFind:
- Code:
<th class="thCornerL" nowrap="nowrap" height="25">#</th>
<th class="thTop" nowrap="nowrap">{L_AVATAR}</th>
<th class="thTop" nowrap="nowrap">{L_USERNAME}</th>
After this code, insert this:
- Code:
<th class='thTop'nowrap="nowrap">Points</th>
Find:
- Code:
<th class="thTop" nowrap="nowrap">{L_POINT}</th>
Delete this code.
Find:
- Code:
<td class="{memberrow.ROW_CLASS}" align="center"><span class="gen"> {memberrow.ROW_NUMBER} </span></td>
<td class="{memberrow.ROW_CLASS}" align="center"><div class="avatar mini"><a href="{memberrow.U_VIEWPROFILE}">{memberrow.AVATAR_IMG}</a></div></td>
<td class="{memberrow.ROW_CLASS}" align="center"><span class="gen"><a class="gen" href="{memberrow.U_VIEWPROFILE}">{memberrow.USERNAME}</a></span></td>
After this code, insert this:
- Code:
<td class="{memberrow.ROW_CLASS}" align="center"><span class='points_user'></span></td>
Find:
- Code:
<!-- BEGIN switch_td_point -->
<td class="{memberrow.ROW_CLASS}" align="center"><span class="gen">{memberrow.POINTS}</span></td>
<!-- END switch_td_point -->
Delete this code.
At the end of template insert this code:
- Code:
<script>
window.addEventListener('load', function() {
let listOfUsers = document.querySelectorAll('table#memberlist tbody tr');
let listOfFieldPoints = document.querySelectorAll('span.points_user');
listOfUsers.forEach(function(item, index) {
if (index === 0) {
return false;
} else {
let address = item.querySelector('td:nth-child(3) span.gen a.gen.tooltipstered').href;
$.ajax({
url: address,
method: "GET",
data: 'dl#field_id13',
dataType: "html",
success: function (data) {
let div = document.createElement('div');
div.innerHTML = data;
let find_el = div.querySelector('dl#field_id-13 dd div');
listOfFieldPoints[index-1].append(find_el);
}
});
}
});
});
</script>
Save. Publish.
Result:
I draw your attention to the fact that you didn't send me a test account and I can't check the id of the fields in your profile on your forum. This may cause the code to work incorrectly.
In my forum, the Points field has field id 13:
If you can find out the field id yourself, look for
in the code and replace it with
- Code:
dl#field_id-{ID FIELD} |