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 CiviMail (Moderator: Piotr Szotkowski) »
  • Sorting "from email addresses" alphabetically
Pages: [1]

Author Topic: Sorting "from email addresses" alphabetically  (Read 550 times)

rhrueda

  • I post occasionally
  • **
  • Posts: 45
  • Karma: 0
  • CiviCRM version: 4.4.3
  • CMS version: Drupal Pressflow 6.22
  • MySQL version: 5.5.22
  • PHP version: 5.3.10
Sorting "from email addresses" alphabetically
February 07, 2014, 07:43:28 am
Hi!

When creating a new mass mailing, I would like to sort the "From email addreesses" list alphabetically (Mailing Content (step 3 of 5)).

I can´t find the way of doing this.

Thanks a lot!


rhrueda

  • I post occasionally
  • **
  • Posts: 45
  • Karma: 0
  • CiviCRM version: 4.4.3
  • CMS version: Drupal Pressflow 6.22
  • MySQL version: 5.5.22
  • PHP version: 5.3.10
Re: Sorting "from email addresses" alphabetically
March 26, 2014, 05:10:08 am
Hi! Nobody?  ???

Thanks!

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: Sorting "from email addresses" alphabetically
March 26, 2014, 08:44:39 am

U'll need to write a hook and manipulate that form element. Alternatively, u might be able to do it via javascript for that page and form element

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

rhrueda

  • I post occasionally
  • **
  • Posts: 45
  • Karma: 0
  • CiviCRM version: 4.4.3
  • CMS version: Drupal Pressflow 6.22
  • MySQL version: 5.5.22
  • PHP version: 5.3.10
Re: Sorting "from email addresses" alphabetically [solved]
April 01, 2014, 03:23:09 am
Hi there,

If this is useful to someone, this script works:

sites/all/modules/civicrm/js/Common.js

Code: [Select]
$(window).load(function() {
   var emails = [];
   $("#from_email_address option").each(function() {
     emails.push(this);
   });

   emails.sort(function(a, b) {
     var at = $(a).text().toLowerCase();
     var bt = $(b).text().toLowerCase();
     return (at > bt)?1:((at < bt)?-1:0);
   });
   $("#from_email_address").append(emails);
 });


Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • Sorting "from email addresses" alphabetically

This forum was archived on 2017-11-26.