Custom Wordpress 3.5.2 plugin "You do not have sufficient permissions to access this page." - php

I have been trying to integrate a custom Wordpress plugin called custom_rss into Wordpress by following http://net.tutsplus.com/tutorials/wordpress/creating-a-custom-wordpress-plugin-from-scratch/.
I have successfully achieved the proper URL in the menu items for settings. However, when I click on the custom_rss link under settings, the url that loads the plugin just returns content with the text You do not have sufficient permissions to access this page.. I am logged in as the super user admin.
The script that fires when the menu item is clicked is wordpress/wp-admin/options-general.php which passes page as its parameter :options-general.php?page=CustomRSSGenerator.
Does anyone have any ideas about how to allow privileges for this page or better yet, has anyone found out how to do a custom plugin for Wordpress 3.5.2 who can offer a solution to my problem? This has been beating me for about a week now and any advice is appreciated.

So there is a solution!
If you read the comments below the tutorial you will find a comment by a Robert character which states:
Great article. 2 things:
1. The following code produces an error in Admin panel, that makes the page inaccessible:
add_options_page("OSCommerce Product Display", "OSCommerce Product Display", 1, "OSCommerce Product Display", "oscimp_admin");
ERROR: "You do not have sufficient permissions to access this page."
To remove this error, modify the above code to:
add_options_page("OSCommerce Product Display", "OSCommerce Product Display", 1, "OSCommerce_Product_Display", "oscimp_admin");
That change will help you display the page correctly when the link
"OSCommerce Product Display" is clicked under the "Settings" menu
option. Hope this helps anyone who experienced a problem with the
code.
"The first parameter of this function is the option name which will be sued later to uniquely identify this option and its value." It
should have been "used" but incorrectly spelled as "sued". Not a big
deal, but just wanted to let you know.

Posting on this old topic because it was the most relevant Google result when I was searching after running into a similar problem so I figured I'd add my fix.
I had a really similar problem where any change I made to the page slug resulted in an insufficient permission error. At first I thought my page slug must be getting referenced somewhere else in my code so I searched and found no other references. I also tried stripping away every line of code outside of the basic plugin instantiation code but it still didn't work.
The fix was to deactivate then reactivate the plugin (within admin UI). I'm guessing upon plugin activation wordpress adds various entries to it's DB; some of which are likely your plugins name, menu page names, slugs, etc. After reactivating the plugin, the exact code that previously threw permission errors now worked perfectly.

Related

How can I active a wordpress plugin after upload from back-end source code

I'm facing a problem which is wordpress plugin related. I've deactived WooCommerce plugin for a reason from wp dashboard then my site is not showing any kinds of WooCommerce related topic. And after that I can't access my wp-admin panel "Error thrown
Call to undefined function WC()" this message is showing. I think if I can active the plugin again then the problem will be solved. But I still can't access admin panel. So, I want to active it again from site cPanel back-end source code. Can anyone help me ?
Thanks in advance
-Arefin
Yes you can do it from database.
First go to PHPMyadmin & select your database and go to the wp_options table. In options table find active_plugins in option_name field.
Here you will find like below(Format done for understanding)
a:5:{
i:0;s:33:"classic-editor/classic-editor.php";
i:1;s:36:"contact-form-7/wp-contact-form-7.php";
i:2;s:31:"custom-plugin/custom-plugin.php";
i:3;s:47:"jwt-authentication-for-wp-rest-api/jwt-auth.php";
i:5;s:29:"wp-mail-smtp/wp_mail_smtp.php";
}
Now add your woocommerce plugin into this. For adding plugin increment a to 6(a:6) from 5(a:5) and add your plugin. In this array i stands for item number & s stands for string length
a:6:{
i:0;s:33:"classic-editor/classic-editor.php";
i:1;s:36:"contact-form-7/wp-contact-form-7.php";
i:2;s:31:"custom-plugin/custom-plugin.php";
i:3;s:47:"jwt-authentication-for-wp-rest-api/jwt-auth.php";
i:4;s:27:"woocommerce/woocommerce.php";
i:5;s:29:"wp-mail-smtp/wp_mail_smtp.php";
}

Unable to update/Create post on Wordpress

