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.
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 Feb 11, 2009 1:06 am

Sorry for not previously specifying that this was a core hack, any changes to the files that I mentioned may get overwritten if you upgrade your Joomla installation.

A best practice for updating a Joomla site with core hacks that we use;
1. Backup the site.
2. Restore the site to a test domain (or subdomain).
3. Install your update from Joomla and check your files that have core hacks to see if they have changed.
4. Modify the core files (if needed).
5. Test.
6. Troubleshoot (if needed).
7. Implement

If you copy the files from domain to domain then make sure you update any of the static information like the FROM NAME and FROM EMAIL ADDRESS.

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 Feb 11, 2009 4:25 am

I realized as I was walking through my own steps on a test site that I didn't post out my own edited sendmail function.

This should be edited after creating a copy for the sendactivatedmail function.

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();

		$fromname	= "From this Person";
		$mailfrom		= "[email protected]";

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

		if ( $useractivation == 1 ){
			$message = sprintf ( JText::_( 'SEND_MSG_ACTIVATE' ), $name, $siteURL."index.php", $username, $password);
		} 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);
		$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, $name, $email, $username, $siteURL."index.php?option=com_user&task=activate&activation=".$user->get('activation'));
				$message2 = html_entity_decode($message2, ENT_QUOTES);
				JUtility::sendMail($mailfrom, $fromname, $row->email, $subject2, $message2);
			}
		}
	}
Changing the sendmail function to this will send the activation code to the super administrators that receive system emails.

I also wanted to point out that the $fromname and $mailfrom variables that I set manually can be removed if you want to use the site settings variables from Joomla.

niladri28
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Wed Feb 25, 2009 4:23 pm

Re: New User Approval - by Admin - or others

Post by niladri28 » Tue Mar 10, 2009 9:08 am

First of all thanks a lot for such a gr8 thread and to all the contributors.

I am newbie to the joomla world, and the first challenge i faced is of the activation issue.
Can any one educate me on my doubt that "will the mail be sent on activation from the administration "UserManagement- Enable"or only by clicking the activation link that would be sent to the administrator?

Thanks in advance.

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 » Tue Mar 10, 2009 9:30 am

You can do it in the backend through the User Management thing but the new member won't get any notification that their account is active if you do it that way. However if you click the activation link in the email and you've set things up as described above it'll send the confirmtation to the new member.

Is that what you meant?

niladri28
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Wed Feb 25, 2009 4:23 pm

Re: New User Approval - by Admin - or others

Post by niladri28 » Tue Mar 10, 2009 9:49 am

ya u got me correct. this is what i asked for.
But i am working on a site wherein the administrator would approve the users once the payment for the user registration is recieved. so it would be difficult(or i wud say cumbersome) for the administrator to click links in each mail to approve multiple user. It would be easy to check all the payments that the admin has recieved and enable each user from the admin section by clicking on the enable button.
And this is where i wud need to mail the user a confirmation.
Can this thing be achieved, which according to me might have been faced by the other developers too,and i would like to have inputs for the solution.
Help me out guys wit ur inputs....

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 » Tue Mar 10, 2009 3:09 pm

Enabling a user uses a different function - if you embed code in that function that sends an email when the users account is enabled it will be sent every time that the account is enabled / disabled (you probably can have separate enable and disable account messages). Is that the functionality that you are looking for?

If you are going to activate the users in the admin user interface, another option is to look for an add-on that will you can use to send a mass email to specific users.

niladri28
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Wed Feb 25, 2009 4:23 pm

Re: New User Approval - by Admin - or others

Post by niladri28 » Tue Mar 10, 2009 6:47 pm

eli_cook wrote:Enabling a user uses a different function - if you embed code in that function that sends an email when the users account is enabled it will be sent every time that the account is enabled / disabled (you probably can have separate enable and disable account messages). Is that the functionality that you are looking for?
This is what i am exacty asking for. which and where is the function that does the enabling/disabling of user.
Might be we can apply the same logic over there which we have applied in activating the user thru the activation code.

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 » Tue Mar 10, 2009 7:13 pm

