Where to locate my Drupal redirect - drupal

I have a drupal 7 site and it is redirecting to a page after login. I don't want it to redirect to that page but want it to redirect to another page.
Where can I look for what controls this? I am fairly certain this is going to be in the admin area of drupal but have not found it yet.

You have 3 options here:
Simply install the Login Destination module and set the path you want your user to be redirected to in the admin settings page of the module.
Use the hook_user_login hook hook_user_login(&$edit, $account)
Use the Rules to specify a rule for when an user logs in.

You can :
login as admin user on the backend.
Go to folliwng URL {your drupal site}/admin/config/system/site-information
Find input box Default front page
Input which page path you have, for example dashboard (PS: dashboard page should be able to access.)

You can use Rules module,
The Rules module allows site administrators to define conditionally executed actions based on occurring events.
Create new Rule
Add Event like 'User has logged in'
If you run this Rule for any specific condition, then you can add condition like "User has role(s)" and provide user roles or leave as it is
Add Actions like 'Page redirect' and provide the page URL
Save and clear the cache

You can change the destination via rules/Actions.
Create the destination node or view
Go to 'Administration' » 'Configuration' » and under the heading 'System', click "Actions".
'Create an advanced action'
Click the drop-down menu choice "Redirect to URL...".
Click the button "Create".
On the page 'Configure an advanced action',
under the heading 'Label',
you can leave the label as the default of
"Redirect to URL".
Under the heading 'URL', type the path of the destination.
Click the button "Save".
Go to the 'Modules' page and enable module 'Trigger', if it is not already enabled.
Go to 'Administration' » 'Structure' » 'Triggers', and click the tab "User".
Under the heading 'Trigger: After a user has logged in', click the downward pointing arrow. In the drop-down menu, click the name of the action you just created.
Click the button "Assign".
Logout, and log back in to test.
Read more at https://www.drupal.org/node/683696

Related

current user inside wordpress menu hyperlink

I have created a custom menu for buddypress in wordpress.
The links always contain the current user.
In this example the user "admin
/members/admin/profile/
What do i have to do so that the link always points to the current user?
In a link to members, me will be handled as the current user.
For example: https://yoursite.com/members/me/ will take you to your profile.

Create a "Change Avatar" button with buddypress

I'm trying to find the code within the buddypress plugin that links directly to the "Change Profile Photo" page of the user that is logged in. I'm sure this requires php but I can not find it anywhere.
This way I can add link/button on the home page of my site that says "Change Your Avatar!" and it will go to that section of the users profile. Thanks
The following link should work: http://example.com/members/MEMBERNAME/profile/change-avatar/ The "MEMBERNAME" is the username of a user. To get the url for a users profile you can use bp_loggedin_user_domain(). Adding the following to the top of your site will show a link to allow the users change their profile image.
Change Your Avatar!

Restrict access to page for anonymous users in Drupal

Very simple question that i'm stuck with.
I'm making a very simple 'classifieds' website; i have a content-type of type 'classified' i'd like to give access to that content-type for registered users only; i edited the permissions so only 'authenticated' users can 'create classified' and also created a menu link to 'node/add/classified'.
The problem is that when anonymous, i don't see the 'create classified' menu link (right, because the user doesn't have the right to 'create' one) but I still want this menu item to appear and i'm redirecting to my custom 403 page that says 'hey, you have to create an account first before posting a classified'.
What's the best 'elegant' way to achieve this ?
My solution would be to create a new page (via hook_menu) at, say "classified/add". In this page, check the user's id = if it's 0, then display your friendly message about joining the site.
If they aren't 0, then append/return node_add('classified'). (Note that node_add is in node.pages.inc, so you'll want to include that when needed.)
I have actually done the same thing for a classified ad system. Creating absolute URLs as menu items works for me and is quite simple.
For example, instead of making the menu item path 'node/add/classified', set the path to 'http://example.com/node/add/classified'. When you click the menu item when logged out (as anonymous), Drupal will try to go to the create classified page, but will fail the permissions check and redirect to your custom 403 page.
Try creating a new menu item manually (Admin > Site building > Menus > Menu name > Add item), to point to the node/add/classified URL.
Update: You could try linking to /node/403?destination=node/add/classified (where node/403 is your custom 403 error page).

redirection in drupal

hi i have made a content type in drupal. in this content type i have added some fields. i want when user submit this form. he will be redirected on a custom page.
right now when user submit this form he remain on this page and an see the success message. i want to redirect the user on a custom page .how can i do this.
Use the rules module.
Event -> After saving new content
Node -> Content has type
(optional: User -> has role)
System -> Page redirect

Display the link but not the CCK form

I have created a form using add new content type and cck fields. I want anonymous users to view the menu item to this form but not the content. So when users click on the link they should get redirected to login page. I have granted the permissions of access all content. Any suggestions please.
Thanks
Kanwal
create node-{YOURCONTENTTYPE}.tpl.php in your theme, then write next code:
<?php
global $user;
if (!$user->uid) {
drupal_set_message('You should login before see this content type');
drupal_goto('user');
}
?>
//HERE CODE FROM STANDARD node.tpl.php of your theme
I would never use the theme layer for access control and redirection, as Nikit suggests.
You could simply create a normal menu link to 'user/login' with "Create content" as menu title. Drupal will automatically hide it when you're logged in.
An even better option, IMHO, is to use the Inline Registration module. As the module page says: "Inline Registration allows anonymous users to register via the node/add page, thus removing a step/barrier from the user actually publishing content." Try it, I think it's a huge usability improvement.

Resources