Code Changes
-
Hi,
I am using this plugin in a project I am working on and had to make some changes to the source code of the plugin to cater for some additional functionality. Basically, it’s just adding some filters in to allow developers to change the way the menu is displayed. I tried adding the proposed change via GitHub but it was rejected as this is not where it is developed. Can I send someone the proposed changes to review and possibly include into the code? I may need to make some further amendments and it seems a shame to not make those amendments available to other users of the plugin.
Tim
-
I am also working to add action and filter to this plugin. Your modification can help me.
Next release of this plugin you will find some action and filters.
You can give me the code and i can modify if needed and add with this plugin code.
ThnksGood stuff! The code I’ve chnaged is the dispHeader function at line 1622:
function dispMenu() { global $user_login; $numNew = $this->getNewMsgs_btn(); $allNew = $this->getNewMsgs_admin(); $numAnn = $this->getAnnouncementsNum_btn(); $myconNew = $this->mycontact_new(); $conNew = $this->getcontact_new(); $spamNew = $this->getSpam_new(); $tocheck = get_option('fep_cf_to_field'); $label_newmessage = apply_filters("fep_newmessage_label", "New Message"); $label_messagebox = apply_filters("fep_messagebox_label", "Message Box"); $label_contactmessages = apply_filters("fep_contactmessages_label", "Contact Messages"); $label_announcements = apply_filters("fep_announcements_label", "Announcements"); $label_directory = apply_filters("fep_directory_label", "Directory"); $label_settings = apply_filters("fep_settings_label", "Settings"); $label_viewallmgs = apply_filters("fep_viewallmessages_label", "All Messages"); $label_contactmgs = apply_filters("fep_viewallcontactmessages_label", "All Contact Messages"); $label_spam = apply_filters("fep_spam_label", "Spam"); $label_newemail = apply_filters("fep_newemail_label", "Send Email"); $menu = apply_filters("fep_menu_open", "<div id='fep-menu'>"); $menu .= apply_filters("fep_menu_button", sprintf("<a class='fep-button %s' href='%s'>%s</a>", "newmessage", $this->actionURL."newmessage", __($label_newmessage, "fep")), "newmessage", $this->actionURL."newmessage", __($label_newmessage, "fep")); $menu .= apply_filters("fep_menu_button", sprintf("<a class='fep-button %s' href='%s'>%s</a>", "messagebox", $this->pageURL, sprintf(__($label_messagebox."%s", "fep"), $numNew)), "messagebox", $this->actionURL."messagebox", sprintf(__($label_messagebox."%s", "fep"), $numNew)); if ($tocheck){ if (in_array($user_login,$tocheck)){ $menu .= apply_filters("fep_menu_button", sprintf("<a class='fep-button %s' href='%s'>%s</a>", "mycontactmgs", $this->actionURL."mycontactmgs", sprintf(__($label_contactmessages."%s", "fep"), $myConNew)), "mycontactmgs", $this->actionURL."mycontactmgs", sprintf(__($label_contactmessages."%s", "fep"), $myConNew));}} $menu .= apply_filters("fep_menu_button", sprintf("<a class='fep-button %s' href='%s'>%s</a>", "viewannouncements", $this->actionURL."viewannouncements", sprintf(__($label_announcements."%s", "fep"), $numAnn)), "viewannouncements", $this->actionURL."viewannouncements", sprintf(__($label_announcements."%s", "fep"), $numAnn)); if($this->adminOps['hide_directory'] != '1' || current_user_can('manage_options')) $menu .= apply_filters("fep_menu_button", sprintf("<a class='fep-button %s' href='%s'>%s</a>", "directory", $this->actionURL."directory", __($label_directory, "fep")), "directory", $this->actionURL."directory", __($label_directory, "fep")); $menu .= apply_filters("fep_menu_button", sprintf("<a class='fep-button %s' href='%s'>%s</a>", "settings", $this->actionURL."settings", __($label_settings, "fep")), "settings", $this->actionURL."settings", __($label_settings, "fep")); if(current_user_can('manage_options')){ $menu .= apply_filters("fep_menu_button", sprintf("<a class='fep-button %s' href='%s'>%s</a>", "viewallmgs", $this->actionURL."viewallmgs", sprintf(__($label_viewallmgs."%s", "fep"), $allNew)), "viewallmgs", $this->actionURL."viewallmgs", sprintf(__($label_viewallmgs."%s", "fep"), $allNew)); $menu .= apply_filters("fep_menu_button", sprintf("<a class='fep-button %s' href='%s'>%s</a>", "contactmgs", $this->actionURL."contactmgs", sprintf(__($label_contactmgs."%s", "fep"), $conNew)), "vcontactmgs", $this->actionURL."contactmgs", sprintf(__($label_contactmgs."%s", "fep"), $conNew)); $menu .= apply_filters("fep_menu_button", sprintf("<a class='fep-button %s' href='%s'>%s</a>", "spam", $this->actionURL."spam", sprintf(__($label_spam."%s", "fep"), $spamNew)), "spam", $this->actionURL."spam", sprintf(__($label_spam."%s", "fep"), $spamNew)); $menu .= apply_filters("fep_menu_button", sprintf("<a class='fep-button %s' href='%s'>%s</a>", "newemail", $this->actionURL."newemail", __($label_newemail, "fep")), "newemail", $this->actionURL."newemail", __($label_newemail, "fep"));} $menu .= apply_filters("fep_menu_close", "</div>"); $menu .= "<div id='fep_menu_open'>"; return $menu; }And this was the original comment with the Pull Request on GitHib:
I was looking to customize a few areas of the plugin so was looking for filters/actions to plug into. I have rewritten the function dispMenu to include some filters for changing the label text for each of the buttons:
fep_newmessage_label
fep_messagebox_label
fep_contactmessages_label
fep_announcements_label
fep_directory_label
fep_settings_label
fep_viewallmessages_label
fep_viewallcontactmessages_label
fep_spam_label
fep_newemail_labelIn addition, I have created two filters to amend the html generated for the beginning and end sections of the menu area:
fep_menu_open
fep_menu_openI have also added a filter to enable styling of the buttons themselves:
fep_menu_button
This also allows the insertion of a css class for further styling if needed.
Are you planning on putting your code on GitHub as I may make some further amendments which may be useful to the plugin generally and Pull Requests would seem a sensible way of doing this.
Hi Shamim,
Can you advise whether these changes will be incorporated into the new release?
Thanks,
Tim
new version is almost ready. u will get new version next month with lots of action and filters.
hope everybody will like this release.
The topic ‘Code Changes’ is closed to new replies.