niladri28 wrote:
eli_cook wrote:Enabling a user uses a different function - if you embed code in that function that sends an email when the users account is enabled it will be sent every time that the account is enabled / disabled (you probably can have separate enable and disable account messages). Is that the functionality that you are looking for?
This is what i am exacty asking for. which and where is the function that does the enabling/disabling of user.
Might be we can apply the same logic over there which we have applied in activating the user thru the activation code.
Check in the /administrator/components/com_users/ folder, specially the controller.php file.

Regards,
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.

gostram
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Sun Feb 15, 2009 2:56 pm

Re: New User Approval - by Admin - or others

Post by gostram » Thu Apr 02, 2009 7:16 pm

Hi all, thanks for all the replies to this thread. I am obviously looking for exactly the same feature.

Airton, do u think u could post the tweaked version of the extensions u installed to make it work??

It would be incredibly helpful if I could just install the extensions and get it to work without having to hack anything.

Thanks again.

freebietrader
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Sat Nov 29, 2008 2:41 am

Re: New User Approval - by Admin - or others

Post by freebietrader » Sat Apr 04, 2009 6:10 pm

This thread is exactly what I needed also. I wish there was just a way to install extensions without having to hack the core code. If so by all means please post it!

Edit: also I need it to function with vtiger.

ltdan
Joomla! Apprentice
Joomla! Apprentice
Posts: 21
Joined: Tue Dec 26, 2006 11:52 pm

Re: New User Approval - by Admin - or others

Post by ltdan » Sun Apr 05, 2009 11:16 am

Thanks for everyone's input into this, hopefully in the next update the dev's might add this function in as a legitimate option. Until then, I have a question?

I added all the steps listed by eli, but it doesn't seem to be functioning the way it should, I probably haven't followed the instructions properly but wondered if you could point me in the right direction?

So far the activation link is sent correctly to the super administrators and the link works and activates the account. At the same time, the user receives a blank e-mail which I am guessing is confirming that the account has been registered and is awaiting activation.

Now... when the administrator activates the account, the web page shows 2 messages:

Code: Select all

 (!) Could not instantiate mail function.
and

Code: Select all

Activation Complete!
Your Account has been successfully activated. You can now log in using the username and password you chose during the registration.
So the mail function failure is where I believe the user should then be sent an e-mail saying their account has been activated

However... after activating, all the super administrators receive the e-mail saying that the user's account has been activated, but missing the user's name from the message, e.g.

Code: Select all

Hello Administrator,
's account has been sucessfully activated.

Please do not respond to this message. It is automatically generated and is for information purposes only.
The bit that confused me is that there are 4 steps to eli's original solution, but on page 2 of this thread there is an extra bit and I wasn't sure if that was in addition or instead of? Is it possible to put a final step by step solution with everything in it or put a zip file with the correctly adjusted files in it?

Thanks again to eli, it's 99% there.

freebietrader
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Sat Nov 29, 2008 2:41 am

Re: New User Approval - by Admin - or others

Post by freebietrader » Sun Apr 05, 2009 3:30 pm

That would be great ^ ...all the code in this thread has be confused on what to do. I'm pretty sure I need to do exactly what you need itdan, but this thread is so cluttered.

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 » Sun Apr 05, 2009 6:48 pm

Freebietrader, you're quite right about it becoming a bit muddled. The solution is here & I managed to do it buy copy/pasting chunks from various posts in this thread and then working through my notes. Fortunately (miraculously!) I kept those notes.

What follows is a compilation of posts from the talented contributors on this thread. This process worked great for me as far as I can remember & is still functioning on one of my clients sites.

Editing the files as follows will cause the following registration process:
1) New user enters their details to register
2) New user receives email saying that their registration needs to be authorised
3) All Admins set to receive system emails receive an email with users details and link to activate
4) Admin clicks activation link & user receives email to say that they have been approved and can now login.

Code: Select all

Do not make the changes to /componets/com_user/controller.php as mentioned above.
Instead, change the line 117 in the language file :
Code:
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:
         $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:
         $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:
            $message2 = sprintf ( JText::_( 'SEND_MSG_ADMIN' ), $row->name, $sitename, $name, $email, $username);

