php - plugin_action_links not working in WordPress 2.8+ -


I developed a plugin with the settings link which was working fine in WordPress 2.7. Version 2.8 brings some additional security features which causes the setting to display link messages: You do not have sufficient permissions to access this page.

This API hook is what I use to create a link:

  function folksr_plugin_action ($ links, $ file) {if (strstr ($ file, 'folksr) / Folksr.php ')) {$ fl = "& lt; a href = \" option-general.php? Page = folksr /settings.php\">Settings</a>, "; Return array_ararge (ar ($ fl), $ link); } $ Return the link; } Add_filter ('plugin_action_links', 'folksr_plugin_action', 10, 2);  

Available on full source code.

There is no additional argument in the settings screen, only some options and HTML are visible on the screen.

Amazingly enough, the codex search phrase "plugin_action_links" does not return anything for you, can you provide examples or can point me in the code that works for the settings link in the plugins menu Are you

I got the solution, by analyzing the sources of some random plugins, I have to say for my own problem - this What an unpleasant experience was! But hey, here's the solution.

It has been found that in order to create a setting link, it is necessary to register first. The following code is a stub that does the trick:

  class MyPlugin {public function __construct () {add_filter ('plugin_action_links', array ($ this, 'renderPluginMenu'), 10, 2 ); Add_action ('admin_menu', array ($ this, 'setupConfigScreen')); } Public Function ReaderPlugin Menu () {$ thisFile = basename (__ file__); If (bosom ($ file) == $ thisFile) {$ l = '& lt; A href = "'. Admin_url (" options-general.php? Page = MyPlugin.php ").' '& Gt; Settings & lt; / a & gt;'; Array_unshift ($ link, $ l);} $ Return link;} Public function setup config screen (if (function_exists ('add_options_page')) {add_options_page ('MyPlugin Settings', 'MyPlugin', 8, Besenem (__File__), array ($ this, 'renderConfigScreen') );}} Include Public Function Render Config Screen () {dirname (__ file__) '/MyPluginSettings.php';}}  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -