drupal registration redirect and user details - drupal

After registration the user is redirected to a welcome page . How to get display the respective user details in redirected(welcome) page?.
for ex: welcome username . how to get user name in redirected page

When a user is logged in, you always have the global $user object available. So all you really need to do, is to access it and insert the name.
I'm not sure what page your users are redirected to, you can change that, but to alter the output you only need the normal theme/template overwrites that you can do with Drupal.

We do this using the Profile, Blocks, and Views modules. A view could include only the logged in username as you require, but ours also includes several profile fields that logged in users may choose to complete. The view has a block display - we configure that block to display only on certain page paths through the block administration screens.

You can use actions, and triggers.
Using them, you can define an action (show message to the user) that is triggered when a user logs in. The action to show a message to the user allows you to use tokens; one of them is for the username.

Related

Drupal maintain rejected user list and authenticate from among

Im developing a drupal website with multistep approval of users ,after
registration the admin rejects a user an email is sent to the user and the user
is deleted from drupal user table .
I want to perform a action where in after a user is rejected he will be kept in
a new table with the username and email .
If the same user contacts admin,the admin will remove the user from the rejected
users list ,because during registration for second time it should also check for
the user in the rejected user list.
Is i t something that is possible in Drupal?
Any pointers?
Everything is possible except the wooden stove! Show some effort, try something on your own and when you get stuck ask.
There's no out of box solution for this (that I know about it), but what I would do is make custom content type for storing users and use hook functions to insert/check existence of rejected users.
hook that is called when user is deleted:
https://api.drupal.org/api/drupal/modules%21user%21user.api.php/function/hook_user_delete/7.x
hook that is called when node (rejected user) is deleted
https://api.drupal.org/api/drupal/modules!node!node.api.php/function/hook_node_delete/7.x
But maybe your admin can just disable user instead of deleting it as first step - that way wouldn't need that extra table at all.

How to restrict a user in asp.net?

I create a signup page, after sign up, user go to a page that is "Complete your profile".
When user complete the profile data will be stored in data base.
I want that if user completed the profile, than they cannot again entered data into a page.
If user again try to enter the data, page will not allowed to that user to again enter data,
and show message to user "You have already completed your profile".
How can I restrict the user?
Anyone tell me how?
You can check what you want to decide that a profile is complete or none in a method.(e.g IsProfileCompleted(string userId);) and call this method inside your profile entry action.
ProfileEntryAction()
{
if(IsProfileCompleted(string userId))
return View("ProfileCompleted");
return View();
}
When the user navigates to the Profile page, before actually showing the Profile page, check (server side) whether there already is a profile. If there is (according to your specs), redirect the user to an "already completed" message. If there is no profile, continue and show the profile page.
Check whether a profile exists by testing for example:
does the profile record exist?
does the profile contain enough data (required fields have been filled in)?
or some other test that is specific to your system

drupal how to allow logged in user to edit specific content node?

I have a Drupal 7 site with single SSO via the LDAP module, which allows us to run the site as n Intranet and users that hit the site with IE will get automatically authenticated using their active directory credentials.
I have a personnel directory content type that holds a list of all of our employees and some of their stats (photo, email, phone number, etc.).
The problem I want to allow the logged in user to be able to edit the node in the personnel directory page that represents them, but because there is no relation between the logged in user and the nodes under the personnel directory content type I am not sure how to go about allowing users to edit their own entries?
The personnel directory page is automatically populated/updated via feeds (it looks at our AD, and pulls down users and updates them if it detects updates in AD meta data).
Somehow I need to tie the logged in user to the specific node, any idea how I could automate this as there are over 300+ nodes/users.
Ultimately, I'd like to have a "edit personnel bio" link that they can link, that will link based on their [current logged in user ID] it will allow them to edit the correct node in the [personnel directory] content type.
I hope this was clear enough to point me to some direction.
Thank you.
basically you want to create a user "role". Then in your permissions page (the one with 1000 checkboxes) you can add edit access to your "personnel bio" content type (or fields) for just that user role.
Then in your template you provide the user a link to the same page with /edit in the url.
Make sure the user has permissions to edit the node of that type. Upon creation of the node via feeds, create a rule (use the Rules module https://drupal.org/project/RULES) to change the creator of the node to that user's uid.
Add another field in the user's account to match their AD username to tie them together. To do this, create a module as seen at https://drupal.stackexchange.com/questions/8253/how-to-add-extra-fields-to-user-profile

Find a redirection on registration

In Drupal, there is a site I have to work on that has an annoying quirk.
Anytime someone registers, they are redirected to a custom page. I have grepped for drupal_goto, and looked in the database to find out what is causing this redirect to happen.
Whats the most effective way to track this down???
Found it. A rogue drupal_goto() statement implemented by previous developer.
Consider the LoginToboggan module. Here is a quote about it (from the module's project page):
... offers several modifications of the Drupal login system in an external module by offering the following features and usability improvements:
Allow users to login using either their username OR their e-mail address.
Allow users to login immediately.
Provide a login form on Access Denied pages for non-logged-in (anonymous) users.
The module provides two login block options: One uses JavaScript to display the form within the block immediately upon clicking "log in". The other brings the user to a separate page, but returns the user to their original page upon login.
Customize the registration form with two e-mail fields to ensure accuracy.
Optionally redirect the user to a specific page when using the 'immediate login' feature.
Optionally redirect the user to a specific page upon validation of their e-mail address.
Optionally display a user message indicating a successful login.
Optionally combine both the login and registration form on one page.
Optionally have unvalidated users purged from the system at a pre-defined interval (please read the CAVEATS section of INSTALL.txt for important information on configuring this feature!).
Integrates with Rules module to do various tasks when a user validates via email validation process.

Facebook like frontpage for anonymous users

I'm currently building a site where I want anonymous users to see a page which talks about what the site is about, but shows no content. It only offers two options
Register
Login (username & password field)
Once the user logs in, they should be redirected to a specific frontpage.
I tried using drupal/front module, but that did not work. Anynmous access was always shown as access denied
I think I could LoginToboggan to redirect authenticated users but not sure what to do about the frontpage.
thanks
When you say that you want the front page to show now content you really just mean you only want to show static copy right?
One way to do this is with views and the context module.
Create blocks with views of the content that you want to hide.
Create some regular blocks from the blocks menu.
The magic happens with the context module. It lets you set up custom rules for which blocks to display where and when. You can set it so that some blocks show up for anon users and other blocks show up for authenticated.
Set it up so that the static copy that talks about the site shows up for anon users along with the login block.
You can tell context module load whatever content you need on the home page with views generated with blocks.
Set up context module to load all of your blocks for you instead of drupal's core block system.
I'm sure you could do this somehow with panels too, but I couldn't tell you how.
Make sure that the page you are redirecting to is accessible for anonymous users. The most likely reason for your acess denied message is that anonymous users do not have permission for that page.
You could also try the Rules module to redirect after login.
Checkout my response to a similar question answered on Drupal.org. I'll repost here as well:
http://drupal.org/node/1962546
I also used Context but with a few other items to help.
I've done this, not with Facebook or LinkedIn however but with another
login based site.
Required modules: Omega theme Context Delta Views Some type of access
control Custom version of r4032login
How I did it: All content is locked down. r4032login redirects all non
logged in users to login, even if they try to get to a certain page.
Create a new delta: In here I have create a content region and shown
only what I need (custom login page).
Context Checks User Role must be anonymous user It then has a rule to
activate a delta, which is basically a copy of your theme
functionality: (Homepage login)
The login is set to forward the user to /frontpage which is a view, it
requires authenticated permissions to view. Once a user is logged in,
the redirect module forwards to the /frontpage (main page) and
permissions are verified and they're in.
If you need more details let me know. This is more of a complex
implementation I have in place but I'm sure there are also others
interesting in doing it.

Resources