I am attempting to update/create post on wordpress. However, I am always redirected to post.php stating: "It seems we can’t find what you’re looking for. Perhaps searching, or one of the links below, can help."
I have attempted the following:
- Checked Permalink Settings (Currently is by Post Name)
- Disabled all Plug ins
- Update Wordpress
- Enable Debug mode in wp-config (no debug logs captured)
- use a default theme (same error)
The site is showing perfectly, just having issues on making changes to post/page. I suspect that it is some permission issue
The website is http://stss.org.sg
thanks in advance!
Try adding a new user account with administration role! Then delete the previous user and use the new user account! Hope that will help!

OpenCart Theme 'MarketShop' slider issue

I'm using an opencart theme called MarketShop and as part of the theme it comes with a featured slider on the top of the website. It was all functioning correctly this morning, I went to edit the pictures by removing the original module and recreating it with a different banner. Now the module has been created but its not showing up on the website.
What have I done wrong?
I believe the two modules have identical information but I could be incorrect.
I've tried reupoloading all files from the theme and just skipping any that were identical in order to try and find the missing file with no luck.
Any suggestions besides doing a factory reset are much appreciated!
UPDATE:
Doesn't seem like anyone is able to determine the fault... Going to do a fresh install unless someone wants to first login themeselves and see if they can find the problem?
I managed to resolve this issue myself finallly after a LOT of playing around!
Steps I took to fix this issue were as follows..
First I uninstalled the module and reinstalled (It deleted all tests I made + the original demo items).
Then I clicked the install button again and went to edit.
I added one slideshow item and choose my banner that I'd setup earlier via the banners link in the admin panel.
I then went to LAYOUTS which is found next to the banners link or after you click save in modules at the top a hyperlink to layouts is offered.
Upon going to the layouts section and playing around here for even more time I worked out I needed to go into the Homepage file and click edit (NOT THE ONE NAME DEFAULT)!
I tried this numerous times with the DEFAULT page (Note that my store is even set so that the default theme is default which led me to believe that was the right page, which it is not.
So go into homepage and click edit.
Then add one module with the blue plus. Select the module you've just created earlier. Position it where you want it on the page (to get it to work for me I selected "Content Top" and Sort Order I set to 1 (The other two modules had sort orders of 2 and 3)
And that was that, problem solved!
Hopefully this will help anyone else with similar issues.

Wordpress not registering custom options from options.php page

Frustrated SO regular here:
I'm creating a theme-options.php page for a child theme in Wordpress. Here's the code. The page renders correctly, including: Adding the page link to the correct admin menu, creating and displaying the options page. When I click save, however, it takes me to a 500 (internal server error page).
Using the 'adminer' plugin (phpmyadmin) I have looked at the wp_options table, and there are none of the custome settings/fields that I have specified. My best guess at the problem is that the settings aren't registering properly so when I post the form to options.php it responds with an error because it doesn't expect those form fields.
I've been wracking my brain around this code for a few days now, and am wondering if someone else can take a look at it for me? I would really appreciate a few extra eyes...
Some resources I have tried:
http://ottopress.com/2009/wordpress-settings-api-tutorial/
http://themeshaper.com/2010/06/03/sample-theme-options/
http://codex.wordpress.org/Function_Reference/add_settings_section
My settings are not saving in wordpress theme options page (his settings appear empty in db. mine don't appear at all)
Oh crud,
It dawned on me after I spent an hour figuring it out that Richard M had given you the answer.
I created a new paste of your code, cleaned up some: http://pastebin.com/enUa3xme
I fixed the issue and also added the function add_my_options() and removed the is_admin() wrapper around your admin action hooks since they will only be triggered in the admin area, so they are unnecessary.
I needed to learn this since I use a half-way-done implementation of this, so even if it isn't helpful to you, it was worth learning...

Displaying products on home page

I've been searching around on Google to find an accurate tutorial that explains how to display products on the home page but so far nothing is working!
The latest products block doesn't work; the only thing that I've managed to get working is a single link to a product which is not very attractive.
Anyone know how to display products, featured products, etc. on the home page?
ps. I'm using Magento 1.5
There are many excellent tutorials on the web on this topic. I would recommend the Inchoo blog post as first option.
If you have specific issues, please report back with a full trace of the errors that you are receiving, what you've tried, etc.
In Admin > System > Configuration > Web > Default Pages you could, say, set catalog/category/view/id/10 to have the default route resolve to a category with entity id of 10.
You'll need to consider duplicate content (SEO) issues if you want this to show elsewhere on your site.

Categories