Support » Plugin: Email Users » [Plugin: Email Users] use specific function names

  • Resolved acub



    I’m using your plugin and I really appreciate your work and effort. However, I’d like to make a suggestion: you are using very general function names, such as “get_column”, “get_sortable_columns”, “prepare_items” and so on. Being so general, there are big chances that some other plugin developers give the same name to their functions aswell, and that’s going to cause problems to either your plugin or theirs, depending on which one loads first.

    I’m suggesting you prefix all your function names with the initials of your plugin and change the above examples in “eu_get_column”, “eu_get_sortable_columns”, “eu_prepare_items” and so on…

    I hope this helps. Keep up the good work.

    Regards, Andrei.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mike Walsh


    Those functions are wrapped in the child class WP_List_Table instance and must have those names for the class to function properly. If you see some functions outside of a class that don’t have the “mailusers_” prefix let me and I’ll take a look. Everything within the plugin should be using that prefix to avoid collisions.


    Thank you for explaining that to me. There’s only one more thing I’d like to know. If more than one plugin uses the same class, are there going to be problems? Or each will have their own instance?

    Plugin Author Mike Walsh


    It depends. If two different plugins were to define a class by the exact same name, there would a problem and PHP will generate an error. It is perfectly acceptable for multiple plugins to create unique instances of a class for their own use and doing so is good programming.

    If a plugin wants to leverage an existing class and build on it, the proper thing to do is to create a child class which is what Email Users does with the WP_List_Table class.

    class MailUsers_List_Table extends WP_List_Table {
    // Code that extends the child class or overloads the
    // existing methods will appear here in the body of the class.

    Hope that helps clear things up.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Email Users] use specific function names’ is closed to new replies.