I have two types of groups configured and use OG sub Groups. Only groups of one type are being presented in the Group Assign section. Does the group have to be set up in any particular way?

Comments

jackspiv’s picture

I'm having same issue as far as I can tell.

have two different servers with different Php and MySQL versions.

The following configuration yields the error behavior described by rbryer:

Drupal 5.7
Configuration file Protected
Cron maintenance tasks Last run 2 days 23 hours ago
You can run cron manually.
Database schema Up to date
File system Writable (public download method)
JQuery Update Installed correctly
The current installed version of JQuery is 1.1.2
MySQL database 4.1.14
Organic groups modules Organic groups works best when job_queue.module.module is enabled. See the Integration section of the README file.
PHP 5.0.4
PHP register globals Disabled
Unicode library PHP Mbstring Extension
Web server Apache/2.0.54 (Fedora)

The following configuration seems to work correctly:

Drupal 5.7
Configuration file Protected
Cron maintenance tasks Last run 6 days 17 hours ago
You can run cron manually.
Database schema Up to date
File system Writable (public download method)
JQuery Update Installed correctly
The current installed version of JQuery is 1.1.2
MySQL database 5.0.45
Organic groups modules Organic groups works best when job_queue.module.module is enabled. See the Integration section of the README file.
PHP 5.0.5
PHP register globals Disabled
Unicode library PHP Mbstring Extension
Web server Apache/1.3.37 (Unix) mod_choke/0.07 mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 mod_ssl/2.8.28 OpenSSL/0.9.7a PHP-CGI/0.4mm

Any Ideas?

robert castelo’s picture

Strange, never had this problem before, and I've imported into OG quite a lot.

Thanks for the system details above. So the main differences seem to be:

MySQL 4.1.14 vs. MySQL 5.0.45

Apache/2.0.54 vs. Apache/1.3.37

rbryer what's your system? (see /admin/logs/status)

jackspiv’s picture

lot of variables unfortunately.
(and may have nothing to do with it or everything to do with it.)

php is also different

5.0.5 vs 5.0.4

it will be interesting to se rbryer's config.

jackspiv’s picture

Priority: Normal » Critical

doesn't seem like rbryer's watching.

Any ideas to move this forward?

rbryer’s picture

Sorry, been away... crazy trip to Vegas (cancelled flights, missed flights, people in hospital ... ).

My config is:

Drupal 5.7
MySQL database 5.0.27
PHP 5.2.1
PHP register globals Disabled
Unicode library Standard PHP
Web server Apache/2.0.59 (CentOS)

jackspiv’s picture

No problem ... glad you made it back alive...

so ... to summarize...

Apache

working installation
Web server Apache/1.3.37 (Unix) mod_choke/0.07 mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 mod_ssl/2.8.28 OpenSSL/0.9.7a PHP-CGI/0.4mm

both of the two broken installations have newer apache
Web server Apache/2.0.59 (CentOS) rbryer
Web server Apache/2.0.54 (Fedora) jackspiv

php

working installation
PHP 5.0.5

Broken installations (one newer one older):
PHP 5.2.1 rbryer
PHP 5.0.4 jackspiv

MySQL

working installation:
MySQL database 5.0.45

broken installations (both older)
MySQL database 5.0.27 (rbryer)
MySQL database 4.1.14 (jackspiv)

so .... Robert .... do you remember what MySQL database version you developed on (and what you are currently using successfully?)

1) I am a complete non-database guy. Does anyone know any reason that older databases might have some trouble with this module ... or are we barking up the wrong tree?

2) And ... is there any reason why older groups - created before my original install of userimport are showing up? but newer groups are not? I have tried disabling and uninstalling userimport.... then creating some new groups ... then reinstalling it ... same results - no luck.

3) for Robert... One thing I just remembered ... I have upgraded recently to the most recent version of Organic Groups. Is it possible that the organic groups table structure or hooks or something that the userimport module uses to retrieve existing groups has changed since the module was written?

4) for rbryer ... have you tried the userimport module before or only just around your May 11, 2008 original post? do you know what version of Organic Groups you were working with at the time?

rbryer’s picture

This is the first time that I tried to use it. I'm pretty sure it was the same version at I now have which is 5.x-7.1. I am also using Sub Groups for OG 5.x-1.x-dev.

rbryer’s picture

Before I start, I don't really know what I'm doing (Drupal/PHP that is) but before we go to far down a configuration issue this may help.

I had a look at the queries being generated for the page (devel module) and the query to populate the list of available groups on my site is...

SELECT n.nid, n.title FROM node n INNER JOIN og og ON n.nid = og.nid WHERE n.status = 1 AND n.type IN ('club') ORDER BY n.title

And this is exactly what it is returning. However I have more than one group node type defined, in my case 'club', 'group' and 'region'

Looking at the module it appears that the following call in user_import_get_groups() if at fault:

$og_types = variable_get('og_node_types', array('og'));

Is not returing the full list of all currently defined node types. It is only returning one of my group types.

If I look at the variable (using the variable editor in devel module) it shows all the types as expected.

Array
(
    [club] => club
    [group] => group
    [region] => region
)

