Simple Machines Community Forum

SMF Support => SMF 2.1.x Support => Topic started by: M45T3R5W4G3R on September 17, 2024, 04:24:56 PM

Title: Custom Fields for Custom Stats
Post by: M45T3R5W4G3R on September 17, 2024, 04:24:56 PM
Hey all, it is kind of a niché issue but wanted to ask anyway. I used to host a forum RPG back in the day using SMF 2.0.18 and after a while I am considering to reopen another one with SMF 2.1.4. Since the forum is focused on play-by-post RPGs and each account would actually be a character profile, I want to assign custom stats to characters. How I used to achieve it was through the two steps below (sharing it so both the problem could be understood and also people with similar forums may utilize this approach):


These two worked well but required a heavy PHP work to implement and still lacked significant automation as if a person purchased a stat with XP, XP had to be reduced from profile manually, and custom field for the stat had to be increased manually as well.

In SMF 2.1.x, I observe the infrastructure for the custom fields is the same as 2.0.x. And also it seems like we cannot just give or take karma with + or - buttons. So... I was wondering if anyone faced a similar issue or has any suggestions on implementing such a system through GUI elements, if possible. I'd appreciate any kind of inputs regarding this.

Title: Re: Custom Fields for Custom Stats
Post by: Illori on September 17, 2024, 04:29:10 PM
karma no longer exists by default in SMF 2.1.
Title: Re: Custom Fields for Custom Stats
Post by: vbgamer45 on September 17, 2024, 06:16:20 PM
Karma addon can be found at
https://github.com/live627/smf-karma
Title: Re: Custom Fields for Custom Stats
Post by: M45T3R5W4G3R on September 18, 2024, 02:55:46 AM
Thank you both. That is really a good starting point. Besides the karma tho, would you have specific suggestions on introducing GUI support for custom fields?

What I think is I can just create multiple "Karma"s for custom stats based on the mod you shared, which may be well-structured but overbloated. So another idea is maybe implementing some PHP functions to be usable throughout the admin panel so that stats could be given out to custom profile fields as STShop "Add credits to user" interface. Would like to hear your opinions regarding if I am trying to solve the problem from a convoluted way, tho.
Title: Re: Custom Fields for Custom Stats
Post by: Kindred on September 18, 2024, 08:03:48 AM
You are shoe-horning your concept into a system that was not intended to be used like that.

Quite honestly,  your best bet would be to create your own tables with a separate screen to deal with them rather than trying to misuse the karma and custom fields

It would also probably be better, resource-wise
Title: Re: Custom Fields for Custom Stats
Post by: M45T3R5W4G3R on September 18, 2024, 11:57:52 AM
I see. I am kinda' afraid of taking things into the GUI side as I only have a small experience with SMF but yeah, you are most likely right. Having a custom table would make a much cleaner back-end and then I'd only have to worry about displaying them in user profiles and modifying them from admin side. Actually quite a simple approach but somehow I didn't think of it while trying to keep away from adding new things on my own. Thanks a lot. ^^
Title: Re: Custom Fields for Custom Stats
Post by: Kindred on September 18, 2024, 01:52:10 PM
oh, you can easily take advantage of the SMF gui design...   Look at how some of the other mods have done it for fields and display...

I'd suggest one of the gallery mods, maybe the articles mod, the custom forms mod, and/or the glossary mod

they all do parts of what you'd want to do for display and field entry -- but they use the defined SMF layouts and functions.


Also -- advantages to doing it this way 1- As a mod, you can easily re-apply it if you ever need to reset your system, 2- using the hooks you can integrate it and enable/disable as needed without actually editing the core forum code 3- you could offer it to other people