Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
By wasid on
I have successfully added profile2 module form in a custom area using both ctools widget and blocks by this code:
global $user;
module_load_include('inc', 'profile2_page', 'profile2_page');
$profile2 = profile2_load_by_user($user->uid, 'teacher_profile');
if (!$profile2) {
$profile2 = profile2_create(array('type' => 'teacher_profile'));
$profile2->setUser($user);
$profile2->is_new = TRUE;
$profile2->save();
$profile2 = profile2_load_by_user($user->uid, 'teacher_profile');
}
$data = entity_ui_get_form('profile2', $profile2, 'edit');
return $data;
All the functionalities are alright! But there are two issues I wanted to solve.
1. (Major Issue) Ajax refresh is not working in terms of image upload and when I put Unlimited Number of values in the filed collection. Though when I click submit it's showing the added fields to the filed collection after page refresh. Then I have to submit again.
2. When I save data I want to redirect to custom URL.