I need to create profile page in admin with custom user fields (not only contact info, I know there are filters for that). Users on my site will be companies and not people, therefore I need to have profile page display fields like:
Display name etc….
Since I would like to do this without hardcoding the core files I came up with an idea.
I created a plugin that creates New Profile menu item and copied te code from edit-user.php. I needed to delete lines where we call admin-header and admin-footer to make it work and also I added a piece of code from profile.php “define(‘IS_PROFILE_PAGE’, true);”
Now, everything is working except I cannot get a new profile page to submit properly! The problem is in lines:
<form id="your-profile" action="<?php echo esc_url( self_admin_url( IS_PROFILE_PAGE ? 'profile.php' : 'user-edit.php' ) ); ?>" method="post"<?php do_action('user_edit_form_tag'); ?>> <?php wp_nonce_field('update-user_' . $user_id) ?> <?php if ( $wp_http_referer ) : ?> <input type="hidden" name="wp_http_referer" value="<?php echo esc_url($wp_http_referer); ?>" />
The thing is, when I change something on my New profile page it redirects me to profile.php, and when I change the parameter “form action=” to the New profile page the form does not get submitted at all.
I have searched the whole web for a solution on hidding some profile elements and only thing I know for sure that many people are searching for the same thing. If someone would help me figure out the submitting issue, we could finish the plugin which creates custom edit-profile page!
- The topic ‘Custom edit profile admin page’ is closed to new replies.