Drupal 7 - Add node edit form into a 'Simple page' - drupal

I'm trying to add the edit form of an existing node to a Basic page. Based on a given nid.
This problem seemed simple, however my attempt resulted in the following error report:
$node = node_load(array('nid' => 83));
$output = drupal_get_form($node->type .'_node_form', $node);
echo $output;
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 175 of /home/PAE/www/paemanu/includes/entity.inc).
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 388 of /home/PAE/www/paemanu/includes/entity.inc).
Notice: Trying to get property of non-object in eval() (line 3 of /home/PAE/www/paemanu/modules/php/php.module(80) : eval()'d code).
Notice: Undefined index: _node_form in drupal_retrieve_form() (line 806 of /home/PAE/www/paemanu/includes/form.inc).
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function '_node_form' not found or invalid function name in drupal_retrieve_form() (line 841 of /home/PAE/www/paemanu/includes/form.inc).
Notice: Undefined variable: output in eval() (line 3 of /home/PAE/www/paemanu/modules/php/php.module(80) : eval()'d code).
Notice: Undefined index: user-project in drupal_retrieve_form() (line 806 of /home/PAE/www/paemanu/includes/form.inc).
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'user-project' not found or invalid function name in drupal_retrieve_form() (line 841 of /home/PAE/www/paemanu/includes/form.inc).
I've been on this issue for many hours, any help is greatly appreciated.

Try this code:
$nid = 83;
$node = node_load($nid);
$type = $node->type;
module_load_include('inc', 'node', 'node.pages');
$form = drupal_get_form('node_edit_'.$type, $node);
render($form);

Related

Fatal error: Uncaught Error: Call to undefined function optionsframework_options()

i've updated my website with lastest wordpress version but now the Theme Options doesn't work with this error:
Fatal error: Uncaught Error: Call to undefined function optionsframework_options() in /home/customer/www/dimaurorivestimenti.it/public_html/wp-content/themes/Primero/admin/options-interface.php:25 Stack trace: #0 /home/customer/www/dimaurorivestimenti.it/public_html/wp-content/themes/Primero/admin/options-framework.php(209): optionsframework_fields() #1 /home/customer/www/dimaurorivestimenti.it/public_html/wp-includes/class-wp-hook.php(292): optionsframework_page('') #2 /home/customer/www/dimaurorivestimenti.it/public_html/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters('', Array) #3 /home/customer/www/dimaurorivestimenti.it/public_html/wp-includes/plugin.php(484): WP_Hook->do_action(Array) #4 /home/customer/www/dimaurorivestimenti.it/public_html/wp-admin/admin.php(259): do_action('appearance_page...') #5 /home/customer/www/dimaurorivestimenti.it/public_html/wp-admin/themes.php(10): require_once('/home/customer/...') #6 {main} thrown in /home/customer/www/dimaurorivestimenti.it/public_html/wp-content/themes/Primero/admin/options-interface.php on line 25
Can you help me to solve it?
EDIT: This is the code inside file:
function optionsframework_fields() {
global $allowedtags;
$optionsframework_settings = get_option('optionsframework');
// Get the theme name so we can display it up top
$themename = get_theme_data(STYLESHEETPATH . '/style.css');
$themename = $themename['Name'];
// Gets the unique option id
if (isset($optionsframework_settings['id'])) {
$option_name = $optionsframework_settings['id'];
}
else {
$option_name = 'optionsframework';
};
$settings = get_option($option_name);
$options = optionsframework_options();
$counter = 0;
$menu = '';
$output = '';
i've just checked it and i change it from 7.3 to 7.2, 7.1 and 7.0 but the error is worst
Fatal error: Uncaught Error: Call to undefined function optionsframework_options() in /home/customer/www/dimaurorivestimenti.it/public_html/wp-content/themes/Primero/admin/options-interface.php:27 Stack trace: #0 /home/customer/www/dimaurorivestimenti.it/public_html/wp-content/themes/Primero/admin/options-framework.php(209): optionsframework_fields() #1 /home/customer/www/dimaurorivestimenti.it/public_html/wp-includes/class-wp-hook.php(292): optionsframework_page('') #2 /home/customer/www/dimaurorivestimenti.it/public_html/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters('', Array) #3 /home/customer/www/dimaurorivestimenti.it/public_html/wp-includes/plugin.php(484): WP_Hook->do_action(Array) #4 /home/customer/www/dimaurorivestimenti.it/public_html/wp-admin/admin.php(259): do_action('appearance_page...') #5 /home/customer/www/dimaurorivestimenti.it/public_html/wp-admin/themes.php(10): require_once('/home/customer/...') #6 {main} thrown in /home/customer/www/dimaurorivestimenti.it/public_html/wp-content/themes/Primero/admin/options-interface.php on line 27
Then when i set php version to 5.6.40 the error is just
Fatal error: Call to undefined function optionsframework_options() in /home/customer/www/dimaurorivestimenti.it/public_html/wp-content/themes/Primero/admin/options-interface.php on line 27
I had same problem with Pixwell Theme. Try to install and activate required plugins first.
I hope this reply saves time for other people having same problem
Uncaught Error: Call to undefined function pixwell_default_option_values()

PHPExcel $objDrawing Fatal Error

I'm trying to open xlsx file (link), but get fatal error
Fatal error: Call to a member function attributes() on a non-object in
PHPExcel/Reader/Excel2007.php on line 1509
line 1509:
$objDrawing->setWidth(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($xfrm->ext->attributes(), "cx")));
If delete this row with $xfrm variable error does not appear.
For PHPExcel developers:
Below is the condition if( $xfrm ), maybe you need to include the
problematic line in the condition?
$objDrawing->setWidth(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($xfrm->ext->attributes(), "cx")));
$objDrawing->setHeight(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($xfrm->ext->attributes(), "cy")));
if ($xfrm) {
$objDrawing->setRotation(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($xfrm->attributes(), "rot")));
}

