dianikol85 Posted August 7, 2010 Report Share Posted August 7, 2010 hi to all, this may be silly but i can't solve it. Here's the thing: i just create a simple plugin and i put an # to the settings via this add_action() and it adds my li in the settings after i activated the plugin. when i clicked my plugins setings i get the following error message You do not have sufficient permissions to access this page. what should i do?? thank you in advance Quote Link to comment Share on other sites More sharing options...
falkencreative Posted August 8, 2010 Report Share Posted August 8, 2010 Hmm. Is this an error that the server is showing you, or is this an error that Wordpress is generating? Are you following along with any specific tutorial that shows you how to create a WP plugin, or are you doing it just based on the WP documentation? Quote Link to comment Share on other sites More sharing options...
dianikol85 Posted August 8, 2010 Author Report Share Posted August 8, 2010 i believe that it is a wordpress error. i just did the very basic just to add a link to settings section in wp-admin. The steps i did are the following: 1) in wp-content/plugins i created a new folder called myPlugin 2) then in that folder i create the myPlugin.php file and within it the appropriate infos in order wordpress see this as a plugin . I copied that info so these are ok then i add this piece of code function myFunc() { add_options_page("my plugin", "my plugin", 1, "my plugin", "myFunc"); } add_action('admin_menu', 'myFunc'); so under Settings i have a link called "my plugin" as excpected . So i click on this link and here it is .the error appears Quote Link to comment Share on other sites More sharing options...
falkencreative Posted August 8, 2010 Report Share Posted August 8, 2010 I have to admit I haven't experimented with creating a WP plugin, so I'm not sure how much help I can be... Have you looked at the WP documentation for this? http://codex.wordpress.org/Adding_Administration_Menus This is the sample code that the page provides: <?php add_action('admin_menu', 'my_plugin_menu'); function my_plugin_menu() { add_options_page('My Plugin Options', 'My Plugin', 'manage_options', 'my-unique-identifier', 'my_plugin_options'); } function my_plugin_options() { if (!current_user_can('manage_options')) { wp_die( __('You do not have sufficient permissions to access this page.') ); } echo '<div class="wrap">'; echo '<p>Here is where the form would go if I actually had options.</p>'; echo '</div>'; } ?> Quote Link to comment Share on other sites More sharing options...
dianikol85 Posted August 8, 2010 Author Report Share Posted August 8, 2010 With that code it works. I didn't check the documentation.... I expected that when you write a tut it must work before publish it... Thank you very much. I appriciate your help Quote Link to comment Share on other sites More sharing options...
falkencreative Posted August 8, 2010 Report Share Posted August 8, 2010 I expected that when you write a tut it must work before publish it... True, but technology changes over time, so perhaps the way that Wordpress handled adding plugins has changed since the tutorial was written. If you do a Google search or two for "wordpress 3 plugin don't have permissions" or similar, you'll notice that others were having this issue too. My impression is that something about how plugins were authenticated within WP changed between 2.8 and 3.0. Quote Link to comment Share on other sites More sharing options...
newseed Posted August 8, 2010 Report Share Posted August 8, 2010 I personally have not created a plugin myself but my suggestion is to look at a simple plugin like 'Text' and view the code. You might find a line of code that you are lacking. Quote Link to comment Share on other sites More sharing options...
dianikol85 Posted August 8, 2010 Author Report Share Posted August 8, 2010 It's ok now. it just needed a little bit of change in the main function. Falk has right though Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.