to:
Code:
            $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.
-----------------------------------------------------------------
If you also needed to have reply emails sent back after activation - to get an email sent upon activation.

Edit the function activate() section of controller.php file located under components/com_user/
STEP 1:
Under Line 331 ---- jimport('joomla.user.helper');
Add
      $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:
Under line 351 ----- $message->text = JText::_( 'REG_ACTIVATE_COMPLETE' );
Add
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:
Copy the sendmail function, paste it near the end of the file before the last }?> and rename the function to sendactivatedMail - Do this to use a different subject, body - etc. I also added some items like the callout to fill in the user information from the $id variable that was passed. This is the edited code after the copy paste.
Code:
      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 you to modify whatever variables you 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
Add
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.
None of the above is my own work (except having copied/paste etc) and full credit goes to the original contributors in this thread.

Hopefully it'll work for you too... Please let us know!

Chris.

freebietrader
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Sat Nov 29, 2008 2:41 am

Re: New User Approval - by Admin - or others

Post by freebietrader » Sun Apr 05, 2009 8:16 pm

Thank you so much! I will copy/paste this code and work on it later! I really do appreciate your contributions as well as others!!

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 » Sun Apr 05, 2009 9:31 pm

You're welcome.

I just noticed this thread has had almost 4000 views! Might be a good indicator that this really would be a useful core component for a standard joomla install...

freebietrader
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Sat Nov 29, 2008 2:41 am

Re: New User Approval - by Admin - or others

Post by freebietrader » Sun Apr 05, 2009 9:45 pm

Maybe if we keep hinting at it they will take notice.

User avatar
catharina
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Fri Feb 01, 2008 11:45 pm
Location: Guelph, Ontario, Canada
Contact:

Re: New User Approval - by Admin - or others

Post by catharina » Tue Apr 07, 2009 5:38 pm

Hi Folks,

I have successfully upgraded my site from 1.5.6 to 1.5.10 and am looking for a way to be able to approve users before they can see content that is restricted to registered users. I am about to try to see if the info presented in this thread works. I'll report back as soon as I know if it works and will post anything new that I learn in the process. I am not an expert by any stretch of the imagination. I know just enough to keep me in trouble ;) so if any experts on this forum can give me any advice, it would be greatly appreciated.

If you can let me know how high the user needs to be to see the items marked as Special, that would also be greatly appreciated as I am still on low this long Joomla! learning curve.

Thanks very much!
Cat =^..^=
Cat =^..^=
WebDesign by Catharina

Signature rules: Literal URLs only - http://forum.joomla.org/viewtopic.php?f=8&t=65

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 » Tue Apr 07, 2009 6:30 pm

gostram wrote:Hi all, thanks for all the replies to this thread. I am obviously looking for exactly the same feature.

Airton, do u think u could post the tweaked version of the extensions u installed to make it work??

It would be incredibly helpful if I could just install the extensions and get it to work without having to hack anything.

Thanks again.
Hey gostram!

Sorry for taking so long to reply.

I can do what you ask, but I noticed that the extension was built based on J!1.5.6 or 1.5.7 and there have been some changes (security patches) on com_users since them.

I'm reviewing the extension to be based on J!1.5.10 and will post a link for all of you to download it as soon as I have it done.

Also, I'm in contact with the extension's original developers (alikonweb) to make my patch part of their official releases.

Further, I'm studying some ways of making a parameter in the admin area to enable/disable admin approval.

I'll have something on this shortly.
catharina wrote:If you can let me know how high the user needs to be to see the items marked as Special, that would also be greatly appreciated as I am still on low this long Joomla! learning curve.
Special means anything above registered users (author, editor, publisher, manager, administrator, super-admin).

Best regards,
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.

ltdan
Joomla! Apprentice
Joomla! Apprentice
Posts: 21
Joined: Tue Dec 26, 2006 11:52 pm

Re: New User Approval - by Admin - or others

Post by ltdan » Tue Apr 07, 2009 11:35 pm