Warning: Missing argument 1 for mock

I'm trying to make a service mock:
$this->mocker->mockService(
'manager.mikrotik',
new AtoumAdapter(
'\MyBundle\Services\MikrotikManager'
)
);
I get this error:
Warning: Missing argument 1 for
mock\MyBundle\Services\MikrotikManager::__construct(), called in
vendor/rezzza/mock-extension/src/Adapter/AtoumAdapter.php on line 45
and defined in vendor/atoum/atoum/classes/mock/generator.php(183) :
eval()'d code line 22
Where is my mistake?
Now I resolve using orphanize:
$this
->mocker
->mockService(
'manager.mikrotik',
new AtoumAdapter(
'\MyBundle\Services\MikrotikManager',
function ($generator) {
$generator->orphanize('__construct');
}
)
);
Here class __construct:
public function __construct($em,$mikrotikIp, $mikrotikUser, $mikrotikPassword)

WordPress Notice "Undefined Index"

I am getting following notice in WordPress
Notice: Undefined index: _wpnonce in /var/www/vhosts/abc.biz/php/func.php on line 338
Any solution?
Thanks for help
I found the solution, have to use isset() to check _wpnonce value, before comparing it.
if ( isset($_POST['_wpnonce']) && $_POST['_wpnonce'] = '123456789' ) {}
Thanks.

Wordpress Theme development: Getting Undefined index error

hello I am a wordpress theme developer. i created a theme which works fine in WP_DEBUG=False but gets undefined index error when I set WP_DEBUG=True
My theme has an options page, whenever i click on save i get these errors:
Notice: Undefined index: ang_temp in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 147
Notice: Undefined index: ang_breadcrumbs in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 147
Notice: Undefined index: ang_hide_social in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 147
Notice: Undefined index: ang_hide_tw in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 147
Notice: Undefined index: ang_hide_fb in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 147
Notice: Undefined index: ang_hide_ms in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 147
Notice: Undefined index: ang_hide_rss in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 147
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php:147) in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 156
Here is my themes functions.php
I don't know what I am doing wrong. I have very very little knowledge about php. Hope guys with php knowledge or wordpress theme development knowledge can help.
146. foreach ($options as $value) {
147. update_option( $value['id'], $_REQUEST[ $value['id'] ] ); }
The bit of code which is producing this error (above) is not checking whether $_REQUEST[ $value['id'] ] exists. The errors you are getting suggest that it doesn't (you will only get this notice with full error checking enabled). Other parts of your code are checking the existence of this variable before using it (so they are OK) and would suggest you should be doing the same here.
You say your theme works OK when debug is off, so this would suggest that you only need to check the existence of this variable before using it. Something like (replacing the 2 lines above):
foreach ($options as $value) {
if (isset($_REQUEST[ $value['id'] ])) {
update_option( $value['id'], $_REQUEST[ $value['id'] ] );
}
}
However, although this should prevent your 'errors' (they are only notices really), I'm unfamiliar with wordpress themes so can't say for sure whether this is expected behaviour or whether there is something underlying which is at fault.

Resources