Hi @arnefallisch
I do not understand why you are using ob_start in the first place. the form() method isn’t outputting anything, it just returns the HTML so you don’t need to use output buffering at all.
Let me know if this helps!
Cheers, Jory
Hi @keraweb
when I do not use ob_start the form appears over of the ultimate member account tab. But I want it to appear right next to it on the rigth side. Therefore I have to use ob_start. The Pods form also shows a loading sign at the button between the last entry and the button, although it is completely loaded. The saving of the entries does not work anymore. The message that states “An error has been encountered” appears after submitting the form.
Here is a link to the testpage of the form, where it works just fine (not a part of the ultimate member plugin):
miap.eu/test/
Here is the full code of the function if that helps:
/* content in the miapunittab */
add_filter('um_account_content_hook_miapunittab', 'um_account_content_hook_miapunittab');
function um_account_content_hook_miapunittab( $output ){
ob_start();
$user = wp_get_current_user();
$args = array(
'post_type' => 'miap-unit',
'author' => $user->ID,
'posts_per_page' => -1,
'post_status' => 'publish'
);
$query = new WP_Query($args);
if ($query->have_posts()) :
while ($query->have_posts()) : $query->the_post();
$miap_unit = pods('miap-unit', get_the_ID());
$fields = array( 'unit-alert-title', 'unit-alert', 'unit-news-title', 'unit-news', 'unit-abbreviation', 'unit-affiliation', 'unit-zip-code', 'unit-city', 'unit-street', 'unit-street-number', 'unit-phone-number', 'unit-fax-number', 'unit-email', 'unit-homepage', 'unit-booking-page', 'unit-by-train', 'unit-by-car', 'unit-by-car', 'unit-description', 'unit-thumbnail', 'unit-logo');
echo get_the_title() . '<br />';
// Output a form with specific fields
echo $miap_unit->form($fields);
endwhile;
endif;
$output .= ob_get_contents();
ob_end_clean();
return $output;
}
Best regards,
Arne
-
This reply was modified 1 year, 3 months ago by
arnefallisch.
-
This reply was modified 1 year, 3 months ago by
arnefallisch.
Hi @arnefallisch
As I mentioned, ob_start is only required if you cannot change the behavior of output.
Both get_the_title()
and Pods::form()
are returning the values so you can omit echo
and ob_start
usages and assign the return values to the $output
variable.
Just make sure you don’t echo
any values so you don’t need buffering.
Cheers, Jory
Hi @keraweb,
I understand what you mean now. Unfortunately that does not solve the problem. The error is still the same.
Best regards,
Arne
Hi @keraweb
actually there is no error message from WordPress only the a red marked Box that states:
An error has been encountered!
Best regards,
Arne
Hi @arnefallisch
Then please enable WP Debug or check your server logs!
Debugging in WordPress
Cheers, Jory
Hi @keraweb
sorry for the misunderstanding but of course I enable the WP Debug, but it shows no errors at all. I think it must have something to do with how the ultimate member plugin calls the function containing the form.
Best regards,
Arne
Hi @keraweb
I tried something else. I turned on the WP Debug Log instead of showing it directly and now I receive the eroor in the log
Undefined index: um_account_nonce_miapunittab in /var/www/miap.eu/wp-content/plugins/ultimate-member/includes/core/um-actions-account.php on line 20
I this line 20-22 I got the following code:
if ( ! wp_verify_nonce( $args[ 'um_account_nonce_' . $tab ], 'um_update_account_' . $tab ) ) {
UM()->form()->add_error( 'um_account_security', __( 'Are you hacking? Please try again!', 'ultimate-member' ) );
}
Hi @arnefallisch
This would be an issue for Ultimate Member to look at. Please notify their support on this error!
Cheers, Jory
Hi @keraweb
I think so too. Thank you for your support.
Best regards,
Arne