samedi 3 janvier 2015

Worpdress hook function on click of Button "Pages" in the WP Admin Panel / Not Activate Plugin "advanced_page_manager" for user type "author"


Hi I need a hook which I can use for add_action('TheHookINeed', 'add_hooks_for_advanced_page_manager');


I need the function add_hooks_for_advanced_page_manager() executed before the page overview site appears.


The hook should be called when the user clicks on the "Pages" Button in the WP-Admin Panel


enter image description here


add_action('wp_list_pages', 'add_hooks_for_advanced_page_manager'); did not work


I put my code in the wp-content\themes\child-theme\functions.php


if I use add_action('init', 'add_hooks_for_advanced_page_manager'); it works but gets called like a thousand times.


It would be okay if I use a hook which gets called after the user logged himself in.


Because I need access to the user role.


Ok maybe starting from the beginning, I need that the Plugin advanced_page_manager (http://ift.tt/1vGO2I2) is not active if a user with the role "author" logs into wordpress.


So far I managed it by : enter image description here So I commented the function out which calls the hooks that the plugin gets registered.


Then in my child theme I call this function advanced_page_manager::hooks(); but only if the current user has not the role "author".


enter image description here enter image description here


list_pages works not but init does


The only problem I have with my solution is that I think that the function advanced_page_manager::hooks(); gets called way to often, with my limited programming knowledge I think it should be okay that it only gets called once after the particular user logged him self in.


So if anybody can help me make this happen, I would be happy. Or maybe a total other way to conditional activate a plugin by user role basis.


Thanks Guys





Aucun commentaire:

Enregistrer un commentaire