THANKS AND MYSTERY PROBLEM QUESTION
-
Hey Team,
Wanted to thank you for all the work you put into this product. Using it has enabled me to write my own MUCH more quickly than expected, from what I learned using CMB2. I had to do it, since the loading time and memory usage was killing my admin section, given the hundreds of records.it has No impact on the WordPress tables, direct loading from a custom database, using HTML5 and more PHP oriented with minimal supportive JavaScript, including the image preview.
BUT, I do have a mystery problem and I was wondering if your team ran into it. At this moment, I have no clue as to why….
The loading and saving to the database, via a POST, works fantastic on the front end. (shortcode access and not using a custom post). But the ADMIN section, which I used a custom post and display the repeatable fields based on the post type, all records can be saved except 1. The first one. HUH? The remaining records save perfectly, but record #1 does not even receive the set post. Each record is displayed by the same function call, so there is nothing unique about the meta-box display, just record one does not activate.
Is there someone about a post within a meta-box that is unique?
here is the core of the code, having removed all but one field for simplicity. Subsequent records of 2 or more, save properly and it does not matter if I change the name of the submit field. Simply does not hit.
`
function mmd_list_admin_service_manualentry() {$labels = array(
‘name’ => _x( ‘Manage Lists’, ‘mmd_list’ ),
‘singular_name’ => _x( ‘Manage List’, ‘mmd_lists’ ),
‘add_new’ => _x( ‘New List’, ‘mmd_list’ ),
‘add_new_item’ => __( ‘Add New List’ ),
‘edit_item’ => __( ‘Edit List’ ),
‘new_item’ => __( ‘New List’ ),
‘all_items’ => __( ‘Member Services Lists’ ),
‘view_item’ => __( ‘View List’ ),
‘search_items’ => __( ‘Search List’ ),
‘not_found’ => __( ‘No Listing found’ ),
‘not_found_in_trash’ => __( ‘No Listings found in the Trash’ ),
‘parent_item_colon’ => ”,
‘menu_name’ => ‘HPN Services’
);$capabilities = array(
);$args = array(
‘register_meta_box_cb’ => ‘servicelist_meta_box’, // Register a meta box
‘labels’ => $labels,
‘description’ => ‘This post type holds all posts for your directory items.’,
‘public’ => true,
‘menu_position’ => 10,
‘show_ui’ => true,
‘supports’ => array( ‘title’ ),
‘has_archive’ => true,
‘menu_icon’ => ‘dashicons-media-spreadsheet’,
);register_post_type( ‘servicelist’, $args );
}//—————————————————————–
// CUSTOM CATAGORY
//—————————————————————–
function mmd_list_service_taxonomies() {
$labels = array(
‘name’ => _x( ‘List Categories’, ‘List Categories’ ),
‘singular_name’ => _x( ‘Category’, ‘taxonomy singular name’ ),
‘search_items’ => __( ‘Search List Categories’ ),
‘all_items’ => __( ‘All List Categories’ ),
‘parent_item’ => __( ‘Parent List Categories’ ),
‘parent_item_colon’ => __( ‘Parent List Category:’ ),
‘edit_item’ => __( ‘Edit List Category’ ),
‘update_item’ => __( ‘Update List Category’ ),
‘add_new_item’ => __( ‘Add New List Category’ ),
‘new_item_name’ => __( ‘New List Category Name’ ),
‘menu_name’ => __( ‘List Categories’)
);
$args = array(
‘hierarchical’ => true,
‘labels’ => $labels,
‘show_ui’ => true,
‘show_admin_column’ => true,
‘query_var’ => true,
‘rewrite’ => array( ‘slug’ => ‘servicelist_cat’ )
);register_taxonomy( ‘servicelist_cat’, ‘servicelist’, $args );
}// Add the callback function for the metabox.
function servicelist_meta_box(WP_Post $post)
{
$prefix = ‘servicelist’; // Custom Post Name
add_meta_box($prefix, ‘HPN Services Lists’, servicelist_service_manual_form);
}//—————————————————————–
// ENTRIES OF SERVICES/MEMBER LISTINGS – MANUAL
//—————————————————————–
function servicelist_service_manual_form($post)
{
echo “Click on header to open * = required fields”;
$DatabaseData = retrieve_records(“11097″);
$TotalRecords = $DatabaseData[0];
for($RecordIndex=1; $RecordIndex <= $TotalRecords; $RecordIndex++)
{
$RowData = $DatabaseData[$RecordIndex];
servicelist_DisplayServiceRecord($post->ID, $RecordIndex, $RowData);
}
}function servicelist_DisplayServiceRecord($ListId, $cardid, $DBRecord)
{if($DBRecord!=0)
{
$businessname = $DBRecord[‘BusinessName’];
}$SubmitCode = ‘SUBMIT’.$cardid;
if(isset($_POST[$SubmitCode]))
{
//// retrieve data and save
}?>
<div id=”header<?php echo $cardid;?>” name=”header<?php echo $cardid;?>” class=”admin-form-header” onclick=”OpenShutRecord<?php echo $cardid;?>()”>
<h1><?php echo $cardid;?> : <?php echo $businessnamelabel;?> ➠</h1>
</div><div class=”form-style-10″ id=”Record<?php echo $cardid;?>” name=”Record<?php echo $cardid;?>”>
<form id=”SUBMIT_<?php echo $cardid;?>” name=”MMD_SUBMIT_<?php echo $cardid;?>” action=”” method=”post” >
<div class=”section”><span>1</span>Listing Information</div>
<div class=”inner-wrap”>
<label>Business Name*<input type=”text” required=”required” id=”businessname<?php echo $cardid;?>” name=”businessname<?php echo $cardid;?>” value=”<?php echo $businessname; ?>” placeholder=”” /></label>
</div>
</div><div class=”button-section”>
<input type=”submit” id=”SUBMIT<?php echo $cardid;?>” name=”SUBMIT<?php echo $cardid;?>” value=”SAVE CHANGES “/>
</div>
</form><?php
}
`
- The topic ‘THANKS AND MYSTERY PROBLEM QUESTION’ is closed to new replies.