Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Custom Options Panel WordPress

  • SOLVED

Hi,

I have created a custom options panel so users can easily set up specific options on my wordpress theme. I followed a tutorial on how to create the options panel here: http://bit.ly/bPAMVB

This options panel gets added to the default Wordpress admin interface. Screenshot can be viewed here: http://dl.dropbox.com/u/2864440/wptheme.png

Everything seems to be in order, but every time I try to save anything Wordpress says "you do not have sufficient permissions to access this page." I've trolled the internet but just can't seem to figure it out.

The user account I am logged in with is the main admin account.

The code for this functionality is fairly long, so I've pasted it here:
http://pastie.org/private/xzmumpd6wo4dnitilg2a

Any ideas how to get this to function properly?
(I'm starting the question at $15, and if there's more work involved to get this going I have no problem increasing the prize.)

Thank you in advance for your help.

Answers (1)

2010-04-01

Buzu B answers:

It looks like for some reason you are not being identified as admin after sending the form. It would be nice to have the files to test locally and analyze the error first hand and that way be able to diagnose the problem and find a solution. I'll PM you my email address just in case you are willing to send me the files.


WP Answers comments:

Files sent.


Buzu B comments:

It really surprises me no one at nettus highlighted it. Ii is pretty obvious.

You are redirecting to functions.php which is a bit strange. So, the only thing you have to do is to change that redirection to point to custom-admin-menu.php

Find this:

header("Location: admin.php?page=functions.php&saved=true");

and change it to this:

header("Location: admin.php?page=custom-admin-menu.php&saved=true");

same with this:

header("Location: admin.php?page=functions.php&reset=true");

change to

header("Location: admin.php?page=custom-admin-menu.php&reset=true");

It's an easy fix and the error is pretty obvious.

I think I'll contact nettuts to ask them about the error because it really makes me think about their community, I mean 102 comments and no one noticed it, and if someone did, they didn't change it. I didn't read the comments nor the post (to long for me) but I did noticed that part of the code in the post is just the way you have it.


Buzu B comments:

oh, I forgot to say... the changes are to be done in custom-admin-menu.php more or less at the middle of the document.


WP Answers comments:

Hi Buzu,

The error is actually on my end, not with Nettuts.

In the tutorial they put all their code directly in the functions.php file, but I put mine in an external file to help keep things clean and tidy.

Stupid mistake on my end for not catching that.

Thank you very much for your help. I will give it a go now and let you know how I make out.


Buzu B comments:

I just downloaded the source from nettuts. I guess I spoke too fast :X. Their source is all right. The problem you got is because It seems you didn't follow the instructions to the letter. You have a file that is not in nettuts files. More specifically this file:

custom-admin-menu.php

they do everything on function.php while you do it in two different files. The solution I gave you works any way...


Buzu B comments:

UPS race condition.. we posted at the same time XD


WP Answers comments:

that's cool we posted at the same time :D

Code works like a charm. Stupid mistake on my end. Been looking at this theme for too long ;)

Thanks again for your help.

If your interested, I'm going to post one more question right now for a custom 'recent posts' widget. Stay tuned.


WP Answers comments:

Hi Buzu,

Everything is working fine with saving the data, but now I am unable to retrieve this data.

I am following what they have in the tutorial to retrive the data, but nothing is being out puted.

Am I doing something stupidly wrong again?


<?php echo stripslashes(get_option('_ga_code')); ?>