Welcome to Geeklog Thursday, December 14 2017 @ 03:09 am EST


Status: offline

suprsidr

Forum User
Full Member
Registered: 29/12/2004
Posts: 555
Location:Champaign, Illinois
I just noticed we don't have access to the groups we assign a user upon creation via SEC_inGroup
the user must be added to the groups after plugins get notified of the creation in plugin_user_create_myplugin

Any ideas of ways to react to user groups on creation?

I can monitor $_POST and get group ids, but that is a hack.

-s
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com

Status: offline

::Ben

Forum User
Full Member
Registered: 14/01/2005
Posts: 1569
Location:la rochelle, France
Are you looking for function SEC_getUserGroups ?

Ben
I'm available to customise your themes or plugins for your Geeklog CMS

Status: offline

suprsidr

Forum User
Full Member
Registered: 29/12/2004
Posts: 555
Location:Champaign, Illinois
No, I'm looking to react to a user's group assignment.

Specifically during user creation plugin_user_create_myplugin
@see the difference
PHP Formatted Code

$_POST[groups] => Array
        (
            [0] => 2
            [1] => 20
            [2] => 33
            [3] => 13
            [4] => 7
        )
SEC_getUserGroups: Array
        (
            [All Users] => 2
            [Logged-in Users] => 13
        )
 

Example:
This user was added to G2Bridge Admin group(groupId 20) and I would then need react and add them to gallery's admin group.
But SEC_inGroup and SEC_getUserGroups failes at this point - the user has not been added to the groups yet.

plugin_user_create_myplugin is called before the user is actually added to any non-default groups.

-s
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com

Status: offline

::Ben

Forum User
Full Member
Registered: 14/01/2005
Posts: 1569
Location:la rochelle, France
When you say
This user was added to G2Bridge Admin group


Is it manually or by G2Bridge plugin ?

Ben
I'm available to customise your themes or plugins for your Geeklog CMS

Status: offline

suprsidr

Forum User
Full Member
Registered: 29/12/2004
Posts: 555
Location:Champaign, Illinois
I just noticed we don't have access to the groups we assign a user upon creation

/admin/user.php -> Create New

-s
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com

Status: offline

suprsidr

Forum User
Full Member
Registered: 29/12/2004
Posts: 555
Location:Champaign, Illinois
here is my workaround:
PHP Formatted Code

function plugin_user_create_G2Bridge($uid) {
    global $_TABLES;
   
    G2B_CreateG2User($uid);

    $groupId = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'G2Bridge Admin'");
    if(in_array($groupId, $_POST['groups']) ) {
        // Add user to G2 Admin group
    }
}
 

Which works, I'm just saying we should be able to use the built-in methods.
Which would mean changing the order in which things are executed during user creation.

plugin_user_changed_myplugin works as expected and we have access to the correct groups via the built-in methods.

-s
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com

Status: offline

::Ben

Forum User
Full Member
Registered: 14/01/2005
Posts: 1569
Location:la rochelle, France
You can check if the user is in gallery's admin group when you check if he is in G2Bridge Admin group in your scripts. And if he is not, add him.

Ben
I'm available to customise your themes or plugins for your Geeklog CMS

All times are EST. The time is now 03:09 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content