[wp-hackers] add_options_page reference method in class?

Edward de Leau e at leau.net
Fri May 7 21:56:07 UTC 2010


Thanks!

On Thu, May 6, 2010 at 10:49 PM, Andrew Nacin <wp at andrewnacin.com> wrote:

> It needs callbacks. Generally, that would look like 'myplugin_adminform'.
> For class methods, you need to do array($this, 'adminform').
>
> On Thu, May 6, 2010 at 4:43 PM, Edward de Leau <e at leau.net> wrote:
>
> > I have made an abstract class "EdlWPPluginAdmin" which contains the
> regular
> > plugin admin code.
> >
> > The method "AdminForm" in there is a basic admin form.
> >
> > I'm trying to get add_options_page to work to call this method with:
> >
> > "function AddOptionMenu() {
> > add_options_page($this->mStrPluginAdminPageTitle,
> >  $this->mStrPluginAdminMenuTitle,
> > $this->mStrPluginAdminAccessLevel,
> >  $this->mStrPluginAdminFile,
> > '$this->AdminForm');
> > }"
> >
> > now... $this->AdminForm does not work.
> >
> > It gives me: *Warning*: call_user_func_array() expects parameter 1 to be
> a
> > valid callback, function '$this->AdminForm' not found or invalid function
> > name in*C:\temp\xamp\htdocs\wordpress\wp-includes\plugin.php* on line
> *339*
> > *
> > *
> > I tried several combinations even self::, &$this->, calling it from the
> > class the extends the admin class and the php page that instatiantiates
> the
> > class but somehow I cant get this reference to this method to work.
> >
> > I think it should be something like &$this-> but whatever i try it does
> not
> > work.
> >
> > Does anyone have a clue?
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
Edward de Leau
http://populair.eu


More information about the wp-hackers mailing list