News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Adding and working with new fields in admin panel (membergroups)

Started by Klajdi, January 17, 2017, 08:39:22 AM

Previous topic - Next topic

Klajdi

So, what I'm trying to do is to add a new field in membergroups (when creating a new membergroup, modifying or deleting).
Lets take for example the number of stars, I want to add another field just like it, but named differently (subid) or sth like that.
I want this field to be saved in database, and then use it to compare in different places.
I am not very good at php, and working with database and admin panel seems very risky to me, and i thought you'd help me.
I am using 2.0.13 version.
Thanks in advance

Klajdi

Okay, so I somehow managed to create a new field, and manually created a column using phpmyadmin, but now whenever creating new membergroups, after clicking ADD i get this error:
The database value you're trying to insert does not exist: id_group
However after deleting subid_show, from ManageMembergroups.php in
array(
'id_group' => 'int', 'description' => 'string', 'group_name' => 'string-80', 'min_posts' => 'int',
'stars' => 'string', 'online_color' => 'string', 'group_type' => 'int', 'subid_show' => 'int',
),

(Around line 374)
I am able to create new group, but when editing the subid_show field on membergroup edit, i get the eact same error i got above, except that instead of id_group it is subid_show

Kindred

let's take a step back for a moment and discuss -- what are you actually trying to accomplish as an end goal...

I am not asking "how do you think your should do something"  I am specifically asking, What is this supposed to accomplish, when all is said and done?

Are you just trying to display more than one set of "stars" per user?

If so, that has already been accomplished and packaged as a mod.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Klajdi

Quote from: Kindred on January 17, 2017, 01:49:10 PM
let's take a step back for a moment and discuss -- what are you actually trying to accomplish as an end goal...

I am not asking "how do you think your should do something"  I am specifically asking, What is this supposed to accomplish, when all is said and done?

Are you just trying to display more than one set of "stars" per user?

If so, that has already been accomplished and packaged as a mod.
No, what I am trying to do is:
Create a new column in membergroups table,
Be able to change/edit that column value OR Writte and read data from that column (the column is named subid_show)
Compare that value with forumid (from Split Forum Mod)

One final thing would be "Show specific color when a member of a X membergroup is browsing X subforum, but not when he is browsing anther subforum)
Probably hide various html elements from his profile info (shown in topics) when he is browsing a specific subforum.

tbh I havent thought much about the end goal, I just want to be able to simply compare those vaules and use them somewhere.

Kindred

no... that first bit is the HOW again...      we're not getting into the HOW yet.
(because, from the sound of it, your how is actually the wrong way to go about it...)

We still need to discuss the WHAT and the WHY...

So, your intention is to have group(s) which display the mini profile differently based on the subforum they are currently viewing?
-- What do the mini-profiles display like for people not in that group?
-- Will there be mutiple groups that have multiple different displays?
-- will the display be different depending on the combination of group and subforum?  (e.g. group A, subforum A displays one way, group A, subforum B displays a different way, group B, subforum B displays a third different way and so on?)


AND display the username in a specific color in the Who's online" list based on which specific sub-foroum (identified by domain?) the user is currently viewing?
-- again is this a fixed set or a combination of variables?



Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Klajdi

Quote from: Kindred on January 17, 2017, 02:42:32 PM
no... that first bit is the HOW again...      we're not getting into the HOW yet.
(because, from the sound of it, your how is actually the wrong way to go about it...)

We still need to discuss the WHAT and the WHY...

So, your intention is to have group(s) which display the mini profile differently based on the subforum they are currently viewing?
-- What do the mini-profiles display like for people not in that group?
-- Will there be mutiple groups that have multiple different displays?
-- will the display be different depending on the combination of group and subforum?  (e.g. group A, subforum A displays one way, group A, subforum B displays a different way, group B, subforum B displays a third different way and so on?)


AND display the username in a specific color in the Who's online" list based on which specific sub-foroum (identified by domain?) the user is currently viewing?
-- again is this a fixed set or a combination of variables?
Hmm,
Ok, lets take it like i know nothing about coding (i actually dont know much):
I want users with rank B,C and E to show their rank name only on Subforum B. I want users with rank A to show on all subforums. I want users with rank D to show on subforum C.
same goes for stars, and for users online color.

But I want this, so it can be set in membergroup settings.

Klajdi

Ok, fixed it and now I managed to edit the membergroup, but whenever trying to create a new membergroup, it shows me the first error:
The database value you're trying to insert does not exist: id_group
Function: AddMembergroup
SERVER DIR/smf/Sources/ManageMembergroups.php
Line: 383


EDIT: Ok, managed to fix that aswell, removed subid_show from line 376 in ManageMembergroups.php

Now i want to know what i have screwed up (in case I have).
Data seems to be updated in database, I can edit membergroups, but idk . . .

Advertisement: