Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

I don't see the profile TABS #39

Closed
Fiselier opened this issue Jan 2, 2025 · 12 comments · Fixed by #40
Closed

I don't see the profile TABS #39

Fiselier opened this issue Jan 2, 2025 · 12 comments · Fixed by #40

Comments

@Fiselier
Copy link

Fiselier commented Jan 2, 2025

i don't see the Profile tab when editing a user account. Fieldsets are there (when that option is selected in profile config)

@argiepiano
Copy link
Contributor

Did you try going to admin/config/people/profiles and enabling the tabs?

@argiepiano
Copy link
Contributor

argiepiano commented Jan 3, 2025

You are right. This is a bug. The tabs are shown fine when I edit my own account, but not when editing another user

My account:
Screen Shot 2025-01-02 at 6 41 53 PM

Another user:
Screen Shot 2025-01-02 at 6 42 50 PM

@argiepiano
Copy link
Contributor

argiepiano commented Jan 3, 2025

Additionally, if I try to access the profile edit page for a user that's not me (I'm the admin) by visiting user/UID/edit/main I get Access denied! Which explains why the profile tab is not shown. However, when profile edits are done with the fieldset, as you mentioned, they can be edited by the admin.

@argiepiano
Copy link
Contributor

@bugfolder there is a logic error in profile_access(). The function checks:

 if (user_access('administer profiles', $account)) {
    return TRUE;
  }

which should be TRUE for the admin user. BUT the problem is that the parameter received into $account is the user object for the user being edited, not for the user who's doing the editing. Since I'm trying to edit the profile of an authenticated user who doesn't have administer profiles privileges, this fails.

Therefore, the admin (who has the permission) can't see the tabs and can't edit the profile of another user when tabs are selected.

@argiepiano
Copy link
Contributor

My suggestion is to modify to:

 if (user_access('administer profiles')) {
    return TRUE;
  }

so that this checks if the current user has that permission.

@argiepiano
Copy link
Contributor

PR submitted. #40. @Fiselier, if you could test patching the module, that'd be great. Don't forget to clear caches after that.

@Fiselier
Copy link
Author

Fiselier commented Jan 3, 2025

Hi @argiepiano It is okay this way! Thanks. Can you btw think of a way to transfer fields from the main to another profile? I don't like tampering in SQL tables. Coming from a drupal 7 site I imported 300+ members, but the 'import module' doesn't allow to map to profile fields (yet)...

@argiepiano
Copy link
Contributor

Can you btw think of a way to transfer fields from the main to another profile?

I recommend using Feeds combined with Feeds entity processor, which will allow you to map fields to the Profile entity.

bugfolder added a commit that referenced this issue Jan 3, 2025
Issue #39. Correctly check administer profiles permission for current user.
@Fiselier
Copy link
Author

Fiselier commented Jan 3, 2025

Can you btw think of a way to transfer fields from the main to another profile?

I recommend using Feeds combined with Feeds entity processor, which will allow you to map fields to the Profile entity.

Hi Alejandro, I'm able to import users with Feeds, but using the same csv with the profile parser mapping other columns to a profile doesn't work. Resulted in "An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?id=757&op=do_nojs&op=do StatusText: Service unavailable (with message) ResponseText: ". No error log though.

Maybe I'm connecting the pid (unique) and user fields incorrectly (I used the same for both). In 'User Import' there was a UID field, in 'Profile parser' there isn't or called 'user'. KR, Frank
Screenshot 2025-01-03 225330

@argiepiano
Copy link
Contributor

argiepiano commented Jan 4, 2025

@Fiselier maybe we should continue this discussion somewhere else, since it's not related to the original problem you reported. I suggest you create an issue in the Feeds entity processor queue, or post this in the Backdrop CMS forum.

One of the problems you have to deal with is that the original uid (user) for the Profile entities in D7 will most likely be different from the uid after you import your users in Backdrop. The uid (user) column in Profile is what links the profile entity to the specific user. This will require some juggling - probably creating an additional column for each profile row indicating the new uid from the newly imported users in Backdrop.

As for the error message you got, the "AJAX HTTP error" you got doesn't tell you much about what happened - this type of error happens when a batch process encounters an issue and fails. You'll need to inspect the log under Reports to really find out what happened.

@argiepiano
Copy link
Contributor

BTW, in D7, there is a Feeds processor specifically designed for Profile: https://www.drupal.org/project/feeds_profile2. It'd be interesting (and probably pretty easy) to port this.

@argiepiano
Copy link
Contributor

@Fiselier I've done an initial port of Feeds Profile2, which adds mapping for profile entities by extending the User feeds importer. This should help you import profile entities at the same time when you import your users.

Important: I haven't yet don any testing of this!!!

https://github.com/backdrop-contrib/feeds_profile

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants