Important Notice: Effective immediately, all support will be handled through Discord. Read more about the changes coming to Anodyne's services.

Authors: Changing Character Names to Usernames

Having a problem getting Nova installed? Can't figure out why something isn't working right? This is the place to get help and report any bugs you find with Nova!

ENeufeld Thu Jul 26, 2018 11:28 pm

Authors: Changing Character Names to Usernames


Attempted to search for this topic but didn't find anything in the last few months. Apologies, if I missed it. Looking for some guidance on modifying our write mission post/log pages, controllers, models, etc.

Because users have unlimited P/NPCs in our sim, using characters names to credit posts is unwieldy and potentially confusing. There's at least one participant that can't remember who the characters belong to, so crediting by character name is useless to them. I know how to tell PHP to print a username, but it's been several years since I dabbled, and this looks like might be a job that goes beyond my skills. I admit I don't know the full scope of what would be involved. Is it possible to substitute the usernames for character names in the array on the write pages somehow? Or is anyone willing to point me in the right direction or walk me through creating a mod?


Posts: 31

ENeufeld Fri Jul 27, 2018 11:15 am

Re: Authors: Changing Character Names to Usernames

Now that I think about it, a better idea might be to just add the users to viewpost rather than completely overhauling the array that's already there. The userid is already in the database. I guess I just don't know how to use that id to bring the username to the viewpost page.

Posts: 31

AgentPhoenix Tue Jul 31, 2018 11:13 am

Re: Authors: Changing Character Names to Usernames

It's not terrible to do what you're talking about, but you do need to have a sense of what you're doing.

Basically, you need to loop through the authors list, grab the user ID, and then do a lookup on that user ID with the users model so you have that information. What makes the most sense is probably building something similar to get_authors from the characters model, but have it look up the user information instead. Then you can simply add another item to the data array with the users.

I will say this though: be very careful about displaying user information on pages that can be public. All of that should be wrapped in logic to make sure only authenticated users are seeing it. Privacy is a big deal these days, so it's important that you respect that when you're building something like what you're talking about.
User avatar

Posts: 7596

Return to Help

Who is online

Users browsing this forum: No registered users and 1 guest