Pods Form in Ultimate Member
-
Hello,
I have a website where I use custom posts (Pods plugin) to generate entries for units, microscopes and workshops. Now I want specific members of different units to be able to alter their entries. Therefore I use the Ultimate Member plugin.
I want to use a Pods form to change the entries. Here is a link to the testpage of the Pods form, where it works just fine (not a part of the ultimate member plugin):
Here is the full code I wrote in my own plugin to hook into the ultimate member plugin:
/* add new tab called "miapunittab" */ add_filter('um_account_page_default_tabs_hook', 'my_miapunit_tab_in_um', 100 ); function my_miapunit_tab_in_um( $tabs ) { $tabs[800]['miapunittab']['icon'] = 'um-faicon-pencil'; $tabs[800]['miapunittab']['title'] = 'Edit MIAP Unit details'; $tabs[800]['miapunittab']['custom'] = false; $tabs[800]['miapunittab']['show_button'] = false; return $tabs; } /* make our miapunittab hookable */ add_action('um_account_tab__miapunittab', 'um_account_tab__miapunittab'); function um_account_tab__miapunittab( $info ) { global $ultimatemember; extract( $info ); $output = $ultimatemember->account->get_tab_output('miapunittab'); if ( $output ) { echo $output; } } /* content in the miapunittab */ add_filter('um_account_content_hook_miapunittab', 'um_account_content_hook_miapunittab'); function um_account_content_hook_miapunittab( $output ){ $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 .= get_the_title() . $miap_unit->form($fields); return $output; }
Each user can only alter one unit. First thing to notice is that a loading circle appears at the end of the Pods form and when you click the ‘Save Changes’ Button it shows an red error box: An error has been encoutered.
The WP error log has the entry:
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
Any idea to fix that problem?
Best regards,
ArneThe page I need help with: [log in to see the link]
- The topic ‘Pods Form in Ultimate Member’ is closed to new replies.