I can't remember enough about PHP array handling to understand what the db_query() call will do, but I suspect that it is just taking the first element of the list. Or maybe its the handling of the variable by db_query()?

For reference the whole code snippet at fault is

    $og_type = variable_get('og_node_types', array('og'));

     $results = db_query("SELECT
                     n.nid, n.title FROM {node} n INNER JOIN {og} og ON n.nid = og.nid
                     WHERE n.status = 1 AND n.type IN ('%s')
                     ORDER BY n.title", $og_type);

    while ($group = db_fetch_object($results)) {

        $groups[$group->nid] = $group->title;
    }
jackspiv’s picture

Ok,

Here's mine

for the working implementation
Organic groups 5.x-6.0
OG Subgroups 5.x-3.3

for the broken implementation
Organic groups 5.x-6.0
OG Subgroups 5.x-3.3

Also, I have five types of group content that I've created.
These are all configured as "group homepage node types" in OG configuration in both working and broken implementations.

Name Type
Group - Generic Group group_generic_group
Group - Generic Public Group group_generic_public_group
Group - Learning Group group_learning_group
Group - Matrix Group group_matrix_group
Group - Work Group group_work_group

I just noticed that the first type (which was the first type of group content that I created) does in fact show up in the userimport group assignment list in the broken implementation! None of the other 4 group types show up.

So it looks like we are still having similar experiences.

However ... why does the my implementation that is functioning correctly load all of the group types? Or at least manage to load all of the groups regardless of group type?

Oops !!! (editing in new info ...)

I just discovered that the "working" implementation is also broken!!!! I had created many more (25) groups in the "working" implementation. However, 22 of them were the group_generic_ group type. Actually it is only those that appear in the userimport list. I hadn't thought to check the count before. Therefore the behavior of both my "working" and "broken" implementations are consistant with rbryer's situation and assessment. Both my implementations are in fact broken.

And both appear to just be reading the first group type into the array.

Looks like we are getting pretty close.

Robert... Any ideas for a quick fix? This could be really easy to cut and paste into the module code and try out. It will be pretty obvious if it works.

rbryer’s picture

I've had a poke around in the code. Basically it does not handle the case when there is more than one group, it only ever finds the first group.

The following replacement for the user_import_get_groups function finds and displays all the groups for ALL types. From a review of the forums I can't find a cleaner way to pass multiple values into the db_query IN condition as db_query escapes the single quotes that are required around the values for security. This still seems pretty secure as it will only every process data from the database e.g. group names. I'd be very interested if there are better ways to do this .... also I don't currently have any idea how to create/publish patches.

function user_import_get_groups() {

    $og_types = variable_get('og_node_types', array('og'));
    $og_types_str = "'".join("','",$og_types)."'";

    $sql = "SELECT
            n.nid, n.title, n.type FROM {node} n INNER JOIN {og} og ON n.nid = og.nid
            WHERE n.status = 1 AND n.type IN ($og_types_str)
            ORDER BY n.type, n.title";
    $results = db_query($sql);

    while ($group = db_fetch_object($results)) {

        $groups[$group->nid] = $group->title." ($group->type)";
    }

    return $groups;
}

I seem to have answered my own support request .. hope it helps!

jackspiv’s picture

rbryer,

AWESOME DUDE!!!!

Works beautifully in my installation.
Found all groups of 5 types.

Don't know what it might need from a testing or Drupalese standpoint, or anything else that it might break ... but its clearly better than the original (since it works for the more generalized case)

Maybe Robert will consider committing it after he tries it himself. Don't know if we can get more than 3 users on this...

Thanks

dugh’s picture

Status: Active » Reviewed & tested by the community

ditto, see same problem. I can't try rbryer's code at the moment, but I changed the status of this issue.

headkit’s picture

hm, doesn't work for me.
my import page is showing none of my groups.
is it because they are set to private?

dugh’s picture

Yeah this part wasn't working in the patch:

    $og_types = variable_get('og_node_types', array('og'));
    $og_types_str = "'".join("','",$og_types)."'";

So I just temporarily replaced it with this to get it to work:

    $og_types_str ="'group'";
headkit’s picture

doesn't work for me.

rbryer’s picture

(dugh) This code snippet does work fine for me and others. What error are you getting? This is the line that gets all the other groups so if you replace it as you have you will be back where you started, it will only show you og_groups of the type 'group'.

Where group type do you have? I have types 'group','region','club' and this is what os returned by this snippet.

(headkit) What does not work? The patch or the whole thing. I can't help if you don't provide any details ....

headkit’s picture

the og-groups you are talking about, are they the content type names which had been declared to group nodes?

i pateched the module (#10) and i tried your mini patch from #14.
both doesn't work for me.
i don't get any error, but there is also no group listet.
its only "No Groups have been defined.".

Apfel007’s picture

Hi there,
did some one solve the problem with the OG List? I tried to use the patched version for D6. I can't see a list - I tried the code above. Thanks for your respose.

Cheers Kai

ambereyes’s picture

Title: Not all OG groups are listed on import screen » OG groups not listed on import screen
Version: 5.x-1.3 » 5.x-2.x-dev

I think I figured it out.

The solution in #10 does not work anymore because the variable 'og_node_types' is no longer used in og 5.x-7.2. Instead there is a function 'og_is_group_type' that can be used to check if a type is a organic group.

So I modified the user_import_get_groups function to use that function.

function user_import_get_groups() {
	$results = db_query("SELECT type from node_type");
	
	while ($row = db_fetch_array($results)) {
		if (og_is_group_type($row['type'])) {
			$og_type []= $row['type'];
			}
		}

    //$og_type = variable_get('og_node_types', array('og'));

     $results = db_query("SELECT 
                     n.nid, n.title, n.type FROM {node} n INNER JOIN {og} og ON n.nid = og.nid 
                     WHERE n.status = 1 AND n.type IN ('%s', '%s')  
                     ORDER BY n.type DESC, n.title ", $og_type);  
                
    while ($group = db_fetch_object($results)) {
    
      $groups[$group->nid] = $group->title . " ($group->type)";
    }
    
    return $groups;
}

Now I have 2 og group types, so I had to hard code two '%s' in the query string. If someone who has enough caffeine in their system can clean this up and make it more generic, I would appreciate it.

But it works in any case. So put in a generic fix or enough '%s' to match your system - and it will finally list all the groups. I also ordered the result by group type.

cheers,
Katrina

--

www.ambereyes.net

jackspiv’s picture

Hi all,

Just tried User Import for the first time since my previous posts.

Hate to be the odd one out, (and not to deny your finding, Ambereyes) but FWIW, I am on OG 5.x-7.2 and the user import module correctly finds all of my groups ... even those created since upgrading to 7.2

Hmmm. Go figure ...

robert castelo’s picture

Status: Reviewed & tested by the community » Fixed

Fixed in 5.x-2.0-beta2. Feel welcome to re-open this issue if you still have problems once updated.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

jackspiv’s picture

Version: 5.x-2.x-dev » 5.x-2.10

Hi again,

Just updated to 5.x-2.10 and seem to be having this problem again.

No groups whatsoever show up on my import screen.

Has this functionality been removed from the latest version or am I hitting some kind of bug?

Thanks,

Jack

robert castelo’s picture

jackspiv- any more info? Could you describe your groups set up please.

jackspiv’s picture

Robert,

Thanks for responding so quickly. I really appreciate it.

I have seven groups set up using OG 5.x-8.0 under drupal 5.12

I have a variety of other OG related modules installed. (listed below with their dependencies and current status)

I'm not sure if this helps. I don't know what you mean by my "groups setup". Could you be more specific about what information would help?

Thanks again.

Jack

OG calendar 5.x-1.1 Displays calendars for groups.
Depends on: Organic groups (enabled), Event (enabled)
OG Content Type Admin 5.x-1.6 Allows restriction of content type use based on group.
Depends on: Organic groups (enabled)
OG forum 5.x-2.2 Creates forums within organic groups.
Depends on: Organic groups (enabled), Forum (enabled)
OG Resetter 5.x-1.0 Remove all users, remove all posts from any set of OGs on your system.
Depends on: Organic groups (enabled)
OG Subgroups 5.x-3.3 Enable defining hierarchy of groups for organic groups.
Depends on: Organic groups (enabled)
OG user roles 5.x-3.x-dev Allows group administrators to add members into Drupal system roles which are restricted to the group. (NOT same as OG Roles module.)
Depends on: Organic groups (enabled)
Organic groups 5.x-8.0 Enable users to create and manage their own 'groups'
Depends on: Views (enabled), Views RSS (enabled)
Required by: CiviCRM OG Sync (disabled), Organic groups access control (enabled), Organic Groups Blueprints (enabled), OG calendar (enabled), Organic Groups Collections (disabled), OG Content Type Admin (enabled), OG forum (enabled), Organic Groups Notifications (enabled), Organic groups panels (enabled), OG Resetter (enabled), OG Subgroups (enabled), OG user roles (enabled)
Organic groups access control 5.x-8.0 Enable access control for private posts and private groups.
Depends on: Organic groups (enabled)
Organic Groups Blueprints 5.x-1.0-alpha6 Allows group admins to create 'blueprints' of OG Panels, and bundle those blueprints together per group type. Once a bundle is created, whenever anyone creates a node designated as a group type, a set of OG Panels will be built from the blueprints in the corresponding bundle.
Depends on: Organic groups (enabled), Panels (enabled), Views panes (enabled), Organic groups panels (enabled)
Organic Groups Collections 5.x-1.0-terminal Allows group admins to create and customize collections of pre-configured panels (as in OG Panels) that are then automatically attached to groups upon creation.
Depends on: Organic groups (enabled), Panels (enabled), Views panes (enabled), Organic groups panels (enabled)
Organic Groups Notifications 5.x-7.3 Allows users to subscribe to content in groups.
Depends on: Notifications (enabled), Content Notifications (enabled), Organic groups (enabled)
Organic groups panels 5.x-8.0 Enable group admins to create panel pages.
Depends on: Organic groups (enabled), Panels (enabled), Views panes (enabled)
Required by: Organic Groups Blueprints (enabled), Organic Groups Collections (disabled)