CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Manually assign to smart groups
Pages: [1]

Author Topic: Manually assign to smart groups  (Read 2613 times)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Manually assign to smart groups
June 09, 2009, 01:20:15 am
Hi,

right now, it's possible to assign a contact to a smart group. It leads to users adding to groups instead of changing the criterias so they are automatically in the group (eg a smart group "male" based on the demographic gender field). Users add John to the group instead of setting his gender, and that's a mess quite quickly.

Is there a way to exclude the smart groups from the assign drop down ?

X+

-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Kiran Jagtap

  • Ask me questions
  • ****
  • Posts: 533
  • Karma: 51
Re: Manually assign to smart groups
June 09, 2009, 02:00:26 am
hi,

Quote
Is there a way to exclude the smart groups from the assign drop down ?

1. Assign group from Tab -> Groups
go to CRM/Contact/Form/GroupContact.php line around 105 - 110
get only static groups as all groups, which will exclude smart groups.

2. Assign group by Edit contact from tab or profile
go to CRM/Contact/Form/GroupTag.php line around 96 add 'saved_search_id' in select clause and then do not process smart group in while loop
like
Quote
SELECT id, title, description, visibility
to
Quote
SELECT id, title, description, visibility, saved_search_id

then inside while loop
Quote
//exclude smart groups
if ( $dao->saved_search_id ) {
      continue;
}

3. Assign group from search - more actions - Add Contact To Group
go to CRM/Contact/Form/Task/AddToGroup.php line around  118 get static groups.

Quote
$group = array( '' => ts('- select group -')) + CRM_Core_PseudoConstant::group( );
to
$group = array( '' => ts('- select group -')) + CRM_Core_PseudoConstant::staticGroup( );

Hope this help

kiran

You Are Designed To Choose... Defined By Choice.

rvanderh

  • Guest
Re: Manually assign to smart groups
August 06, 2009, 02:29:15 am
Thanks very much for this solution. It helps me a lot. But it also returned a new problem. The changed GroupTag.php effects the listbox 'Join a group' on the user dashboard. Now all groups may be selected in stead of only groups in 'Public user pages and listings'.

I would appreciate very much if you could post an alternative 'workaround'.

Thanks, Rik

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Manually assign to smart groups
August 07, 2009, 02:16:38 am
Quote from: xavier on June 09, 2009, 01:20:15 am
right now, it's possible to assign a contact to a smart group. It leads to users adding to groups instead of changing the criterias so they are automatically in the group (eg a smart group "male" based on the demographic gender field). Users add John to the group instead of setting his gender, and that's a mess quite quickly.

Is there a way to exclude the smart groups from the assign drop down ?
really good point - but can you clarify - when you say the 'assign drop down' are we talking on the summary contact screen or in the groups tab or somewhere else?
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

rvanderh

  • Guest
Re: Manually assign to smart groups
August 07, 2009, 03:24:48 am
Quote
really good point - but can you clarify - when you say the 'assign drop down' are we talking on the summary contact screen or in the groups tab or somewhere else?
I noticed same problem as Xavier. And if I am right about that you can find the 'assign drop down' like:
1. Do a search for a person. You get a table with one or more persons and a listbox on top of that with items like 'more actions','Add contacts to Event','Add contacts to Group', etc.
2. Select the person and in the listbox select 'Add contacts to Group'. This gives a new screen with a new listbox 'Add contacts to group'
3. The items in this new listbox exists of both regular and smart groups. The workaround of Kiran takes care that only regular groups are in the listbox

Best regards, Rik

alfred_nutile

  • Ask me questions
  • ****
  • Posts: 464
  • Karma: 14
    • River Valley Tech Collective
Re: Manually assign to smart groups
August 07, 2009, 06:32:35 am
always wondered why this was even an option?
Seems to go against the whole point of a smart group and from a usability standpoint any client I show this too just looks at me confused?

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Manually assign to smart groups
August 07, 2009, 03:53:27 pm
Ok - i am still confused. If we are talking about the "more actions' dropdown then obviously that needs to be there when ever a search is done and 'all results' are selected - since this is how Smart Groups are often created. So is the suggestion here that if only some results are selected that 'make a smart group' is not an option (from memory it tells you this won't work anyway)
Or is the suggestion to remove the Smart Groups from the list of Groups that shows via a Contacts 'Groups Tab' or from the list of Groups that shows at foot of the 'edit contact' page - or is there somewhere else we are talking about?
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Manually assign to smart groups
August 07, 2009, 03:54:50 pm
There are occasions where we do add a 'static' person to a 'smart group' so I am just trying to avoid losing something that we do use. Though I accept that there could be a case for making this more of an exception and therefore harder to achieve (by accident) ;-)
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Manually assign to smart groups
August 07, 2009, 04:29:07 pm
We do not have any plans to eliminate this "feature" of Smart Groups. We believe it is quite useful for many use cases. Examples:

