Support » Plugins and Hacks » WordPress is giving a permissions error on plugin submission

  • Resolved David Powell


    I’m creating a new plugin (based on a previous plugin I created that works). The options pages show up fine but when I submit I get the “You do not have sufficient permissions to access this page.” error.

    The plugin it’s based on works and submits fine. I’m not sure why this is having an issue though.

    Below is the script that creates the plugin, it’s pages, and the code that creates the new item on submit.

    add_action( 'wp_enqueue_scripts', 'add_product_focus_styles' );
        	add_action( 'wp_enqueue_scripts', 'add_product_focus_scripts' );
            function add_product_focus_styles() {
            	wp_register_style( 'pfstyles', plugins_url('/css/product-focus.css', __FILE__));
               	wp_enqueue_style( 'pfstyles' );
            function add_product_focus_scripts() {
               	//wp_register_script('rpjs',plugins_url('/js/productfocus.js', __FILE__),'','',true);
            register_activation_hook(__FILE__, 'product_focus_activate');
        	// activating the default values
        	function product_focus_activate(){
        	function product_focus_start() {
        		global $wpdb;
                          code that creates my table
             * Add the menu items to the WordPress menu bar
             add_action('admin_menu', 'create_product_focus_menu_page');
        	function create_product_focus_menu_page() {
        	   add_menu_page('Add Focus', 'Add Focus', 'administrator', 'productfocus/product-focus-create.php','',   plugins_url('productfocus/images/icon.png'));
        	   add_submenu_page('productfocus/product-focus-create.php', 'Edit Focus', 'Edit Focus', 'administrator', 'productfocus/product-focus-edit.php');
        		add_action( 'admin_init', 'add_product_focus_styles' );
        		add_action( 'admin_init', 'add_product_focus_scripts' );
        		global $wpdb;
        		$table_name = $wpdb->prefix."productfocus";
        		$pfname = $_POST['pfname'];
        		$pfdate = $_POST['pfdate'];
        		$return = $_SERVER['HTTP_REFERER'];
        		$q = $wpdb->prepare("INSERT INTO $table_name (pfname,pfdate) VALUES (%s,$d,)",$pfname,$pfdate);
        		$wpdb ->query($q);
        		header("location: ".$_SERVER['PHP_SELF']."?page=productfocus/product-focus-create.php");

    any clues why the “create” page will show but I get the error when I try to submit the form?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘WordPress is giving a permissions error on plugin submission’ is closed to new replies.