HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Usergroups modification...

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#91647 (In Topic #18419)
Avatar

Community saint

I wanted to have usergroups that are considered 'staff', but the system only lists admins and super_mods as staff.   Some sites have users that contribute as staff, but don't have full super admin access, thus you can now create a usergroup and define it as staff so they get proper credit in the usergroups listing. As well as that, I didn't want the 'apply to this usergroup' appearing on every user group when members are viewed.   As some groups should not be applied for…  

After doing this mod, I realized there is a built in ability to add fields to the user group's table.  I don't know if adding the fields that way will work or not, or if it does like 'custom profile fields' where it names the fields something other than what you name then and references them in a different table.   If that's the case, it won't work for this mod.

So to start, I went into the f_groups table and added 'g_is_staff' and 'can_apply', both type tinyint(1), defaulting all to 0.

Files that needed to be modified (and are attached below):

adminzone/pages/modules_custom/admin_ocf_groups.php
site/pages/modules_custom/groups.php
sources_custom/forum/ocf.php
sources_custom/ocf_groups_action.php
sources_custom/ocf_groups_action2.php
lang_custom/EN/ocf.ini
themes/default/templates_custom/OCF_VIEW_GROUP_SCREEN.tpl

I have tested adding and editing and the change to the groups view screen and all appears to be working without issue.
Attachment
» Download: admin_ocf_groups.php (34 Kb, 95 downloads so far)

Attachment
» Download: ocf_groups_action.php (8 Kb, 97 downloads so far)

Attachment
» Download: ocf_groups_action2.php (18 Kb, 100 downloads so far)

Attachment
» Download: groups.php (28 Kb, 100 downloads so far)

Attachment
» Download: ocf.php (57 Kb, 90 downloads so far)


Paul
Back to the top
 
Posted
Rating:
#91648
Avatar

Community saint

the other two files…

Attachment
» Download: ocf.ini (84 Kb, 101 downloads so far)

Attachment
» Download: OCF_VIEW_GROUP_SCREEN.tpl (2 Kb, 92 downloads so far)

Paul
Back to the top
 
Posted
Rating:
#91665
Avatar

Community saint

Hey Paul,

Another good idea!

Unfortunately, for now I can no longer access my adminzone.
You probably still have some hardcoded test stuff in there.;)
Here is the critical error:

Expand: Critical error – bailing out Critical error – bailing out



This is just a test site, so no harm done!:)

Jean
Back to the top
 
Posted
Rating:
#91667
Avatar

Community saint

It looks like the sql it's trying to run is:

Code

SELECT main.id FROM ocpo_f_groups main WHERE (main.g_is_super_moderator=1) OR g_is_staff=1

Not sure what the main.* stuff is in your query..  that doesn't happen in mine…

But for a quick fix, go to source/forum/ocf.php about line 1147…

You will see:

Code (php)

        function _get_moderator_groups()
        {        // modified for g_is_staff
                return collapse_1d_complexity('id',$this->connection->query_select('f_groups',array('id'),array('g_is_super_moderator'=>1),'OR g_is_staff=1'));
        }
 

at the end of the line, just change g_is_staff to main.g_is_staff

Perhaps you use a different database or something…

Paul
Back to the top
 
Posted
Rating:
#91671
Avatar

Community saint

Arbo said

It looks like the sql it's trying to run is:

Code

SELECT main.id FROM ocpo_f_groups main WHERE (main.g_is_super_moderator=1) OR g_is_staff=1
Not sure what the main.* stuff is in your query..  that doesn't happen in mine…

But for a quick fix, go to source/forum/ocf.php about line 1147…

You will see:

Code (php)

[semihtml]   function _get_moderator_groups()<br />    {        // modified for g_is_staff<br />       return collapse_1d_complexity('id',$this->connection->query_select('f_groups',array('id'),array('g_is_super_moderator'=>1),'OR g_is_staff=1'));<br />    }<br />[/semihtml]
at the end of the line, just change g_is_staff to main.g_is_staff

Perhaps you use a different database or something…


​I think you meant "sources_custom/forum/ocf.php"
The correction makes no change to the error.
I've verified the database fields and there is no main. prefix
There were no g_is_staff and g_can_apply field columns.
I've added them to the database, created a new usergroup for staff and all is now working as expected.

Don't know why those fields were missing from database.O_o

I'm sure you will figure it all.:)
:thumbs:
Thanks,
Jean
Back to the top
 
Posted
Rating:
#91672
Avatar

Community saint

Oh… in my first post I said they needed to be added to the table.   Sorry, I had assumed you had done that first.    

That makes sense that you got the error without them.   ;)

Paul
Back to the top
 
Posted
Rating:
#91678
Avatar

Community saint

Arbo said

Oh… in my first post I said they needed to be added to the table.   Sorry, I had assumed you had done that first.    

That makes sense that you got the error without them.   

Oops, I just reread and indeed missed it.
I guess, my brain wanted to test this the hard way. Sorry for the cry wolf thing :$
Back to the top
 
Posted
Rating:
#91680
Avatar

Community saint

No problem.  Just glad to know my ideas for mods and addon's are things others see as valuable, and I'm not totally off my rocker.

Paul
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: