Jump to content

Plugin creation wordpress 3.0 error


dianikol85

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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>';

}
?>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...