When the user gets a user password reset link like this password reset like this http://digitalsuite.unitedway.org/user/reset/3/1356108765/5ff18af572734c897f4d7a2946983a87
it doesnt automatically log them in , they get no message, just goes to the login screen right away.
Where is this coded so I can debug what is happening?
thanks
Diana
When trying to figure out where to start debugging in Drupal, it generally helps to take a look at the hook_menu implementation that defines the page in question. Hook_menu "…enables modules to register paths in order to define how URL requests are handled."
In this case, the user module's user_menu function, is defined in the user.module file.
$items['user/reset/%/%/%'] = array(
'title' => 'Reset password',
'page callback' => 'drupal_get_form',
'page arguments' => array('user_pass_reset', 2, 3, 4),
'access callback' => TRUE,
'type' => MENU_CALLBACK,
'file' => 'user.pages.inc',
);
Notice that 'page arguments' points to 'user_pass_reset', which is located in the user.pages.inc file. That would be a good place to start debugging.
Related
For SEO purposes I need to remove the first page number from the URL. i.e I have the following:
example.com/pages/view/1 and example.com/pages/view the two URLs points to the same contents of the view action. I want to make the pagination free from 1 in the URL. i.e first Page link and Page Number 1 should be linked to pages/view.
I tried to deal with the $pagination object like the following:
$pages = new Pagination(['totalCount' => $books['booksCount'], 'pageParam' => 'start', 'defaultPageSize' => 10,]);
$pagingLinks = $pages->getLinks();
$pagingLinks['first'] = '/';
$pages->links = $pagingLinks;
However, the last line causing error:
Setting read-only property: yii\data\Pagination::links
So I have a problem to modify the links property. Is there any other solution to get this task done?!
According to docs you should set yii\data\Pagination::forcePageParam to false by passing it in Pagination constructor
$pages = new Pagination([
'totalCount' => $books['booksCount'],
'pageParam' => 'start',
'defaultPageSize' => 10,
'forcePageParam' => false,
]);
The above answer may works for direct use of Pagination but remain an issue if it was used from another widget such as ListView.
I found the solution from a comment on an issue report on Yii2 repository on github
The solution is just define proper route in config/web.php. Suppose here we have a controller called Suras and we use the ListView widget on its action's view called view. So placing rule array with defaults has value 'page' => 1 will prevent adding the page parameter to the link's URL of the first page. Also notice the first rule 'view/<id:\d+>/1' => 'Error404', is placed in-order to prevent any access to the first page using page=1 parameter, for example, trying to access mysite.com/view/20/1 will invoke 404 error, because there is no controller called Error404.
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'view/<id:\d+>/1' => 'Error404',
['pattern' => 'view/<id:\d+>/<page:\d+>', 'route' => 'suras/view', 'defaults' => ['page' => 1]],
'view/<id:\d+>/<page:\d+>' => 'suras/view',
'view/<id:\d+>' => 'suras/view',
],
],
],
I have this code for an email settings form that the user will input the email address, password, etc.
$form['mail_settings']['user_pass'] = array(
'#type' => 'password_confirm',
'#description' => t('your password')
);
$form['mail_settings']['user_signature'] = array(
'#type' => 'textfield'
'#description' => t('custm signature')
);
What I wanted to achieve is to have the user be able to change his signature anytime without having to re-enter his password all over again.
What's happening right now is that every time I load this settings page there's a default value for the password and blank for the password confirmation.
So, if the user forgets to input his password again, the form displays an error. Or rather the it will create a validation error.
What should be done here?
Came up with a different solution. It turned out that my browser's password chain (saved passwords) is responsible for adding the default value in the password field.
The solution was just, if password field is empty: update password using the old one; else if not empty update password with the new one.
I have installed the faq and faq_ask module.
The faq_ask module adds a navigation link of 'ask a question'.
When I click on it, it displays a form to the user to ask a question.
The faq module adds a navigation link of frequently asked questions.
When I click on it, it displays the questions and answers list. It contains two tabs 'list' and 'order'.
I have added the third tab of 'ask a question' and Now I want to display the ask a question form on this tab.
EDIT:
function test_menu() {
$items = array();
$items['faq/ask_question'] =array(
'title' => 'Ask a question',
'page callback' => 'drupal_get_form',
'page arguments' => array("test_ask_question"),
'access callback' => TRUE,
'type' => MENU_LOCAL_TASK,
);
return $items;
}
Any Idea about this???
Is there a module that can make different registration forms for different roles during sign up? (ex. each Editor,Main User,Sub User role have different form)
Here's what you should do
start with install profile2-7.x-1.2.tar.gz.
entity-7.x-1.0-rc3.tar.gz once you have profile2 installed -->
enable --> click on configure - (Here you see your profile types
-add as many as you want).
when you add a new one or modify the existing one "Main" make sure you check "Provide a separate page for editing profiles."
4. Now to have different registration, login and password change pages
install and enable profile2_regpath-7.x-1.9.tar.gz
Now visit the profile Types Page again here you should see "UNIQUE REGISTRATION PATH" .. rest is easy ..
There is :)
http://drupal.org/project/autoassignrole
to assign by path you will also need Content Profile:
http://drupal.org/project/content_profile
check out this tutorial on how to pull it off:
http://www.web-a-team.com/blog-post/user-registration-more-one-role
Here is some idea how to solve your question in drupal 7(I think it should work in drupal 6 also). However its not safe since anyone can just change the role they have:
function my_module_form_user_register_form_alter(&$form, &$form_state, $form_id) {
$company_role = $form_state['build_info']['args'][0];
$form['account']['company_role'] = array(
'#type' => 'select',
'#title' => t('Company role'),
'#options' => drupal_map_assoc(array('editor','main user','Sub User')),
'#description' => t('Please select your company role'),
"#empty_option" =>t('- Select -'),
'#weight' => -11, // Add the select box above username that have weight -10
);
switch (strtolower($company_role)) {
case 'editor':
// add extra fields for editor
$form['account']['company_role']['#default_value'] = $company_role;
break;
case 'main user':
// add extra fields for main
$form['account']['company_role']['#default_value'] = $company_role;
case 'sub user';
// add extra fields for 'Sub User'
$form['account']['company_role']['#default_value'] = $company_role;
break;
default:
$form['account']['company_role']['#empty_option'] = t('- Select -');
$company_role = null;// error handling or default case
}
}
If you for example have LDAP in your company you could instead get this information from LDAP(https://www.drupal.org/node/1053748). Then you can be more sure about the role is chosen correctly.
I have built a non-node module and I wish to integrate it with Open Atrium as a feature.
I've experimented with a test feature to try "crack the code" of features, spaces, and open atrium, as the documentation does not cover this topic and I'm new to features, spaces, and open atrium.
I created a feature using features and then customised the info and module files.
Info file:
core = "6.x"
description = "A test feature"
name = "Test Feature"
package = "Features"
spaces[types][] = "og"
features[][] = ""code here
Module file:
function test_feature_menu()
{
$items['ftest'] = array(
'title' => 'Test Feature',
'page callback' => 'test_feature_page',
'access callback' => 'spaces_menu_access',
'type' => MENU_NORMAL_ITEM,
'menu_name' => 'features'
);
}
function test_feature_page()
{
$output = 'test';
return $output;
}
The feature appears in the features section, and when enabled, appears in the features menu regardless of what group I am in. Further, the groups have the feature set as disabled, but the item still appears in the menu.
Can anyone shed some light on this?
Thanks,
Greg.
Ok, I figured it out:
The access callback should be 'spaces_access_feature', and the access arguments should be array('view', 'test_feature');