Whenever i enable this module it causes access denied error on user edit page

Comments

jonathanhuot’s picture

+1 it's very annoying.. :(

lagon’s picture

Dunno about you guys, but i found that this behavior is exhibited when content type "profile" => "Profile edit Tab" has "None" or "Show a tab at the user's page" selected. Got around it by selecting "Show a secondary tab below the user's edit tab".
Hope this help~

kenorb’s picture

Title: Access denfied error on edit profile » Access denied error on edit profile
drupalworlds’s picture

Hi,

I just removed(disabled) this account profile module, then I can edit the profile again.

This module may have some bug ...

regards

kenorb’s picture

Marked as duplicate: #818026: Warning & access denied on edit page!
Do you get as well 'warning: Missing argument 2 for user_category_load()' in the same time when there is Permission Denied?

drupalworlds’s picture

After deleting the module, there was no warning message at all.

kenorb’s picture

PS. Make sure that you have existing profile via Content Profile module, which is:
at least one of the content type should have option 'Use this content type as a content profile for users' enabled.

piotr.loposzko’s picture

When I set "profile" => "Profile edit Tab" to 'Show a tab at the user's page' I had the same error.
Here is a patch(for account_profile.module):

switch ($form_id) {
     case 'user_profile_form':
         if (variable_get('account_profile_redirect', TRUE)) {
+          $profile_edit_tab = variable_get('content_profile_' . $profile, '');
+          $edit_tab = $profile_edit_tab['edit_tab'];
           if (isset($_REQUEST['destination'])) {
             $destination = $_REQUEST['destination'];
             unset($_REQUEST['destination']);
-            drupal_goto($_GET['q'] . "/$profile", array('destination' => $destination));
+            if ($edit_tab == 'top') {
+              drupal_goto('user/' . arg(1) . "/profile/$profile", array('destination' => $destination));
+            }
+            else {
+              drupal_goto($_GET['q'] . "/$profile", array('destination' => $destination));
+            }
           }
           else {
-             drupal_goto($_GET['q'] . "/$profile");
+            if ($edit_tab == 'top') {
+              drupal_goto('user/' . arg(1) . "/profile/$profile");
+            }
+            else {
+              drupal_goto($_GET['q'] . "/$profile");
+            }
           }
           // header("Location: " . base_path() . $_GET['q'] . "/$profile");
           exit;
kenorb’s picture

Status: Active » Needs review
kenorb’s picture

Status: Needs review » Needs work

Thank you for effort and the patch.
Unfortunately this patch could conflict with 'me' module.
So relying on arg(1) is not always a good idea.
See: #929344: Integration with 'me' module
Look something similar to:

      $uid = arg(1);
      if (module_exists('me') && arg(1) == 'me') {
        global $user;
        $uid = $user->uid;
      }
Rosamunda’s picture

Can anyone confirm #8?
I have two types of profiles (according to the user´s role), but this module merges the two profiles and the edit tab, all in one.
Even with the patch...

vishun’s picture

Rosamuda, it appears you may have a different issue best suited for a different/new thread. I can confirm that #2 is correct regarding the content profile tab setting.

Rosamunda’s picture

Thanks for your reply :)
I´ve tried #2 and it works. But when you have two profile types (each for a different user role), it merges both of them in one profile to everybody (without any regard to the role).

Rosamunda’s picture

The problem is here (I think): admin/settings/account_profile
There you have this:
Main Profile:
[X] Profile Type A (radio checkbox, I can´t choose the two)
[ ] Profile Type B
Choose the main profile which should contain user fields.
[X] Redirect on User Edit page
[ ] Disable the normal User Edit tab

If you uncheck "Disable the normal User Edit tab" it won´t do anything, the problem remains when you have more than one profile type.
If I check "[ ] Profile Type A" That profile will be ok: The user will be able to access his profile with the password fields.
BUT the user of "[ ] Profile Type B" won´t.

So I think that the problem is there: You should be able to choose both checkboxes (now are radio checkboxes).

Rosamunda’s picture

In account_profile.admin.inc you have this:

  $form['account_profile']['account_profile_main_profile'] = array(
    '#type' => 'radios',
    '#title' => t('Main Profile'),
    '#description' => t('Choose the main profile which should contain user fields.'),
    '#default_value' => variable_get('account_profile_main_profile', key(content_profile_get_types('names'))),
    '#options' => content_profile_get_types('names'),
  );

Sadly, you just can´t replace '#type' => 'radios' to '#type' => 'checkboxes', because that way, none of the profiles will show the password field.

Rosamunda’s picture

Maybe a workaround: when you have more than one profile:
-- You set "Show a secondary tab below the user's edit tab" as the available option at the content profile page (/admin/content/node-type/profile/profile)
-- In this module´s settings (/admin/settings/account_profile) you set:
Main Profile:
[X] Profile Type A
[ ] Profile Type B
Choose the main profile which should contain user fields.
[ ] Redirect on User Edit page
[ ] Disable the normal User Edit tab

You just have to disable those two options. It´s a nasty workaround, because it just gives the user the access to the account in the normal way in one case, and it works as intended in the other case (the one that´s checked).
At least it won´t give you an error when you try to click the user´s edit page...

kenorb’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)

Closing as per Drupal 6 end-of-life.