I think I’m just too tired today, but for the life of me I cannot figure out how to modify the text or add another box to the registration page for the guest-user. Not the info telling the user what they get for registering, that is easy enough to change in the Admin page. What I need to do is add a box that says “Institutional affiliation” or similar. Right now it just asks for Username, Display Name, Email, Password, Password again for match. I have no idea where to modify that text either…
It is a little weird in ways, because it uses Omeka’s regular form for users. Changes in the
_getForm method in the
UserController.php file will probably make those changes possible, but you might have to do some Zend trickery to modify the form text and add the checkbox.
You’ll also need to know what to do with the data from “Institutional affiliation”. You’d probably need to add a hook for when the User is saved, and then store that additional data elsewhere, since there’s no place in it in the User data.
The UserProfiles plugin might get you closer to what you need without some of that work, depending on more of the details of what you need.
Thanks Patrick. A little more work than I imagined, I guess. I’ll have a look at the first things you mentioned.
How would I modify the UserProfiles plug-in to do this, if it’s possible?
With luck, no modifications at all! Of course, that’ll depend on exactly what you want to do with the Institutional Affiliation and other data. The idea of it is to link that kind of extra information about a user to their user id. So, you create different user profiles with different fields like this, and the info can be displayed whereever. It’s kinda heavyweight (it also requires the RecordRelations plugin) because it was designed for a big project, but it does the job of linking a User record to additional information, which is the most complicated part.
Basically, all we want to do is store the information somewhere for our records. It’s a legal issue. I suppose it would be nice to link it with the user profile as well. We already have the Record Relations plug-in installed, and I created a User Profile already that includes the field for Institutional Affiliation. I don’t really understand how the two link together though?
After it is all configured, after a guest user registers and logs in, there’s a drop-down for Profiles in the user info on bar across the top of pages. Users fill out their info there.
The alternative is to add things to the users form using the
users_form hook, then handling the data submitted with the
afterSaveUser hook, but that means a bigger new plugin to handle and display all the data.
I think we’d want the latter option - the point is for people to be able to enter that information when they register (again, I think it’s related to the legal issue), not after they’ve registered and logged in. From what I gather above, this seems like it would not be easy to do. If that’s the case, then I need to talk to the PI on the project because that’s extra development time.
EDIT: I talked to the PI and we decided it might be easier to just change the Display Name to reflect institutional affiliation, e.g., “Amanda (University/Institution)”. I suppose this is not the perfect solution, but at least it would be more likely that people would fill it out when they first register.
Related to this, I have a hopefully simpler question: can I modify the user profile public display such that it does NOT have “Add Input” and “Use HTML” as options (when on the edit page)? It seems to default to these options and that seems overkill for fields like “First Name” “Last Name” etc.
So, the easier change would work, as long as you don’t need to really track the info for legal reasons. There’s no way to check whether the info has been entered when it’s just a text addon to Display Name. As a separate field, you can mark it required, which seems to me closer to meeting legal requirements. Something to think about?
It’s not an easy task to remove the add input and use HTML buttons, unless you just hide them with CSS. They mimic the same Elements system that you see on the admin side. Needing to get rid of those, and the above separation of fields for what’s in Display Name, makes me lean toward a value in a new plugin to keep track of data.
This is mostly just things to think about alongside the conversations you’re having with your PI.
Well, I think it would just mean that it has to be required somewhere - I mean, that the field itself is filled out. We can’t really track whether or not people lie in the Display name field, but we can force them to fill something out (that is the legal issue, really).
For the Add Input and HTML Buttons, I see what you mean. But I can’t think of a use for them on the Admin side either, so perhaps hiding them with CSS is the solution in this case. I will see how far I get with that…
For the life of me, I cannot figure out where
is coming from. I want to modify that just to comment out the Add Input and HTML options (it doesn’t matter on the admin or public side, we don’t need these!). I looked everywhere and at the views/admin/form.php which seemed to be closest, but even that doesn’t seem to be correct. What am I missing?
EDIT: Never mind. Found it (UserProfiles / views / shared / profiles / edit.php). Seems like I also need to change UserProfiles / helpers / ProfileElementForm.php. I can’t figure out where to get rid of the “Use HTML” checkboxes though?
@patrickmj do you know where I can comment out the “Use HTML” checkboxes? I don’t quite understand how those are generated.
You’ll probably just need to modify the
helpers/ProfileElementInput.php file. The HTML it builds up at the end of the file adds in the
$components['html_checkbox'], so removing the places where that is created and added to the HTML should do the trick.
This topic was automatically closed after 250 days. New replies are no longer allowed.