* When smart group are used for mailings - the "static" REMOVE from group mechanism is needed for unsubscribes.

* I'm subscribed to the California Issues group because I my home address is in CA. Now I move but I've told the org I still want to get updates on California Issues. By allowing "static" additions to smart groups, this is do-able.

dave
Protect your investment in CiviCRM by  becoming a Member!

rvanderh

  • Guest
Re: Manually assign to smart groups
August 08, 2009, 01:46:00 pm
Reply to peterd
Quote
Ok - i am still confused. If we are talking about the "more actions' dropdown then obviously that needs to be there when ever a search is done and 'all results' are selected - since this is how Smart Groups are often created. So is the suggestion here that if only some results are selected that 'make a smart group' is not an option (from memory it tells you this won't work anyway)
No this is not what I ment.
Quote
Or is the suggestion to remove the Smart Groups from the list of Groups that shows via a Contacts 'Groups Tab'
That's one of the places where it shows up. But also after the three steps I mentioned in my former posting. But I am only interested in step 3 in which a contact is assigned to a group. Kiran mentioned a few more
Quote
or from the list of Groups that shows at foot of the 'edit contact' page
Checked that one, but couldn't find it on my site (2.2.7)

Let me try to clarify how I try to keep groups organized. I have 9 regular groups and 5 smart groups.
Smart group 1: all contacts. I need this only to organize SG2
Smart group 2: all ungrouped contacts. SG1 minus join of all regular groups. A mailinglist
Smart group 3-5: Join of one ore more regular groups. All mailinglists

SG 2-5 are used by my CRM-maintainer to send mailings. She assigns contacts only to regular groups. If she should by accident assign contacts to smart groups, contacts get in mailinglists in which they don't belong.

I can understand that smart groups are used to withdraw contacts from groups, for instance when the unsubscribe or opt-out. I am appreciating this feature very much. But maybe this feature could be confined to withdraws and not used for assigns

Best regards, Rik
« Last Edit: August 08, 2009, 01:53:16 pm by rvanderh »

fen

  • I post frequently
  • ***
  • Posts: 216
  • Karma: 13
    • CivicActions
  • CiviCRM version: 3.3-4.3
  • CMS version: Drupal 6/7
  • MySQL version: 5.1/5.5
  • PHP version: 5.3/5.4
Re: Manually assign to smart groups
September 07, 2009, 12:07:06 pm
It seems that unsubscribe should just set an "unsubscribe" flag so when the smart group collects the members (e.g., 'all males') John would still be "in the group" but if he had unsubscribed he would be removed from the final results.  Or more simply:
Code: [Select]
SELECT cid WHERE gender = 'male' AND unsubscribe != 1;Manually adding or removing people from a smart group should IMO be handled by creating auxiliary static groups, e.g., if the above smart group was called "Males" then there could be two static groups "Males_added" and "Males_removed" that the Males group includes or excludes from the returned list.

A "clean_and_merge" function could remove people from the static groups should their criteria change such they would automatically be included/excluded in the parent smart group.

I think this would be much cleaner than other methods.  As well, it would allow one to easily see the exceptions added to/removed from the smart group.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Manually assign to smart groups
September 07, 2009, 01:42:21 pm

A smart group is contained with a regular CiviCRM group (what fen refers to as an auxilary group). membership in a group can be of type: Added/Pending/Removed and hence u do not need 2 auxilary groups

We do not expose in a easy manner which folks are added via the auxilary group. This can be easily coded / rectified :)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Manually assign to smart groups
September 09, 2009, 02:48:48 am
When is "pending" used ?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Manually assign to smart groups
September 09, 2009, 03:55:41 am

its used during the civimail double opt-in process

when we receive a subscription request, but before we've gotten the confirmation email

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Manually assign to smart groups

This forum was archived on 2017-11-26.