PHP Web Host - Quality Web Hosting For All PHP Applications $35/month $250/year (Unlimited) - $25/month - 200,000 impressions - Your Ad Could be Here - Click For Details
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
sak
Worker
Worker


Joined: Jul 06, 2005
Posts: 167

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

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 to the forums!


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.
View user's profile Send private message Visit poster's website
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 6044

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

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...
View user's profile Send private message
sak
Worker
Worker


Joined: Jul 06, 2005
Posts: 167

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

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
View user's profile Send private message Visit poster's website
jakec
Site Admin


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

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

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


Joined: Jul 06, 2005
Posts: 167

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

Ah, never noticed that forum before Smile Thanks
View user's profile Send private message Visit poster's website
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 6044

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

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?
View user's profile Send private message
sak
Worker
Worker


Joined: Jul 06, 2005
Posts: 167

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

yes, the fields I need are all required at registration
View user's profile Send private message Visit poster's website
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 6044

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

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);
View user's profile Send private message
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 6044

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

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).
View user's profile Send private message
sak
Worker
Worker


Joined: Jul 06, 2005
Posts: 167

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

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!
View user's profile Send private message Visit poster's website
sak
Worker
Worker


Joined: Jul 06, 2005
Posts: 167

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

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.
View user's profile Send private message Visit poster's website
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 6044

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

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.
View user's profile Send private message
sak
Worker
Worker


Joined: Jul 06, 2005
Posts: 167

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

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
View user's profile Send private message Visit poster's website
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 6044

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

The to should be:
Code:
         $message .= 'User: ' . $ya_username . "\r\n";
View user's profile Send private message
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 6044

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

Anyone have issues with this being added to RN 2.4? I believe it would be useful and not cause any negative impact.
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

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

Excellent idea - Do it!
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
sak
Worker
Worker


Joined: Jul 06, 2005
Posts: 167

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

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
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic

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
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum