Hello,
I am trying to make a directory for my website (currently on my localhost) that will allow users to login and edit there own info from the front end.
I started with the connections plugin for the directory. I have created a custom page template and made a link from the directory display page to my custom page template for editing (if the users last name matches the directory listing).
I want to be able to use the same code for the plugins edit form on my custom (front end) page template. How can I do that?
Here is the code:
<?php
if (current_user_can('connections_edit_entry'))
{
$id = esc_attr($_GET['id']);
//check_admin_referer('entry_edit_' . $myid);
//add_meta_box('metabox-name', 'Name', array(&$form, 'metaboxName'), $connections->pageHook->manage, 'normal', 'high');
$form = new cnFormObjects();
$entry = new cnEntry( $connections->retrieve->entry($id) );
echo '<div id="poststuff" class="metabox-holder has-right-sidebar">';
echo '<h2><a name="new"></a>Edit Entry</h2>';
$attr = array(
'action' => '?page=connections&action=update&id=' . $myid,
'method' => 'post',
'enctype' => 'multipart/form-data',
);
$form->open($attr);
$form->tokenField('update_entry');
wp_nonce_field('howto-metaboxes-general');
wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false );
wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false );
echo '<input type="hidden" name="action" value="save_howto_metaboxes_general" />';
echo '<div id="side-info-column" class="inner-sidebar">';
do_meta_boxes($connections->pageHook->manage, 'side', $entry);
echo '</div>';
echo '<div id="post-body" class="has-sidebar">';
echo '<div id="post-body-content" class="has-sidebar-content">';
do_meta_boxes($connections->pageHook->manage, 'normal', $entry);
echo '</div>';
echo '</div>';
$form->close();
echo '</div>';
?>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready( function($) {
// close postboxes that should be closed
$('.if-js-closed').removeClass('if-js-closed').addClass('closed');
// postboxes setup
postboxes.add_postbox_toggles('<?php echo $connections->pageHook->manage ?>');
});
//]]>
</script>
<?php
unset($entry);
}
You can see that "add_meta_box" is not working and causes my page to crash
??
Thanks,