« Return to Thread: 2.8, add_submenu_page and class functions

2.8, add_submenu_page and class functions

by Daniel Cameron-3 :: Rate this Message:

Reply to Author | View in Thread

Hey guys, it's been too long :)

I'm running into some issues when I want to use add_submenu_page with  
something like:
        array( $this, 'displayThisPage' ) )
for the function.

Strangely, the top menu works fine (since it's shared) but any  
subsequent sub_pages get an error[1].

For example,

add_menu_page( __( 'Options' ), __( 'Options' ), 'read', 'test',  
array( $this, 'displayBasePage' ) );
add_submenu_page( 'test', __( 'Test Description' ), __( 'Test  
Description' ), 'read', 'test', array( $this, 'displayBasePage' ) );
add_submenu_page( 'test', __( 'Sub Description' ), __( 'Sub  
Description' ), 'read', 'sub', array( $this, 'displaySubPage' ) );

If I wrap what's above inside an action of:



Cheers.



[1]
Warning: call_user_func_array() [function.call-user-func-array]: First  
argument is expected to be a valid callback, 'Array' was given in /
FULL/PATH/wp-includes/plugin.php on line 339




--


// Dan Cameron
SproutVenture // grow your business
_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

 « Return to Thread: 2.8, add_submenu_page and class functions