On user registration, I want to show a field on "Yes" choice of a radio button. This working fine when I'm logged in as admin. But anonymous user cannot see that field. When I saw the source code of the page, there wasn't any conditional field related js. From permissions, there's only one permission for conditional field "admin conditional field" and even after enabling that permission to anonymous user, still cannot see that field.
I haven't seen the module, but I will recommend using custom module and javascript in that for such small requirement.
Related
I have a view serving an entity reference field. I need it to:
(1) pull content authored by the currently logged in user,
(2) unless the currently logged-in user has "administrator" role, in which case pull all content.
Currently I have the contextual filter set to "authored by," which works fine for requirement (1). I think I need it to bypass the filter based on role. For "block" or "page" displays, I can just duplicate a display, set permissions for it based on role, and it's seamless. But because this is an entity reference field, I can only specify one display in the field settings. Any ideas?
In Drupal 8 I was able to do this without any contrib module like contextual filters OR.
add the Authored By contextual filter for your entity type
choose provide default value... from logged in user
below in the "when value provided" section select "specify validation criteria
For validator select User ID
check "restrict user based on role"
select your NON-ADMIN roles
for "Action to take if filter value does not validate" select "display all results"
So if viewed by the non-admins is will show only where the logged in user id matches the entity owner. For admins it will show all.
On my company's Drupal 7 site, I created a field for one of our content types through the admin UI. We decided to hide it from the user until some styling changes make it through to production. Is there a was to programmatically unhide the field via an update hook? I know get at least some of the field information through the field_info_field function, but I'm not sure how if it contains the setting needed to make the field visible to the user. Any help on this would be appreciated.
I know I can unhide it through the UI once the changes hit production, but it would be nice to have an automated way of doing this.
You can hide it programmatically from it's node template with hide() function:
https://api.drupal.org/api/drupal/includes%21common.inc/function/hide/7.x
You can do that conditionally, i.e. by checking user role first.
Now, I'm not sure will this work from update hook, and I'm not even sure why you want to use that hook?!? If users are allowed to edit that content type and you actually want to hide it from edit form then check out my answer here:
Drupal 7 - Hide certain form fields of a content edit form depending on the content data
You can use https://www.drupal.org/project/field_permissions drupal module to hide and unhide fields to users of specific role.Initially during development the field can be made visible to admin role and then later on the permission can be granted to users of other roles
When I create a custom form for a custom user role using ultimate member plugin, it doesn't work. Only the default profile form works. Please what can be the problem. I need to create different profile forms for different types of users
The cause of this issue is that the original User page only contains the shortcode for the default profile form.
After you create all of your custom profile forms, and assign the relevant roles to each (Form Settings -> Disable Global Settings -> Select Role), you need to add the short codes of all your forms to the User page, just one after another.
UltimateMember will decide which of the forms to display depending on the user's role.
So on the view user page, add the shortcode for the custom form, in addition to the existing default profile form.
It's a bit weird to have multiple shortcodes but it will only show the one for that role.
Also make sure to assign a the Custom Role to the Custom Form, as stated by Michael Rodriguez
I'm trying to create a rule/ruleset that:
Is triggered when a user registered with the site
Then (depending on a CCK field value included in the registration) add that user to a role
Then redirect the user to a profile page.
I've tried no end of times and simply can't get it to work.
I can create a triggered rule which fires upon registration (but doesn't allow me to perform all actions needed), nor does it allow me to select the ruleset with all the actions needed using rules schedular.
One of the reasons I'm not allowed to select the ruleset under a triggered rule is the "arguments are not passed".
Any help is really appreciated or perhaps another way of achieving what I'm trying to do.
I am gonna guess that you are probably using content the module content profile to use CCK content types for user profiles, and that you have the content profile fields visible in the registration form. your problem is that you need to load the profile to be able to access values in the fields there.
Your best bet is to use http://drupal.org/project/autoassignrole to handle the role assignment and then, use a rule to set the content profile field (if you really need to set that) once the user logs in.
I am using the Drupal 6 module Content Profile to allow using a CCK defined type as a user profile which is working well. The issue I have is that I want the first completion of the profile to trigger an action however the user may save the profile without completing it. My thoughts on this is to have a checkbox by the save button which states 'My profile is complete' which the user will select once they are happy with it, and I have another module which creates a trigger by using the node_api hook and checking the type of the node, the action, and the value of this checkbox.
Once this trigger has been raised I don't want that checkbox to appear again however. If I could set the visibility of the checkbox using PHP code that would work as I could write a short script to determine if the completed action has already happenede and if so hide the checkbox. Is there a module that allows this? I haven't been able to find one.
I have also looked at using the same node_api hook to manipulate the profile as it is being displayed however the node just seems to have the values for the fields and not a form object that can be manipulated as I would have expected. IS there a way to programatically manipulate a CCK form?
Thanks
I think hook form alter is what you are after. This can perform alterations to a form before it is rendered.
I would suggest another approach using the Save & Edit module. Set your CCK profile type as "unpublished" by default. Allow users to save it and/or save AND publish it with this module. On publish, use triggers and actions.
This approach is arguably more in keeping with the Drupal way - configuration over customization.