New User Approval - by Admin - or others

Need help with the Administration of your Joomla! 1.5 site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
stmark
Joomla! Apprentice
Joomla! Apprentice
Posts: 11
Joined: Fri Nov 02, 2007 2:52 pm

New User Approval - by Admin - or others

Post by stmark » Wed Jan 30, 2008 3:35 pm

It's been asked before - but never answered - so I'll try yet again. 

The standard 1.5 stable has no means to allow or require admin (or other) approval / verification before a user is allowed to login to a site - that is -  after they get their verification email, all one has to do is click and then login to the site.  It would be just absolutely fantastic if the admin - besides being notified of a new user - could actually approve or deny an application for registration. 
So, if anyone knows of a good hack to make this happen  PLEASE let me and others know. 
Please note: Community Builder may very well be a nice solution to this - some day - but it is soooo buggy right now that it has nearly put me over the edge trying to get it to play nice with 1.5 stable.  [The main problem is that even though user registration is turned off in global config, there are times when it reverts to native user registration and ignores CB registration - Especially during logout - Give it a try if you feel you have the stamina to deal. 
Anyway, any advice is appreciated in advance.
StMark

rufhausen
Joomla! Apprentice
Joomla! Apprentice
Posts: 21
Joined: Fri Sep 28, 2007 5:51 am
Location: Denver, Colorado
Contact:

Re: New User Approval - by Admin - or others

Post by rufhausen » Wed Jan 30, 2008 4:06 pm

I was trying to this as well. My imperfect solution was to:
a. turn on 'receive system emails' so I'd be notified of registrations.
b. comment out the following line in /componets/com_user/controller.php: JUtility::sendMail($mailfrom, $fromname, $email, $subject, $message);
(it's around line 518). This so the activation email is never sent.
c. make sure 'New User Account Activation' is set to yes.

This allowed users to register, notify me, and leaves their account status as disabled until I enable it, since they never get the activation link.

The downside is they don't get an automated email letting them know their account is active.

stmark
Joomla! Apprentice
Joomla! Apprentice
Posts: 11
Joined: Fri Nov 02, 2007 2:52 pm

Re: New User Approval - by Admin - or others

Post by stmark » Wed Jan 30, 2008 4:27 pm

Thanks rufhausen !
That sounds like a reasonable solution / workaround.
Another thing I have done is to have a Login page (I changed Main Menu Home to Login  / with and article) that explains the login process.  I suppose I could let users know that I will send them an email to let them know when they are approved. 
I do like the idea / potential of Community Builder, but, as I mentioned before, It just drove me crazy trying to hack it to work with 1.5 stable.  Who knows? Maybe they'll get a 1.5 version out so we don't have to "hack" all this code.???
Thanks again,
StMark

nettemor
Joomla! Explorer
Joomla! Explorer
Posts: 304
Joined: Fri Dec 08, 2006 10:44 pm
Location: Norway

Re: New User Approval - by Admin - or others

Post by nettemor » Fri Mar 14, 2008 12:58 am

Thank you for this workaround, i also need this functionallity and using CB will be "overkill" for my site.

Do you know where/which file i can change the text that are presented to the user when he/she is registered at the site?

stmark
Joomla! Apprentice
Joomla! Apprentice
Posts: 11
Joined: Fri Nov 02, 2007 2:52 pm

Re: New User Approval - by Admin - or others

Post by stmark » Fri Mar 14, 2008 10:30 am

nettemor wrote:Thank you for this workaround, i also need this functionallity and using CB will be "overkill" for my site.Do you know where/which file i can change the text that are presented to the user when he/she is registered at the site?
...............................................
You can change the pre and post login form text from the admin panel under Extensions - Module Manager. Then open the "login" module and edit or add a message (on the right side of the screen).
I haven't tried it, but you may also be able to edit the "language" file for the module. It would be something like -- ...your site files/language/en-GB/en-GB.mod_login.ini (using the english language). Or, it may be somewhere in your template file ?? not sure. I use the beez template and there is a file html /mod_login / default.php.
Hope this helps.
Stmark

nettemor
Joomla! Explorer
Joomla! Explorer
Posts: 304
Joined: Fri Dec 08, 2006 10:44 pm
Location: Norway

Re: New User Approval - by Admin - or others

Post by nettemor » Fri Mar 14, 2008 10:38 am

Thank you :-)

I changed the text in the language file as you mention, - works great!.

user deleted

Re: New User Approval - by Admin - or others

Post by user deleted » Fri Mar 14, 2008 10:44 am

Moderator note: moving from Security to Administration

Snomon
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Wed Mar 19, 2008 1:05 pm

Re: New User Approval - by Admin - or others

Post by Snomon » Wed Mar 19, 2008 2:21 pm

rufhausen wrote:I was trying to this as well. My imperfect solution was to:
a. turn on 'receive system emails' so I'd be notified of registrations.
b. comment out the following line in /componets/com_user/controller.php: JUtility::sendMail($mailfrom, $fromname, $email, $subject, $message);
(it's around line 518).
Update:
If you are using v1.5.1, you will want to comment that code on Line 501. If you comment out the same code at Line 514 it will disable the mail sent to Super Admin.

willcom
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Mon Sep 17, 2007 9:13 pm

Re: New User Approval - by Admin - or others

Post by willcom » Wed Sep 17, 2008 11:45 am

Please help :eek: I was really looking forward to doing this, but I'm on 1.5.7 and the code has changed and I'm no expert! Please could you update which line I should be looking for, as the line in 499 (similar/same as the one mentioned doesn't stop the email coming through to the user.

Thanks in advance :)

User avatar
Antonimo
Joomla! Apprentice
Joomla! Apprentice
Posts: 45
Joined: Fri Jan 05, 2007 3:35 pm

Re: New User Approval - by Admin - or others

Post by Antonimo » Tue Sep 30, 2008 9:42 am

I just commented out this line in 1.5.7 at line number 509

An additional though is to also edit the line in the language file (en-GB.com_user.ini, for example) that shows the message after registration application. Obviously, the registrant will not be receiving an activation e-mail so line 90:

Code: Select all

REG_COMPLETE_ACTIVATE=Your account has been created and an activation link has been sent to the e-mail address you entered. Note that you must activate the account by clicking on the activation link when you get the e-mail before you can login.
should be edited according to your policy.

User avatar
Antonimo
Joomla! Apprentice
Joomla! Apprentice
Posts: 45
Joined: Fri Jan 05, 2007 3:35 pm

Re: New User Approval - by Admin - or others

Post by Antonimo » Tue Sep 30, 2008 10:20 am

Another solution to the problem:

Do not make the changes to /componets/com_user/controller.php as mentioned above.

Instead, change the line 117 in the language file :

Code: Select all

SEND_MSG_ACTIVATE=Hello %s,\n\nThank you for registering at %s. Your account is created and must be activated before you can use it.\nTo activate the account click on the following link or copy-paste it in your browser:\n%s\n\nAfter activation you may login to %s using the following username and password:\n\nUsername: %s\nPassword: %s
to contain the e-mail message that the registrant will receive. Something along the lines of, " Your application has been received is is currently under review. You will receive an e-mail when the registration process is complete. In the meantime, please enjoy browsing through the public areas of our site at:"

After this, go to the file /componets/com_user/controller.php and edit line 489 from:

Code: Select all

			$message = sprintf ( JText::_( 'SEND_MSG_ACTIVATE' ), $name, $sitename, $siteURL."index.php?option=com_user&task=activate&activation=".$user->get('activation'), $siteURL, $username, $password);
to

Code: Select all

			$message = sprintf ( JText::_( 'SEND_MSG_ACTIVATE' ), $name, $sitename, $siteURL."index.php", $siteURL, $username, $password);
This change will only include a link to the first page of your website without the activation code appended so the registrant cannot activate the registration.

Both applicant and admin receive the e-mails and the admin can then approve or disapprove as required.



I have further tweaked the file /componets/com_user/controller.php on line 520 from:

Code: Select all

				$message2 = sprintf ( JText::_( 'SEND_MSG_ADMIN' ), $row->name, $sitename, $name, $email, $username);
to:

Code: Select all

				$message2 = sprintf ( JText::_( 'SEND_MSG_ADMIN' ), $row->name, $siteURL."index.php?option=com_user&task=activate&activation=".$user->get('activation'), $name, $email, $username);
This sends the activation link (that was removed from the applicant's e-mail above) to the admin, thereby giving the admin a "one click" activation from the e-mail notification.

User avatar
ArielZusya
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Sat Oct 04, 2008 2:18 pm

Re: New User Approval - by Admin - or others

Post by ArielZusya » Sat Oct 04, 2008 2:37 pm

First, thank you so much for this valuable information. I've followed the instructions and they work like a charm. I am very new to joomla and am just starting to get the hang of things. In addition to the instructions you gave, I also went in to the /componets/com_user/controller.php and changed a piece of function register_save(). Specifically on line 278 I changed:

Code: Select all

$this->setRedirect('index.php', $message);
to point to a specific article which has a message verifying that the request for an account was sent and that an email was sent to the user and if they don't receive an email they should send an email letting us know. Now when a user registers and clicks the Register button after filling in the form, instead of being sent back to the frontpage they are sent to my verification message page. In addition, the changed message (per your helpful instructions) went out to the user and the activation link went to the administrator. All of that is working really well. Thanks again!

What I'd like to know is, is there an easy way to automatically send a message to the user when the account is activated? Before these changes, when the user activated themselves, they knew the account had been activated because they saw the verification of activation message on their screen. Now, because the administrator is activating the account, the user doesn't get that feedback. I'd like to have the administrator see the verification page confirming activation but I'd like to have an email simultaneously sent to the user letting them know the administrator has activated their account. How do I do that? I assume I need to add some code to function activate() but I'm not sure if that's right nor what code I would add. Your help is greatly appreciated! Thanks!

london_lhr
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Tue Sep 30, 2008 1:03 pm

Re: New User Approval - by Admin - or others

Post by london_lhr » Sat Oct 04, 2008 6:08 pm

Hi all,

Complete Joomla Newbie/Dummy here. This thread has answered all but one question that I wanted to ask also.
I was going to ask the exact question that was asked in the title of the thread. My application is for a club and verification of membership is necessary by Admin against a club membership number issued to the member before registration on the club website is accepted to keep certain areas members only.

The question I have is, is it possible to add a field in the registration template whereby when the person registering all their details also has to input their Club Membership number? I am sure there is a way to edit some file but I unfortunately do not have the experience/expertise for doing that. Your help will be much appreciated.

It would be nice if this membership number could be automatically verified against a database but to me that sounds very complicated. Just inputting the one field will already be be a great help!

Thank you.

LHR.

User avatar
Antonimo
Joomla! Apprentice
Joomla! Apprentice
Posts: 45
Joined: Fri Jan 05, 2007 3:35 pm

Re: New User Approval - by Admin - or others

Post by Antonimo » Sun Oct 05, 2008 7:27 pm

To ArielZusya,
In addition to the instructions you gave, I also went in to the /componets/com_user/controller.php and changed a piece of function register_save(). Specifically on line 278 I changed:

Code: Select all
$this->setRedirect('index.php', $message);

to point to a specific article which has a message verifying that the request for an account was sent and that an email was sent to the user and if they don't receive an email they should send an email letting us know
Thanks for the additional info - very useful.
What I'd like to know is, is there an easy way to automatically send a message to the user when the account is activated?
I am going to have to look into this one as I don't know the answer but I agree that it would be very useful

***** Manual signatures are NOT allowed ********** Manual signatures are NOT allowed *****______
To london_lhr,

There are a number of posts that deal with adding fields to the registration form.

If you have not found them, I shall be making a post to the forum within a day or two with a fairly complete and detailed guide to the process. In the meantime, you can PM me to get a copy of the guide before I post it.

User avatar
ArielZusya
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Sat Oct 04, 2008 2:18 pm

Re: New User Approval - by Admin - or others

Post by ArielZusya » Sun Oct 05, 2008 9:48 pm

To Antonimo
Antonimo wrote:
What I'd like to know is, is there an easy way to automatically send a message to the user when the account is activated?
I am going to have to look into this one as I don't know the answer but I agree that it would be very useful
I think I have an idea of where this needs to go. I'm just stuck on one little if ... then statement. Let me tell you where I'm going and see if you can help me get there. Here's what I've got so far. First I added another couple of message text strings to the language file language\en-GB\en-GB.com_user.ini:

Code: Select all

SEND_MSG_ADMIN_ACTIVATE=Hello, %s,\n\nthe account with username %s has had been activated.
SEND_MSG_ACTIVATED=Hello, %s,\n\nYour account with username %s has been activated.
Then I went into the function activate() and added a call to the email function (somewhere around line 339):

Code: Select all

UserController::_sendMail($user, $password);
So far so good. My last step is to modify the function _sendMail(&$user, $password) (which starts around line 469) with some if ... then statements that test whether the user is already activated. If activated, send the user an email that says, "User, your account is activated" and send the admins an email that says, "user's acount is activated" but I'm struggling with how to test for that. I can change:

Code: Select all

	function _sendMail(&$user, $password)
	{
		global $mainframe;

		$db		=& JFactory::getDBO();

		$name 		= $user->get('name');
		$email 		= $user->get('email');
		$username 	= $user->get('username');

		$usersConfig 	= &JComponentHelper::getParams( 'com_users' );
		$sitename 		= $mainframe->getCfg( 'sitename' );
		$useractivation = $usersConfig->get( 'useractivation' );
		$mailfrom 		= $mainframe->getCfg( 'mailfrom' );
		$fromname 		= $mainframe->getCfg( 'fromname' );
		$siteURL		= JURI::base();

		$subject 	= sprintf ( JText::_( 'Account details for' ), $name, $sitename);
		$subject 	= html_entity_decode($subject, ENT_QUOTES);

		if ( $useractivation == 1 ){
			$message = sprintf ( JText::_( 'SEND_MSG_ACTIVATE' ), $name, $sitename);
		} else {
			$message = sprintf ( JText::_( 'SEND_MSG' ), $name, $sitename, $siteURL);
		}

		$message = html_entity_decode($message, ENT_QUOTES);

		//get all super administrator
		$query = 'SELECT name, email, sendEmail' .
				' FROM #__users' .
				' WHERE LOWER( usertype ) = "super administrator"';
		$db->setQuery( $query );
		$rows = $db->loadObjectList();

		// Send email to user
		if ( ! $mailfrom  || ! $fromname ) {
			$fromname = $rows[0]->name;
			$mailfrom = $rows[0]->email;
		}

		JUtility::sendMail($mailfrom, $fromname, $email, $subject, $message);

		// Send notification to all administrators
		$subject2 = sprintf ( JText::_( 'Account details for' ), $name, $sitename);
		$subject2 = html_entity_decode($subject2, ENT_QUOTES);

		// get superadministrators id
		foreach ( $rows as $row )
		{
			if ($row->sendEmail)
			{
				$message2 = sprintf ( JText::_( 'SEND_MSG_ADMIN' ), $row->name, $siteURL."index.php?option=com_user&task=activate&activation=".$user->get('activation'), $name, $email, $username);
				$message2 = html_entity_decode($message2, ENT_QUOTES);
				JUtility::sendMail($mailfrom, $fromname, $row->email, $subject2, $message2);
			}
		}
	}
to:

Code: Select all

	function _sendMail(&$user, $password)
	{
		global $mainframe;

		$db		=& JFactory::getDBO();

		$name 		= $user->get('name');
		$email 		= $user->get('email');
		$username 	= $user->get('username');

		$usersConfig 	= &JComponentHelper::getParams( 'com_users' );
		$sitename 		= $mainframe->getCfg( 'sitename' );
		$useractivation = $usersConfig->get( 'useractivation' );
		$mailfrom 		= $mainframe->getCfg( 'mailfrom' );
		$fromname 		= $mainframe->getCfg( 'fromname' );
		$siteURL		= JURI::base();

		$subject 	= sprintf ( JText::_( 'Account details for' ), $name, $sitename);
		$subject 	= html_entity_decode($subject, ENT_QUOTES);

		if (<INSERT MY TEST STATEMENT HERE>){
			if ( $useractivation == 1 ){
				$message = sprintf ( JText::_( 'SEND_MSG_ACTIVATE' ), $name, $sitename);
			} else {
				$message = sprintf ( JText::_( 'SEND_MSG' ), $name, $sitename, $siteURL);
			}
		} else {
				$message = sprintf ( JText::_( 'SEND_MSG_ACTIVATED' ), $name, $username, $sitename);
			}
		}

		$message = html_entity_decode($message, ENT_QUOTES);

		//get all super administrator
		$query = 'SELECT name, email, sendEmail' .
				' FROM #__users' .
				' WHERE LOWER( usertype ) = "super administrator"';
		$db->setQuery( $query );
		$rows = $db->loadObjectList();

		// Send email to user
		if ( ! $mailfrom  || ! $fromname ) {
			$fromname = $rows[0]->name;
			$mailfrom = $rows[0]->email;
		}

		JUtility::sendMail($mailfrom, $fromname, $email, $subject, $message);

		// Send notification to all administrators
		$subject2 = sprintf ( JText::_( 'Account details for' ), $name, $sitename);
		$subject2 = html_entity_decode($subject2, ENT_QUOTES);

		// get superadministrators id
		foreach ( $rows as $row )
		{
			if (<INSERT MY TEST STATEMENT HERE>){
				if ($row->sendEmail)
				{
					$message2 = sprintf ( JText::_( 'SEND_MSG_ADMIN' ), $row->name, $siteURL."index.php?option=com_user&task=activate&activation=".$user->get('activation'), $name, $email, $username);
					$message2 = html_entity_decode($message2, ENT_QUOTES);
					JUtility::sendMail($mailfrom, $fromname, $row->email, $subject2, $message2);
				}
			} else {
				if ($row->sendEmail)
				{
					$message2 = sprintf ( JText::_( 'SEND_MSG_ADMIN_ACTIVATE' ), $row->name, $name);
					$message2 = html_entity_decode($message2, ENT_QUOTES);
					JUtility::sendMail($mailfrom, $fromname, $row->email, $subject2, $message2);
				}
			}
		}
	}
but I'm struggling to figure out what to put in place of <INSERT MY TEST STATEMENT HERE>. Am I on the right track? Do you have any suggestions of how to achieve this end? I'm guessing it's simple but I just don't know enough about joomla to get this right. Your assistance is great appreacited! Thanks again!

london_lhr
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Tue Sep 30, 2008 1:03 pm

Re: New User Approval - by Admin - or others

Post by london_lhr » Mon Oct 06, 2008 7:00 am

Thank you Antonimo. I have in the meantime also found some other posts and am looking forward to your post.

LHR.

london_lhr
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Tue Sep 30, 2008 1:03 pm

Re: New User Approval - by Admin - or others

Post by london_lhr » Tue Oct 07, 2008 9:19 am

Hello Antonimo,

unfortunately I cannot PM as I do not have >5 posts.

Regards,

LHR.

ozinm
Joomla! Apprentice
Joomla! Apprentice
Posts: 19
Joined: Sat Feb 11, 2006 12:03 pm
Contact:

Re: New User Approval - by Admin - or others

Post by ozinm » Wed Oct 15, 2008 3:56 pm

ArielZusya wrote:To Antonimo
Antonimo wrote:
What I'd like to know is, is there an easy way to automatically send a message to the user when the account is activated?
I am going to have to look into this one as I don't know the answer but I agree that it would be very useful
I think I have an idea of where this needs to go. I'm just stuck on one little if ... then statement. Let me tell you where I'm going and see if you can help me get there. Here's what I've got so far. First I added another couple of message text strings to the language file language\en-GB\en-GB.com_user.ini:

Code: Select all

SEND_MSG_ADMIN_ACTIVATE=Hello, %s,\n\nthe account with username %s has had been activated.
SEND_MSG_ACTIVATED=Hello, %s,\n\nYour account with username %s has been activated.
Then I went into the function activate() and added a call to the email function (somewhere around line 339):

Code: Select all

UserController::_sendMail($user, $password);
So far so good. My last step is to modify the function _sendMail(&$user, $password) (which starts around line 469) with some if ... then statements that test whether the user is already activated. If activated, send the user an email that says, "User, your account is activated" and send the admins an email that says, "user's acount is activated" but I'm struggling with how to test for that. SNIP-TEXT
First a quick caveat, I'm not a PHP coder (VB I'm afraid) but I've just looked up the function definition syntax and think this would do:

How about editing the email function definition to include an optional arg?
Something like:

Code: Select all

function _sendMail(&$user, $password, , $useractiviated=0)
   {
you could then create an if statement to test for $useractiviated==1

As $useractiviated is an option argument is shouldn't mess anything up where the parameter isn't passed.

In function activate() you should then be able to call sendMail with this new argument.

Hope this makes some sort of sense.

Would love to hear how you get on.

All the best

M.

ozinm
Joomla! Apprentice
Joomla! Apprentice
Posts: 19
Joined: Sat Feb 11, 2006 12:03 pm
Contact:

Re: New User Approval - by Admin - or others

Post by ozinm » Thu Oct 16, 2008 1:07 pm

BTW
I found this:
http://www.prodevtips.com/2007/10/18/jo ... istration/
Which might be useful if some nice chap wanted to convert the core hack into a seperate component.

eli_cook
Joomla! Apprentice
Joomla! Apprentice
Posts: 14
Joined: Wed Feb 13, 2008 7:29 pm

Re: New User Approval - by Admin - or others

Post by eli_cook » Wed Oct 22, 2008 5:05 pm

ArielZusya - I followed the steps above and like you also needed to have reply emails sent back after activation - there probably is a much easier way of doing this (like you have pointed out adding the if statements to the current sendmail function). But I needed this right away. Here is what I did to get an email sent upon activation.

The first problem I ran into is that upon activation the user fields are looked up in another file and they weren't being returned to the controller.php file so I edited the function activate() section of controller.php file located under components/com_user/


STEP 1:

Under Line 331 ---- jimport('joomla.user.helper');
I added

Code: Select all

		$db = & JFactory::getDBO();

		// Lets get the id of the user we want to send mail to
		$query = 'SELECT id'
		. ' FROM #__users'
		. ' WHERE activation = '.$db->Quote($activation);
		;
		$db->setQuery( $query );
		$id = intval( $db->loadResult() );
This will load the user's ID to the $id variable

STEP 2:
Then under line 351 ----- $message->text = JText::_( 'REG_ACTIVATE_COMPLETE' );
I added

Code: Select all

UserController::_sendactivatedMail($id);
This will call a new function that we will create later and it will pass the $id variable to that function.

STEP 3:

Then I copied the sendmail function, pasted it near the end of the file before the last }?> and renamed the function to sendactivatedMail - I did this because I wanted to use a different subject, body - etc and did not know where / how to add that if statement you had mentioned. I also added some items like the callout to fill in the user information from the $id variable that was passed. This is MY edited code after the copy paste.

Code: Select all

		function _sendactivatedMail(&$id)
	{
		global $mainframe;


		$db = & JFactory::getDBO();

		// gets the users information
        $user =& JUser::getInstance( (int) $id );

		$name 		= $user->get('name');
		$email 		= $user->get('email');
		$username 	= $user->get('username');

		$usersConfig 	= &JComponentHelper::getParams( 'com_users' );
		$sitename 		= $mainframe->getCfg( 'sitename' );
		$useractivation = $usersConfig->get( 'useractivation' );
		$mailfrom 		= $mainframe->getCfg( 'mailfrom' );
		$fromname 		= $mainframe->getCfg( 'fromname' );
		$siteURL		= JURI::base();
		
		$fromname		= "Name of Person";
		$mailfrom		= "[email protected]";
		
		$subject 	= sprintf ( JText::_( 'Account activated for' ), $name);
		$subject 	= html_entity_decode($subject, ENT_QUOTES);

		$message = sprintf ( JText::_( 'SEND_MSG_ACCTACTIVATED' ), $name, $siteURL."index.php");
		$message = html_entity_decode($message, ENT_QUOTES);

		//get all super administrator
		$query = 'SELECT name, email, sendEmail' .
				' FROM #__users' .
				' WHERE LOWER( usertype ) = "super administrator"';
		$db->setQuery( $query );
		$rows = $db->loadObjectList();

		// Send email to user
		if ( ! $mailfrom  || ! $fromname ) {
			$fromname = $rows[0]->name;
			$mailfrom = $rows[0]->email;
		}

		JUtility::sendMail($mailfrom, $fromname, $email, $subject, $message);

		// Send notification to all administrators
		$subject2 = sprintf ( JText::_( 'Account activated for' ), $name);
		$subject2 = html_entity_decode($subject2, ENT_QUOTES);

		// get superadministrators id
		foreach ( $rows as $row )
		{
			if ($row->sendEmail)
			{
				$message2 = sprintf ( JText::_( 'SEND_ADMINMSG_ACCTACTIVATED' ), $row->name, $name);
				$message2 = html_entity_decode($message2, ENT_QUOTES);
				JUtility::sendMail($mailfrom, $fromname, $row->email, $subject2, $message2);
			}
		}
	}
This new function allows me to modify whatever variables I want to - there are some variables that I didn't use but left in there like $sitename because I may want to use them later if you don't use them you can delete those entries as they wouldn't be needed.

I believe those are the only changes I made to the controller.php file -

STEP 4:

I also edited the en-GB.com_user.ini file located under language/en-GB/en-GB.com_user.ini

I added

Code: Select all

SEND_MSG_ACCTACTIVATED=Hello %s,\nYour account has been successfully activated you may now log in at %s.\n\nThank you for your support.

SEND_ADMINMSG_ACCTACTIVATED=Hello %s, \n%s's account has been sucessfully activated.\n\nPlease do not respond to this message. It is automatically generated and is for information purposes only.

ACCOUNT ACTIVATED FOR=Account has been activated for %s
This adds the variables that get filled in that are called out in the JText calls.

After that I was able to activate an account and the resulting user's email address would be emailed as well as all of the super adminstrators of the system who's accounts are set to recieve system emails.

Hope this helps and it has been a couple of days since I have done this so if you have any troubles or if someone has a suggestion on how to make it better please let me know.

bibichris
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Sun Feb 18, 2007 10:28 pm

Re: New User Approval - by Admin - or others

Post by bibichris » Sun Nov 30, 2008 3:04 pm

I'm going crazy to understand how to make work this on joomla 1.0. Can anybody help me please??

eli_cook
Joomla! Apprentice
Joomla! Apprentice
Posts: 14
Joined: Wed Feb 13, 2008 7:29 pm

Re: New User Approval - by Admin - or others

Post by eli_cook » Mon Dec 01, 2008 12:55 am

The changes that I made were to a Joomla 1.5.7 installation. I'm not sure that they will work for a 1.0.x install.

bibichris
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Sun Feb 18, 2007 10:28 pm

Re: New User Approval - by Admin - or others

Post by bibichris » Mon Dec 01, 2008 8:05 am

Thanks eli_cook.
By the way, in joomla 1.5 the file is controller.php, which is the file where the input to send the mail is? Is the admin.users.php maybe?

eli_cook
Joomla! Apprentice
Joomla! Apprentice
Posts: 14
Joined: Wed Feb 13, 2008 7:29 pm

Re: New User Approval - by Admin - or others

Post by eli_cook » Mon Dec 01, 2008 2:52 pm

Thanks eli_cook.
By the way, in joomla 1.5 the file is controller.php, which is the file where the input to send the mail is? Is the admin.users.php maybe?
JUtility::sendMail($mailfrom, $fromname, $email, $subject, $message);

Is one of the call outs that send the email using the parameters you have passed it.

I'm not sure what you mean by
which is the file where the input to send the mail is?
There is a language file that details the language, STEP 4 is where this is located.

There is nothing an admin will "input" as all of this takes place during the user registration.

bibichris
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Sun Feb 18, 2007 10:28 pm

Re: New User Approval - by Admin - or others

Post by bibichris » Mon Dec 01, 2008 3:51 pm

Thanks Eli. I just came out of this with a help from an expert friend.
She made something in file ps_shopper.php which was the responsible one (the website is joomla 1.0.15 and virtuemart 1.0.15) and now, the activation email, instead to be sent to the new user, is sent to the admnistrator who can activate easily right away from the email and forward the same email with the password to the new user once is done.
I attach the file here, so if someone has the same problem arrives here, can just upload it in administrator/components/com_virtuemart/classes/ and solve the problem! (to change the subjects go to line 439 and 440)
You do not have the required permissions to view the files attached to this post.

christofff
Joomla! Explorer
Joomla! Explorer
Posts: 333
Joined: Sat Jan 10, 2009 11:46 am
Contact:

Re: New User Approval - by Admin - or others

Post by christofff » Wed Jan 14, 2009 2:22 am

I can't help thinking this topic should be stickied or made into a gold statue.
I've been ploughed my way through & got it working after a few minor tweaks (oversights on my part).
Is this in the docs.joomla thing? Certainly should be.
A prime example of Open Source thinking & collaboration.

Thanks to all involved.

User avatar
airton
Joomla! Ace
Joomla! Ace
Posts: 1368
Joined: Sun Nov 04, 2007 1:12 am
Location: Brazil
Contact:

Re: New User Approval - by Admin - or others

Post by airton » Fri Jan 23, 2009 12:43 pm

I'd like to give my peace of help here.
I already implemented this feature in all the sites I run. Thanks to all who spent time into this.
Nevertheless, the method presented here is a core hack, which isn't the most elegant way. So, I used it in a 3pd extension and got the same result with a plus that is the ability to use captcha in my user forms. The extension is aUserManager from Alikonweb. I used the component for the tweaking and the module plus the captcha plugin to gain the captcha feature.

Thanks again, guys!
Airton Torres
Joomla Bug Squad http://groups.google.com/group/joomlabugsquad
Community website - http://community.joomla.org
Unsolicited support PMs will be deleted and the user added to the foes list.

christofff
Joomla! Explorer
Joomla! Explorer
Posts: 333
Joined: Sat Jan 10, 2009 11:46 am
Contact:

Re: New User Approval - by Admin - or others

Post by christofff » Fri Jan 23, 2009 1:49 pm

@airton - Agreed. And the first issue came as soon as I upgraded to 1.5.9 as my edits were overwritten on some files.
Thanks for the tip.

gffb
Joomla! Apprentice
Joomla! Apprentice
Posts: 32
Joined: Mon Jun 09, 2008 4:21 pm

Re: New User Approval - by Admin - or others

Post by gffb » Wed Feb 04, 2009 7:00 am

How about using Community Builder

User avatar
airton
Joomla! Ace
Joomla! Ace
Posts: 1368
Joined: Sun Nov 04, 2007 1:12 am
Location: Brazil
Contact:

Re: New User Approval - by Admin - or others

Post by airton » Wed Feb 04, 2009 5:15 pm

gffb wrote:How about using Community Builder
CB has a lot of the features that are missing in the core, specifically talking about users, roles and rights, but in many cases it's overkill. Why have all that if all you need is a means for the admin to approve a new user?
Airton Torres
Joomla Bug Squad http://groups.google.com/group/joomlabugsquad
Community website - http://community.joomla.org
Unsolicited support PMs will be deleted and the user added to the foes list.


Locked

Return to “Administration 1.5”