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) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Changing default tag order
Pages: [1]

Author Topic: Changing default tag order  (Read 1621 times)

kmitz

  • I post occasionally
  • **
  • Posts: 74
  • Karma: 2
Changing default tag order
June 10, 2008, 09:52:57 am
Hi,

I'm brand new to CiviCRM...I've dug around in the code a bit and Googled this topic, but haven't found an answer thus far.

I'd like to change the way tags are displayed in the Tags tab for Individual Contacts.  I'd like them to be ordered by id, rather than alphabetically.

I haven't seen a method for doing that in the Admin section, so I assume I'll have to add an ORDER BY to the sql statement.  Could someone please tell me where I might find that?

Thanks,

kmitz

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: Changing default tag order
June 10, 2008, 10:31:35 am

You will need to edit the code in: CRM/Core/PseudoConstant.php, function tag( ) (line 718)

The function populate can take an order by clause, so you just need to expand the parameters to that function

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

kmitz

  • I post occasionally
  • **
  • Posts: 74
  • Karma: 2
Re: Changing default tag order
June 10, 2008, 11:01:58 am
Lobo,

Thanks.  I wouldn't have thought to look in there.

FWIW, I modified line 684 thusly:

Code: [Select]
self::populate( self::$tag, 'CRM_Core_DAO_Tag', true, 'name', 'is_active', null, true, 'id' );
kmitz
« Last Edit: June 10, 2008, 11:27:35 am by kmitz »

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: Changing default tag order
June 10, 2008, 11:15:10 am

neither did i :)

I just followed the trail .

CRM/Contact/Page/View/Tag.php => CRM/Tag/Form/Tag.php => CRM/Core/PseudoConstant.php

It is all quite logical (and structured, IMO)

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

kmitz

  • I post occasionally
  • **
  • Posts: 74
  • Karma: 2
Re: Changing default tag order
June 10, 2008, 11:29:33 am
OK.  Thanks for that.  I work in several Open Source web apps and they are all structured a little differently.

Thanks for cluing me in.

kmitz

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Changing default tag order

This forum was archived on 2017-11-26.