Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Seeking applications ...
Author Message
sak
Worker
Worker



Joined: Jul 06, 2005
Posts: 172

PostPosted: Mon Sep 14, 2009 4:54 pm Reply with quote

I'm running the latest RN -- 2.30.02. Loving it!

I've come across the need to notify myself of new account creations. I posted a thread in the suggestions for later revisions of RN for this: [ Only registered users can see links on this board! Get registered or login! ]

What I'm trying to accomplish is to be able have sent automatically when someone registers an email containing not only their username and IP, but their real name and other fields -- my specific need right now Real name, email, and 2 custom fields under RNYA. Other people may have other needs, which they could adapt.

I'm not a programmer, although I can get in, hack things a little bit, and most of the time understand what's going on. I'm just not familiar with php enough yet to do it all myself Sad

I'm looking at the /modules/Your_Account/public/new_finish.php file (starting line 216):

Code:
      if ($ya_config['sendaddmail'] == 1 AND $ya_config['servermail'] == 1) {


         if ($ya_config['requireadmin'] == 1) {

            $subject = $sitename . ' - ' . _MEMAPL;

            $message = $ya_username . ' ' . _YA_APLTO . ' ' . $sitename . ' ' . _YA_FROM . ' ' . $ip . "\r\n";

         } elseif ($ya_config['useactivate'] == 1) {

            $subject = $sitename . ' - ' . _MEMACT;

            $message = $ya_username . ' ' . _YA_APLTO . ' ' . $sitename . ' ' . _YA_FROM . ' ' . $ip . "\r\n";

         } elseif ($ya_config['useactivate'] == 0) {

            $subject = $sitename . ' - ' . _MEMADD;

            $message = $ya_username . ' ' . _YA_ADDTO . ' ' . $sitename . ' ' . _YA_FROM . ' ' . $ip . "\r\n";

         }

         $message .= '-----------------------------------------------------------' . "\r\n";

         $message .= _YA_NOREPLY;

         ya_mail($adminmail, $subject, $message, $ya_user_email);

      }


I'm assuming I would have to define some things at the top? I would also like it to send to a different address than $adminmail. Can I just hardcode my desired email in there, or can I create a new variable (is that what they're called) and define it at the top?

Hopefully what I'm trying to accomplish isn't too hard. I'm sure other people might find it useful in the future if we can figure out a mod for this. One of the useful things is to be able to bring these emails into a third-party email parser for instant live parsing of user data.

_________________
[ Only registered users can see links on this board! Get registered or login! ] [ Only registered users can see links on this board! Get registered or login! ] 
View user's profile Send private message Visit poster's website
kguske
Site Admin



Joined: Jun 04, 2004
Posts: 6432

PostPosted: Tue Sep 15, 2009 12:56 pm Reply with quote

We're a little busy with the release right now, but this is something I'm interested in, too. Let me check later this week...

_________________
I search, therefore I exist...
nukeSEO - nukeFEED - nukePIE - nukeSPAM - nukeWYSIWYG
 
View user's profile Send private message
sak







PostPosted: Sun Sep 20, 2009 7:18 pm Reply with quote

I gotta get this goin this week somehow, because I have a show on Saturday and Sunday and I'll need the emails being dumped into my parser.

Do you think you could help me with a quick hack to get the few fields I need in there for now and then if it's something you guys decide is worthwhile it can always be coded into the GUI later? I'm getting desperate Very Happy
 
jakec
Site Admin



Joined: Feb 06, 2006
Posts: 3048
Location: United Kingdom

PostPosted: Sun Sep 20, 2009 11:39 pm Reply with quote

If you want a quick turnaround you might want to post in the for hire forum.
 
View user's profile Send private message
sak







PostPosted: Mon Sep 21, 2009 9:46 am Reply with quote

Ah, never noticed that forum before Smile Thanks
 
kguske







PostPosted: Mon Sep 21, 2009 11:12 am Reply with quote

What if we included all fields required for registration (except the password, of course) in the admin notification?

Are the real name and 2 custom fields required for registration?
 
sak







PostPosted: Mon Sep 21, 2009 3:39 pm Reply with quote

yes, the fields I need are all required at registration
 
kguske







PostPosted: Mon Sep 21, 2009 5:14 pm Reply with quote

How about this: display all fields used for registration?

If so, in modules/Your_Account/public/new_finish.php, after
Code:
      if ($ya_config['sendaddmail'] == 1 AND $ya_config['servermail'] == 1) {

         if ($ya_config['requireadmin'] == 1) {
            $subject = $sitename . ' - ' . _MEMAPL;
            $message = $ya_username . ' ' . _YA_APLTO . ' ' . $sitename . ' ' . _YA_FROM . ' ' . $ip . "\r\n";
         } elseif ($ya_config['useactivate'] == 1) {
            $subject = $sitename . ' - ' . _MEMACT;
            $message = $ya_username . ' ' . _YA_APLTO . ' ' . $sitename . ' ' . _YA_FROM . ' ' . $ip . "\r\n";
         } elseif ($ya_config['useactivate'] == 0) {
            $subject = $sitename . ' - ' . _MEMADD;
            $message = $ya_username . ' ' . _YA_ADDTO . ' ' . $sitename . ' ' . _YA_FROM . ' ' . $ip . "\r\n";
         }

insert:
Code:
         // Add registration fields to admin notification

         $message .= _NICKNAME . ': ' . $ya_username . "\r\n";
         if ($ya_config['userealname'] > 1) $message .= _UREALNAME . ': ' . $ya_realname . "\r\n";
         $message .= _EMAIL . ': ' . $ya_user_email . "\r\n";
         // Add custom registration fields to admin notification
         $result = $db->sql_query('SELECT * FROM ' . $user_prefix . '_users_fields WHERE (need = \'2\') OR (need = \'3\') ORDER BY pos');
         while ($sqlvalue = $db->sql_fetchrow($result)) {
            $t = $sqlvalue['fid'];
            $name_exit = ya_GetCustomFieldDesc($sqlvalue['name']);
            $message .= $name_exit . ': ' . $nfield[$t] . "\r\n";
         }
         if ($ya_config['usefakeemail'] > 1) $message .= _UFAKEMAIL . ': ' . $femail . "\r\n";
         if ($ya_config['usewebsite'] > 1) $message .= _YOURHOMEPAGE . ': ' . $user_website . "\r\n";
         if ($ya_config['useinstantmessaim'] > 1) $message .= _YAIM . ': ' . $user_aim . "\r\n";
         if ($ya_config['useinstantmessicq'] > 1) $message .= _YICQ . ': ' . $user_icq . "\r\n";
         if ($ya_config['useinstantmessmsn'] > 1) $message .= _YMSNM . ': ' . $user_msnm . "\r\n";
         if ($ya_config['useinstantmessyim'] > 1) $message .= _YYIM . ': ' . $user_yim . "\r\n";
         if ($ya_config['uselocation'] > 1) $message .= _YLOCATION . ': ' . $user_from . "\r\n";
         if ($ya_config['useoccupation'] > 1) $message .= _YOCCUPATION . ': ' . $user_occ . "\r\n";
         if ($ya_config['useinterests'] > 1) $message .= _YINTERESTS . ': ' . $user_interests . "\r\n";
         if ($ya_config['usenewsletter'] > 1) $message .= _RECEIVENEWSLETTER . ': ' . $newsletter . "\r\n";
         if ($ya_config['useviewemail'] > 1) $message .= _ALWAYSSHOWEMAIL . ': ' . $user_viewemail . "\r\n";
         if ($ya_config['usehideonline'] > 1) $message .= _HIDEONLINE . ': ' . $user_allow_viewonline . "\r\n";
         if ($ya_config['usesignature'] > 1) $message .= _SIGNATURE . ': ' . $user_sig . "\r\n";
         if ($ya_config['useextrainfo'] > 1) $message .= _EXTRAINFO . ': ' . $bio . "\r\n";


just before:
Code:
         $message .= '-----------------------------------------------------------' . "\r\n";

         $message .= _YA_NOREPLY;
         ya_mail($adminmail, $subject, $message, $ya_user_email);
 
kguske







PostPosted: Mon Sep 21, 2009 5:16 pm Reply with quote

Be aware: I did VERY MINIMAL testing on this (i.e. 1 simple test). Use this at your own risk... (note that this is after everything else is done, so the real risk is that you won't get a notification email, and if it crashes, you might expose your root path).
 
sak







PostPosted: Mon Sep 21, 2009 8:52 pm Reply with quote

Thanks so much, kguske Very Happy

Just installed it and it works great. I left out the if statements only because I don't plan on using any of those, but I understand exactly what you're doing. Thanks so much!! I'm going to put a shout out for the RavenNuke team!
 
sak







PostPosted: Tue Sep 22, 2009 11:57 am Reply with quote

If I wanted the email to use "User:" instead of "Nickname:" (I think two fields with *name in them is causing trouble).

Would I change:

Code:
         $message .= _NICKNAME . ': ' . $ya_username . "\r\n";


to

Code:
         $message .= User': ' . $ya_username . "\r\n";


wasn't sure about the syntax.
 
kguske







PostPosted: Tue Sep 22, 2009 12:12 pm Reply with quote

The _NICKNAME constant is the same one used for registration, so if you want to be consistent, you could simply change the value of _NICKNAME in your language file.
 
sak







PostPosted: Tue Sep 22, 2009 1:12 pm Reply with quote

Yeah I changed that. I will have to use just "user" for the email though because of the *name problem with the parser. Does the above syntax look OK, or do I need spaces or more ' or something?

I made a small donation for all the help you've given me. If everyone does the same we can keep this place runnin Smile
 
kguske







PostPosted: Tue Sep 22, 2009 1:16 pm Reply with quote

The to should be:
Code:
         $message .= 'User: ' . $ya_username . "\r\n";
 
kguske







PostPosted: Sat Sep 26, 2009 11:46 pm Reply with quote

Anyone have issues with this being added to RN 2.4? I believe it would be useful and not cause any negative impact.
 
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Sun Sep 27, 2009 12:35 am Reply with quote

Excellent idea - Do it!
 
View user's profile Send private message
sak







PostPosted: Wed Mar 24, 2010 3:20 pm Reply with quote

It has worked out fabulously for me. We've used it to integrate our email system in with our user account system. Talk about making things easy!

Ironically, we're switching over to a new email system that is much more advanced, costs 10 times what the first one does, and yet it doesn't have an email parser. So now we have to API something to do this. I may need to hire someone to do that as well Surprised
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Seeking applications ...

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©