Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

2 Usefull extensions

Asked Modified Viewed 1,294 times
D
douwe_yntema
D
  • Senior Member, joined since
  • Contributed 667 posts on the community forums.
  • Started 57 threads in the forums
  • Started this discussions
  • Answered 1 question
asked
Senior Member

For sites where the admin do the user management, I added two functions.

1- Add button for generating password

Open yoursite.com/includes/classes/UserFields.class.php, and search for (around line 229):

 $this->html .= $this->basicInputField("user_new_password2", $locale['u135'], "64", $passRequired, "password", FALSE, "user_password");


Add the following code below:

$this->html .= $this->basicInputField("generated_password", $locale['u135b'], "100", false, $locale['u126']);

 $this->html .= "<tr>\n";
 $this->html .= "<td width='150'></td>\n";
 $this->html .= "<td width='150'><input type='button' class='btn btn-primary' value='".$locale['u135a']."' onClick='randomPassword(8);'></td></tr>\n";
 $this->html .= "<script>";
 $this->html .= "function randomPassword(length) {";
 $this->html.= "var chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP1234567890';";
 $this->html .= "var pass = '';";
 $this->html .= "for (var x = 0; x < length; x++) {";
 $this->html.= "var i = Math.floor(Math.random() * chars.length);";
 $this->html .= "pass += chars.charAt(i);";
 $this->html .= "}";
 $this->html .= "inputform.user_new_password.value = pass;";
 $this->html .= "inputform.user_new_password2.value = pass;";
 $this->html .= "inputform.generated_password.value = pass;";
 $this->html .= "}";
 $this->html .= "</script>";


Now open yoursite.com/locale/English/user_fields.php and search for (arround line 78):
$locale['u135'] = "Confirm password";


add below:


$locale['u135a'] = "Generate password";
$locale['u135b'] = "Generated password";



2- Send email to member when password has changed by admin

Open yoursite.com/includes/classes/UserFieldsInput.class.php and search for (arround line 74)
private $_themeChanged = FALSE;


add below:
private $_passwordchange = FALSE;


Search for (arround line 124):
$this->_setCustomUserFieldsData();


add below:
 if ($this->_passwordchange == TRUE) {
 require_once LOCALE.LOCALESET."admin/members_email.php";
 require_once INCLUDES."sendmail_include.php";

 $subject = $locale['email_passwordupd_subject'].$settings['sitename'];
 $replace_this = ["[USER_NAME]", "[PASSWORD]", "[SITENAME]", "[SITEUSERNAME]"];
 $replace_with = [$this->_userName, $this->_newUserPassword, $settings['sitename'], $settings['siteusername']];
 $message = str_replace($replace_this, $replace_with, $locale['email_passwordupd_message']);
 sendemail($this->_userName, $this->_userEmail, $settings['siteusername'], $settings['siteemail'], $subject, $message);
 $this->_passwordchange = FALSE;
 }
 


Search for (arround line 275)
 if ($_isValidNewPassword === 0) {
 // New password is valid


add below
$this->_passwordchange = TRUE;


Now open yoursite.com/locale/English/admin/member_email.php and search for (arround line 1)

$locale['email_create_subject'] = "Account created at ";
$locale['email_create_message'] = "Hello [USER_NAME],<br/>\r\n
Your account at [SITENAME] has been created.<br/>\r\nYou can now login using the following details:<br/>\r\n
Username: [USER_NAME]<br/>\r\nPassword: [PASSWORD]<br/>\r\nRegards,<br/>\r\n[SITEUSERNAME]";


add below

$locale['email_passwordupd_subject'] = "Password changed at ";
$locale['email_passwordupd_message'] = "Hello [USER_NAME],\n
Your password has been succesfully updated<br>Y\r\nYou can now login using the following details:<br/>\r\n
Username: [USER_NAME]<br/>\r\nPassword: [PASSWORD]<br/>\r\nRegards,<br/>\r\n[SITEUSERNAME]";
0 replies

2 posts

G
Grimloch
G
Energy can neither be created nor destroyed; only transformed !
  • Senior Member, joined since
  • Contributed 722 posts on the community forums.
  • Started 141 threads in the forums
  • Answered 2 questions
answered
Senior Member

Very good. I added these codes to my new v8 system. Works great!
2 replies
W
Wanabo
W
Wanabo 10
www.probemyip.com/probe-my-ip-80x15.png
pHp-Fusion.Asia & pHp-Fusion.Fr & pHp-Fusion.Cn are available for a localized support community. Send PB for info.
  • Senior Member, joined since
  • Contributed 598 posts on the community forums.
  • Started 94 threads in the forums
answered
Senior Member

Really nice extensions! If a user lost his password and can not for some reason use lostpassword I set it default to welcome+alittleextra and send him/her a mail. This is far more professional and easier!
Edited by Wanabo on 06-09-2020 10:07,
1 reply

Labels

None yet

Statistics

  • Views 0 views
  • Posts 2 posts
  • Votes 0 votes
  • Topic users 4 members

4 participants

W
W
Wanabo 10
www.probemyip.com/probe-my-ip-80x15.png
pHp-Fusion.Asia & pHp-Fusion.Fr & pHp-Fusion.Cn are available for a localized support community. Send PB for info.
  • Senior Member, joined since
  • Contributed 598 posts on the community forums.
  • Started 94 threads in the forums
G
G
Energy can neither be created nor destroyed; only transformed !
  • Senior Member, joined since
  • Contributed 722 posts on the community forums.
  • Started 141 threads in the forums
  • Answered 2 questions
D
D
  • Senior Member, joined since
  • Contributed 667 posts on the community forums.
  • Started 57 threads in the forums
  • Started this discussions
  • Answered 1 question
S
S
[size=24]HELP WANTED FOR PHP-FUSION PROJECTS[/size]
[size=12]I am seeking Web Developers & Designers, Graphic Developers & Designers, Web, Mobile App & Computer Program Coders & Programmers & Beta & Alpha Testers for new PHP-Fusion Add-Ons like Themes, Infusions, BB-Codes and ETC, as well as Websites, Mobile App & Computer Programs to help me develop, design, code & program new PHP-Fusion Add-Ons, Websites, Mobile Apps & Computer Programs and I also need some people to test those in the Beta & Alpha stages both. All jobs are paid and are freelance jobs. Please message me here if interested for a list of available positions and projects. [/size]
  • Member, joined since
  • Contributed 120 posts on the community forums.
  • Started 44 threads in the forums

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet