redirection in drupal - 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

Related

Drupal 8 - Admin content list - return 301 on edit

Drupal 8 Admin content list return 301 redirect back to content list when we try to click on the "edit" link for specific content type without access to edit screen.
For example:
node/448/edit?destination=/admin/content - node type article (works)
node/331/edit?destination=/admin/content - node type books (not work)
All of the nodes of this specific node type return 301 redirect back to admin content list.
We are using administrator permission, no custom code made.
Thanks
Are you logged in as user/1 ? If not, have you checked the CRUD permissions for the specific book content type for administrator role in admin/people/permissions page?

Display form into the login page Drupal

I'm very new in Drupal and I encounter a problem.
I want to add a login page. So I have the page http://localhost/mytheme/user/login
I don't know how to display the login form into that page ....
Thanks for your help !
First way. This is standard drupal's login form. You can use it on your custom pages
user_login form
Second way. Rename Admin Paths module, which can rename you paths to standart user's operations. For example you have default yousite.com/user/login and you can set path to login as yousite.com/mytheme/user/login it's easy

Where to locate my Drupal redirect

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

How to restrict all links and redirect to the same page in drupal 7

I have used profile2 module and have created a separate profile type.
The case is that, i have a profile edit form for the profile type named restaurant. Once the user logged in( with the role restaurant), he will be redirected to the profile edit page, where the user have to fill all the required fields of the profile form. If the user clicks any other links on the page he must be redirected to the same form with a msg (U have to complete the form ) till the user fill all the fields in the profile edit form.
i have done with redirecting the user to the profile edit form. Now i have to do the other part( links redirect with set msg). Is there any module i can use to get the above scenario or i have to do it by custom code. Please help me out if i have to do this by custom code..
Thanks in advance....
To make it working on all the pages and links, you should write some profile field value checking code in hook_page_alter or hook_page_build. If the values are empty, you should redirect the user.

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