Quantcast
Channel: Active questions tagged users - Drupal Answers
Viewing all articles
Browse latest Browse all 468

create a custom form based on user fields

$
0
0

I created new menu item witch I want to insert a custom form to edit some user fields :

$items['user/%user/edit-custom'] = array('title' => 'Knowladge','page callback' => 'drupal_get_form','page arguments' => array('user_profile_form_custom', 1),'access callback' => 'user_edit_access','access arguments' => array(1),'type' => MENU_LOCAL_TASK,);return $items;

Then the custom function that return the form :

function user_profile_form_custom(){  module_load_include('inc', 'user', 'user.pages');  global $user;    $user = user_load($user->uid);  $form = drupal_get_form('user_profile_form', $user, 'account', 'custom');   return $form;}

When visiting "user/%user/edit-custom" page I can see the profile page, then with some logic code in hook_form_alter I can hide some fields and show up only needed fields...

But the problem that I can't save the form, I get this error :

Fatal error: Call to undefined function user_profile_form_validate()in path_to_drupal/includes/form.inc on line 1514

this solution is inspired from answers described in this post .

Have you any idea please how to solve this, or if you have another way to get some user fields, edit them in a custom page, and save the changes.

Thanks in advance.


Viewing all articles
Browse latest Browse all 468

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>