Support

Home Forums Event Espresso Premium Sort  Custom Message Templates by Name

Sort  Custom Message Templates by Name

Posted: December 22, 2022 at 12:47 pm

Viewing 6 reply threads


Danny L Thomas

December 22, 2022 at 12:47 pm

I have 61 Custom Message Templates but their names appear (I think) in the order they were created. I would very much like to see the list in alphabetical order. I have tried to find a way to do this to no avail. Is this possible?


Tony

  • Support Staff

December 29, 2022 at 10:01 am

Hi there,

Which section are you viewing the template on? I’ll check if there is a filter available to change the order for the specific output you are using.

If you can add a screenshot I’ll know from that:

https://eventespresso.com/wiki/troubleshooting-checklist/#screenshots


Danny L Thomas

December 31, 2022 at 10:15 am

screen shot at:
https://www.thepeacecenter.org/wp-content/uploads/2022/12/Event_Espresso-Custom_Message_Templates.jpg


Tony

  • Support Staff

January 3, 2023 at 6:43 am

Oh, I see.

There are filters within EE which will allow you to set the sortable columns on that section.

So adding something like:

https://gist.github.com/Pebblo/d40d5baa9aac23dc7b1493ac4335bdbb

To your site will change the ‘Template Name’ column header on that page to be clickable and allow you to sort ASC/DESC.

You can add that to a custom functions plugin on your site, we have some documentation on creating one here:

https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/


Danny L Thomas

June 19, 2023 at 9:11 am

Note: this is a continuation of a previous support topic. I did not have time to execute solution offered until now and that topic is now closed.
Last Post by Tony January 3, 2023 at 6:43 am

To recap:
I have 61 Custom Message Templates but their names appear (I think) in the order they were created. I would very much like to see the list in alphabetical order. I have tried to find a way to do this to no avail. Is this possible?

Tony wrote:
Oh, I see.
There are filters within EE which will allow you to set the sortable columns on that section.
So adding something like:
https://gist.github.com/Pebblo/d40d5baa9aac23dc7b1493ac4335bdbb
To your site will change the ‘Template Name’ column header on that page to be clickable and allow you to sort ASC/DESC.
You can add that to a custom functions plugin on your site, we have some documentation on creating one here:
https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/
Post Link: Sort Custom Message Templates by Name
————————————————————-
So far:
* I got your document “How to Create a Site Specific Plugin for your WordPress Site”
* I installed FileZilla
* I was able to follow all the steps in that document (so far as I can tell)
* Here is the pho file I created:
====================================================================
<?php
/*
Plugin Name: Site plugin for Sort_Evnt_Esprsso_Ntfctns.com
Description: Site specific code to create a sort funtion on the Custom Notification Name
*/
/* Begin Adding Functions Below This Line; Do not include an opening PHP tag as this sample code already includes one! */

https://gist.github.com/Pebblo/d40d5baa9aac23dc7b1493ac4335bdbb

/* Stop Adding Functions */
====================================================================
* I found and activated the plugin “Site plugin for Sort_Evnt_Esprsso_Ntfctns.com” on my website.
* Still cannot sort on Custom Message Templates > Template Name
* Perhaps I did not understand:
https://gist.github.com/Pebblo/d40d5baa9aac23dc7b1493ac4335bdbb
? You wrote “add something like . . . ” which kind of implies I should customize for my site but I do not know how to do that.

Please advise.


Tony

  • Support Staff

June 20, 2023 at 6:02 am

Hi there,

Looks like you’ve added a link to the gist into the plugin, is that correct?

You add the code itself into the plugin, not the like. So something like this:

<?php
/*
Plugin Name: Site plugin for Sort_Evnt_Esprsso_Ntfctns.com
Description: Site specific code to create a sort funtion on the Custom Notification Name
*/
/* Begin Adding Functions Below This Line; Do not include an opening PHP tag as this sample code already includes one! */

add_filter('FHEE_manage_event-espresso_page_espresso_messages_sortable_columns', 'tw_ee_messages_sortable_columns', 10, 2);
function tw_ee_messages_sortable_columns($sortable, $screen) {
	if( $screen === 'espresso_messages_custom_mtps'){
		$sortable['messenger'] = ['MTP_messenger' => false];
		$sortable['name'] = ['MTP_name' => true];
	}
	return $sortable;
}


Tony

  • Support Staff

June 20, 2023 at 6:03 am

Just to note, I’ve re-opened your original thread and merged them together.


Danny L Thomas

June 20, 2023 at 7:55 am

Oh, I see now . . .
Copied in your code – tested – works perfect!
Thank you so much!


Tony

  • Support Staff

June 20, 2023 at 7:58 am

Awesome, I’m glad it worked for you.

Viewing 6 reply threads

The support post ‘Sort  Custom Message Templates by Name’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso