Drupal: customizing user register form - drupal

I want to customize the user/register form.
When the anonymous user goes on this page I don't want to show the tabs Create new account, Log in, Request new password, and don't want to see the fieldset Account information with a username and email.
How can I do it in Drupal 6?

The tabtamer module lets you control what tabs are visible from the admin pages.
I'm not sure if it's possible to remove the user profile page entirely, but a module like login_destination or logintoboggan let you control where the user goes when they log in.

Related

gvNix: How to restrict access based on roles

I'm developing an application using gvNix. I used typicalsecurity addon to secure my application. What I need now is to allow the user to update only their profile. i.e. the user can see a profile tab on the nav bar menu, and when clicking on it, a form should be displayed containing only their data.
I tried adding the following to my code, but it restricts the access even to the admin.
#RooWebScaffold(path = "users", formBackingObject = User.class, delete=false, create=false);
The xml here removes the menu tab or part of its sub items, so it doesn't show an option to edit the profile
...
xmlns:sec="http://www.springframework.org/security/tags"
...
<sec:authorize ifAllGranted="ROLE_ADMIN">...</sec:authorize>
Usually all the users should update their profiles, so the link should be visible for all users.
Then modify the controller method that handles that request to get the user principal for the requester, this is the way to load the profile of the loged user.
To get the principal of the user read the Spring Security docs.

Force anonymous to register before submitting a form. Drupal 7

I want to force anonymous to register an account before submitting the form.
So I have to allow permission for anonymous to access the form,
Then I use hook_form_FORM_ID_alter to edit form. Then I wanted to redirect submit button to another link if it is clicked by anonymous.(I still have no idea how to do it. It would be nice if anyone can tell me)
Is this the right solution?
For now,
I have a pop-up a login form (Modal forms and Facebook OAuth). In the form there is a register button. Then If user choose to register I want to keep the form that he have already input and show it after he confirm his email.
Thank you.
Off the top of my head, I would allow the form to be submitted either by an anonymous user or a registered one.
in my function MYMODULE_MYFORM_submit() I would check to see if the user is logged in.
If yes proceed as normal, if no, store the form, either in a temp SESSION variable or into a custom MySQL table and forward the user to login/register page (mysite.com/user) using drupal_goto('user')
once the user was registered you could then check for the existence of the form in the SESSION array or your MySQL table, and then carry on with the process as you would if the user had been logged in in the first place
Hope this makes sense or is of help

Remember login from WordPress password protected page

I know how to password protect a page and check if it has been entered with post_password_required. What I need to know is if I can then continue to know if a user has logged into this password protected page even after leaving it. The reason for this is because I would like to display a site wide navigational sidebar that allows the user to get back to that page, but only have it show if they have logged into that page earlier.
Set a session variable if they login successively to the given page, then when they are on another page later, have the sidebar echo the link if that session var is set.
The value of the session var can be the url to create the link, if you have more than one page you're trying to do this with.

removing create new account tab from login page in drupal 7

Drupal login page, while going from url ?q=user shows you login form and it also shows Change password and Create new account tabs .
I want to remove the Create new account option/tab from there and also I do not want user to access registration page even via url: ?q=user/register.
Anyone?
To hide the Create new account tab in the /user path, you can insert the following in your module code:
function modulename_menu_alter(&$item) {
// Hide the "Create new account" tab
$item['user/register']['type'] = MENU_CALLBACK;
}
This hides the tab but still allows for /user/register to be accessed.
Open the Configuration admin menu, and under the People heading click Account Settings. Under the heading Who can register accounts? select Administrators only and then save the settings.
The Tab Tamer module will do this. Just make sure you choose hidden and not disabled, otherwise users will get access denied errors.
Home>administration>configuration>people> who can register accounts> select administrators only
To remove the "Register Tab" in login page for visitors, go to Administration>>Account Settings>> select the administrator to create the account. Save the changes. By doing this, only "Admin" can create the accounts. Users cannot see the "Register" Tab.

Drupal Modify Login System

I'm newbie in drupal...
I have a drupal website, and i want to extend its login system - i've been looking around the code but end up with headache.
what i wan to do is:
I want to put additional hidden form inside any login form
create a session variable that will be used on login process (after user click submit) and then destroy the session after that.
extend the login validation system inside drupal based on point 1 & 2 above - so i need to to control if my extended validation is valid (and drupal validation is valid) then go to where? otherwise then go to where?
so with that I'll have my own login system + drupal login system
Is somebody ever try this before?
fyi: I'm using drupal 6
Thank you in Advance for helping me
And
To modify the login form, you will likely need hook_form_alter() and knowledge of the Form API
You can add additional elements to the login form, including hidden fields. Hidden can either mean hidden html form elements (<input type='hidden'/>) or values that are not output in the HTML at all but are stored server side for the corresponding validate and submit functions.
You can add additional functions to $form['#validate'] to change the login criteria (whether the login is accepted or not)
You can add additional functions to $form['#submit'] (note the '#') to add operations to perform after the user's login has passed validation. The default submit handler, user_login_submit(), simply redirects the user to their account page.
You should also consider checking http://drupal.org/project/logintoboggan . Logintoboggan is a module that tweaks and changes Drupal's default login by adding a lot of features. You can see how they achieved certain functionalities by reading the code. That will help you when you write your own code.

Resources