Firstly, thanks to Christofff that worked perfectly, I have 1.5.10 installed and apart from a few line numbers being different it all worked, excellent work my friend :D The only thing I noticed is that the user message sent after registration (not the approval one, but the confirmation one which would normally ask them to activate their account) has a blank message.

The subject heading says 'Account details for blahblahblah at blahblah.com' but nothing in the message body, it would be nice to put confirmation in the message body that the details have been registered and are now awaiting approval. Otherwise they might think that is the approval message, although I'm sure when I have a spare hour or so I can work out where to add the message body for that. I am glad that the account approved message is working now though, that was the bit that was puzzling me.

Airton has the right idea as well, to have a plugin or component that can be loaded and enabled/disabled in the admin section would be perfect, even more perfect, which has been said so many times is to have this as a standard function that can be selected or not. It is something that is available as standard in phpbb forums, VBulletin, etc... and with the amount of dodgy adbots or malicious users spamming websites I think it's not enough for many people to just rely on captcha technologies. There was one phpbb forum I used to administer that was so badly spammed I ended up putting a little hack into the user registration form that simply asked "are you a human being" and they had to physically type 'yes' into a box, which did the trick.

What this little adjustment does is to put the power firmly back into the hands of the administrators of the site as to who they allow to view and contribute to it. Thanks to everyone who has contributed to this thread and to the final solution.

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 Apr 08, 2009 11:40 am

ltdan wrote:The only thing I noticed is that the user message sent after registration (not the approval one, but the confirmation one which would normally ask them to activate their account) has a blank message
Ah, I think that happened to me also. I'm racking mr brain trying to remember the cause/solution... I think it had something to do with the text in en-gb.ini file or wherever it was that you edited the text that goes to the user. I'd also added some extra registration fields that I wanted to receive as part of the notification and that added to my confusion.

I think it had something to do with the number of %s or \n in my text in that en-gb.ini file. Try reverting it to its' original state and see if that works and then make small tweaks to what you want it to say and check the message each time for changes...

I'll try & check my actual codes to see if I can see my final mods when I get a mo. Glad it worked in the main for you though.

freebietrader
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Sat Nov 29, 2008 2:41 am

Re: New User Approval - by Admin - or others

Post by freebietrader » Wed Apr 08, 2009 5:23 pm

Does anybody know how to edit and add fields to the registration form? I need to add some fields so that I can give the user the appropriate member access level.

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 Apr 08, 2009 6:50 pm

freebietrader wrote:Does anybody know how to edit and add fields to the registration form? I need to add some fields so that I can give the user the appropriate member access level.
http://forum.joomla.org/viewtopic.php?f ... 43&start=0 worked great for me, and even integrated with this admin/registration mallarky...
Chris.

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 » Mon May 11, 2009 5:26 am

Hi all!

As asked by gostram, I revised the user component I'm using to do this hack. What I did, I got a fresh copy of the com_auser and mod_alogin from Alikonweb and ran a diff with the latest J!1.5.10 from SVN. Then I applied the hack explained in this thread plus added a parameter to the component to set wether it should use or not the activation by an administrator.

I'm attaching the component and the module here so everybody may benefit from it.

There are some considerations though. Since there were some security issues tackled in the user component forked by Alikonweb, and since there are a lot of redirects hard coded in the core, it is still necessary to patch some core file to make the component work as expected. Nevertheless, the patches are a lot smaller than hacking the hole core user component, so it's easier to keep track of modifications in case of an upgrade of Joomla!.

The files that need to be patched are:
  • /components/com_contact/views/contact/view.html.php ==> line 63
  • /components/com_content/views/article/view.html.php ==> line 86
  • /components/com_content/views/article/view.pdf.php ==> line 53
  • /components/com_content/views/category/view.html.php ==> line 246
  • /components/com_content/views/category/tmpl/default_items.php ==> line83
  • /components/com_content/views/frontpage/view.html.php ==> line 147
  • /components/com_content/views/section/view.html.php ==> line 163
  • /modules/mod_latestnews/helper.php ==> line 111
  • /modules/mod_mostread/helper.php ==> line 81
  • /modules/mod_newsflash/helper.php ==> line 44
In those files, change the reference from

Code: Select all

index.php?option=com_user&view=login
to

Code: Select all

index.php?option=com_auser&view=login
Also, the file /libraries/joomla/user/authorization.php must be changed in the following way:
Copy lines 61 to 69 and paste right bellow them, then change the pasted lines from com_user to com_auser. Bellow is the patched code:

Code: Select all

		// special ACl with return value to edit user
		$this->addACL( 'com_user', 'edit', 'users', 'super administrator', null, null, '' );
		$this->addACL( 'com_user', 'edit', 'users', 'administrator', null, null, '' );
		$this->addACL( 'com_user', 'edit', 'users', 'manager', null, null, '' );
		// return value defines xml setup file variant
		$this->addACL( 'com_user', 'edit', 'users', 'author', null, null, 'author' );
		$this->addACL( 'com_user', 'edit', 'users', 'editor', null, null, 'author' );
		$this->addACL( 'com_user', 'edit', 'users', 'publisher', null, null, 'author' );
		$this->addACL( 'com_user', 'edit', 'users', 'registered', null, null, 'registered' );

		// special ACL with return value to edit auser
		$this->addACL( 'com_auser', 'edit', 'users', 'super administrator', null, null, '' );
    $this->addACL( 'com_auser', 'edit', 'users', 'administrator', null, null, '' );
    $this->addACL( 'com_auser', 'edit', 'users', 'manager', null, null, '' );
    // return value defines xml setup file variant
    $this->addACL( 'com_auser', 'edit', 'users', 'author', null, null, 'author' );
    $this->addACL( 'com_auser', 'edit', 'users', 'editor', null, null, 'author' );
    $this->addACL( 'com_auser', 'edit', 'users', 'publisher', null, null, 'author' );
    $this->addACL( 'com_auser', 'edit', 'users', 'registered', null, null, 'registered' );
That's all.
Don't forget to set the administration activation in the component's preferences right after installing.
Enjoy!
ausermanager.zip
mod_alogin_154.zip
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.

User avatar
ssv445
Joomla! Apprentice
Joomla! Apprentice
Posts: 45
Joined: Fri Dec 12, 2008 5:18 am
Location: Bhilwara, India
Contact:

Re: New User Approval - by Admin - or others

Post by ssv445 » Wed May 13, 2009 5:28 am

The JoomlaXi Solution : We have developed a plugin, called Admin Approval Plugin. Once it is installed on your site, the administrator of website can selectively approve the joining request.

Features
1. No core hacks, its a plugin. Easily and quickly installable.
2. One click approval link in email for admins, no hassles.
3. You can customize the emails from plugin administration.
4. A welcome email is also sent to user, customize it with the ease.
5. This also integrates with our JomSocial Multiple Profile Type Plugin (ver 1.1 and later).


How it works :
1. When user register on your site an activation email is sent to the user (for email verification).
2. The user when clicks on activation link, our plugin catches the event,
3. The plugin
---- Blocks the user
---- Mark the user's email verified
---- Send an email to admin to approve the user.This email have once click link to activate the user.
4. Admin upon receiving the user detail and approval request, decide to activate on not activate.
5. System sends a welcome email to the newly activated user.

get it from here : http://www.joomlaxi.com/products/61-adm ... lugin.html
Shyam Rathore -
http://www.readybytes.net. <= Joomla eCommerce, the correct way.
https://readyviews.coml <= Sentiment Analysis of Product Reviews

krdes22
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Wed May 13, 2009 10:42 pm

Re: New User Approval - by Admin - or others

Post by krdes22 » Wed May 13, 2009 11:18 pm

airton wrote: Don't forget to set the administration activation in the component's preferences right after installing.
Hi All

First thanks to everyone that worked on this.

Im trying to get this to work, i did download the zips and installed them.
I followed the steps above.
Problem one, there is no /components/com_contact/views/contact/view.html.php
Problem two, how do i set the administration activation in the component's preferences? When i click components->A user manager = i get "You are not authorised to view this resource."

When i test the registration it does the same normal way of user self registraion.
I am using the auser module.
using joomla 1.5.10
ssv445 wrote: The JoomlaXi Solution : We have developed a plugin, called Admin Approval Plugin. Once it is installed on your site, the administrator of website can selectively approve the joining request.
Im getting a 301 - Moved error on your site when i try download the plugin and register. is there any where else i can download the plugin.

Thanks

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 » Thu May 14, 2009 12:46 am

krdes22 wrote:Hi All

First thanks to everyone that worked on this.
Hi,
You're welcome!
krdes22 wrote:Im trying to get this to work, i did download the zips and installed them.
I followed the steps above.
Problem one, there is no /components/com_contact/views/contact/view.html.php
Are you sure you are looking in the correct location? That's the main view file for the contacts component. Check again.
krdes22 wrote:Problem two, how do i set the administration activation in the component's preferences? When i click components->A user manager = i get "You are not authorised to view this resource."
Did you change the /libraries/joomla/user/authorization.php file as I instructed? If you don't you'll get that message. When you get access to the component, there is a "Preferences" button in the toolbar where you can set the parameters.
krdes22 wrote:When i test the registration it does the same normal way of user self registraion.
I am using the auser module.
using joomla 1.5.10
That's because the default is not to have admin activation. You must set it in the parameters first.
krdes22 wrote:ssv445 wrote:
The JoomlaXi Solution : We have developed a plugin, called Admin Approval Plugin. Once it is installed on your site, the administrator of website can selectively approve the joining request.


Im getting a 301 - Moved error on your site when i try download the plugin and register. is there any where else i can download the plugin.
I don't know about that but I downloaded it earlier today and it works wonderfully. I just didn't move to it yet because of the captcha function in auser and alogin that I use extensively. But if you don't need captcha, this is the easiest and most elegant way to have admin activation. You should try!
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.

User avatar
ssv445
Joomla! Apprentice
Joomla! Apprentice
Posts: 45
Joined: Fri Dec 12, 2008 5:18 am
Location: Bhilwara, India
Contact:

Re: New User Approval - by Admin - or others

Post by ssv445 » Thu May 14, 2009 3:33 am

I do not see this error.
The download is easily accessible at here : http://www.joomlaxi.com/downloads.html? ... einfo&id=8

Thanks
Shyam
Shyam Rathore -
http://www.readybytes.net. <= Joomla eCommerce, the correct way.
https://readyviews.coml <= Sentiment Analysis of Product Reviews

krdes22
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Wed May 13, 2009 10:42 pm

Re: New User Approval - by Admin - or others

Post by krdes22 » Thu May 14, 2009 10:55 am

ssv445 wrote:I do not see this error.
The download is easily accessible at here : http://www.joomlaxi.com/downloads.html? ... einfo&id=8

Thanks
Shyam
Strange i still get the error and sorry its a 404 - error not 301
I tried firefox ie and safari.

I will post pics soon showing this.

User avatar
ssv445
Joomla! Apprentice
Joomla! Apprentice
Posts: 45
Joined: Fri Dec 12, 2008 5:18 am
Location: Bhilwara, India
Contact:

Re: New User Approval - by Admin - or others

Post by ssv445 » Fri May 15, 2009 7:08 am

krdes22 wrote:
ssv445 wrote:I do not see this error.
The download is easily accessible at here : http://www.joomlaxi.com/downloads.html? ... einfo&id=8

Thanks
Shyam
Strange i still get the error and sorry its a 404 - error not 301
I tried firefox ie and safari.

I will post pics soon showing this.
Please cross check your network, it might be some issue there. As I have already 40+ download in last 2 days.

- Shyam
Shyam Rathore -
http://www.readybytes.net. <= Joomla eCommerce, the correct way.
https://readyviews.coml <= Sentiment Analysis of Product Reviews

krdes22
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Wed May 13, 2009 10:42 pm

Re: New User Approval - by Admin - or others

Post by krdes22 » Fri May 15, 2009 9:20 pm

Please cross check your network, it might be some issue there. As I have already 40+ download in last 2 days.

- Shyam
Yip seems to be somthing with maybe my ISP or the network my ISP is on. I tried on a differant pc and differant ISP and worked.


Locked

Return to “Administration 1.5”