Thomas Varghese Thomas Varghese Thomas Varghese Thomas Varghese Thomas Maliackal

forex trading logo


Home Community ccBoard - Support Forum email topic function
 Support Forum :: ccBoard - Support Forum
Welcome Guest   [Register]  [Login]
 Subject :email topic function.. 2009-01-09 14:24:39 
N6REJ
Active
Joined: 2008-12-27 22:17:23
Posts: 183
Location: Knoxville, Iowa
   

Thomas exactly how does the email topic function start?  I've got an idea and I want to test it out before i say anything.

I see 2 spots where its coded, but I can't seem to find whats calling which function.  Would you kindly explain how this is working?  In otherwords when they make a new post ( I would think in helper/post.php ) the $post_text variable is filled as is the $post_topic.  Where is this done and at what point is the _emailSubscribtion or emailsubscription function being called?

I noticed in looking through things that you have that function named both ways. 

IP Logged
Troy
 Subject :Re: email topic function.. 2009-01-09 22:11:42 
thomas
Admin
Joined: 2008-12-13 17:16:30
Posts: 2,554
Location: Aluva, India
 

Hi,

Yes you are right. There are two places where email subscription function calls.

1) when a user subscribe/unsubscribe the email functionality. You can see the email-icon in the postlist. So this subscription/unsubscription  action calls the postlist.php model class. 

 

2) Then another one is the actual implementation of the functionality, after subscription when a post is made the mail is generated. This is related to posting, so it is done as part of the post.php model class.

 

Both function uses helper class sendmail method to send the mail after drafting the mail.

Hope this clears your doubts.

Thanks

Thomas

IP Logged
Together we can make history :star:
 Subject :Re: email topic function.. 2009-01-10 08:11:34 
N6REJ
Active
Joined: 2008-12-27 22:17:23
Posts: 183
Location: Knoxville, Iowa
   

no wasn't really doubts just was having problems locating the calling part of the code.  I want to add something to the body of the email but I don't want to tell you what cause you'll do it in 10 seconds and I want to try to figure it out for myself LOL  well hell guess it don't matter.. I'm trying to add the $post_text variable to the end of the body.  so i've got body .= $post_text .'\n'; and then I also added , $post_text to the () of the function, only issue is its not pulling the populated variable.  I don't know what I'm doing wrong *sigh*

Here is my code as I have it... this is in the model/post.php file.

    function _emailSubscription( $topic_email, $subject, $fid, $tid, $post_text)
    {
        $user = &JFactory::getUser();
        $pos = strpos( 'a'.$topic_email, $user->get('id') );
        if( $pos ) {
            $subj = JText::_('EMAIL_NOTIFY_ALERT') . ' ' .$subject ;
            $body = "Dear " . $user->get('username') . ", \n " .
                    "Following topic has been subscribed by you. \n " .
                    "Topic Name : " . $subject . "\n" .
                    'URL: ' . JRoute::_(JURI::root().'index.php?option=com_ccboard&forum=' .
                    $fid . '&topic=' . $tid ) . "\n" .
                    "Administrator. \n";
            $body .= $post_text . "\n";
           
            ccboardHelperConfig::sendMail($user->get('email'), $subj, $body );
        }

        return true;
    }

 

Then around line  303 i have this...

  $this->_emailSubscription( $trow->topic_email, $trow->post_subject, $trow->forum_id, $trow->id, $trow->post_text );

IP Logged
Troy
 Subject :Re: email topic function.. 2009-01-10 09:18:07 
N6REJ
Active
Joined: 2008-12-27 22:17:23
Posts: 183
Location: Knoxville, Iowa
   

nm, i figured it out :D

 

IP Logged
Troy
 Subject :Re: email topic function.. 2009-01-10 09:28:15 
thomas
Admin
Joined: 2008-12-13 17:16:30
Posts: 2,554
Location: Aluva, India
 

Then around line  303 i have this...

  $this->_emailSubscription( $trow->topic_email, $trow->post_subject, $trow->forum_id, $trow->id, $row->post_text );

 

 it is $row, $trow is for topic row, $row is for post.

Thanks

Thomas

 

IP Logged
Together we can make history :star:
 Subject :Re: email topic function.. 2009-01-10 13:57:17 
N6REJ
Active
Joined: 2008-12-27 22:17:23
Posts: 183
Location: Knoxville, Iowa
   

ok, i didn't know why the difference but I started digging through how each variable was called and what it did and discovered that.  When I saw it I about slugged myself for being so dumb LOL...  yeah its working... I'll email you what I've done so far but I'm not comfortable with it going out JUST yet.  Just gotta fix that one last glitch.  I'm a perfectionist :D

 should i use yahoo or hotmail or does it matter?

 

IP Logged
Troy
 Subject :Re: email topic function.. 2009-01-11 10:32:53 
N6REJ
Active
Joined: 2008-12-27 22:17:23
Posts: 183
Location: Knoxville, Iowa
   

Thomas ;  I'm happy to report that its complete!  Alpha tested and ready for beta!

you can access it here  Email Handler Edited by Thomas

I heavily commented and documented my work. I hope you like the end result... Here's a sample of the output good nite.
IP Logged
Troy
 Subject :Re: email topic function.. 2009-01-11 10:40:49 
thomas
Admin
Joined: 2008-12-13 17:16:30
Posts: 2,554
Location: Aluva, India
 

Hi N6REJ,

THANK YOU VERY MUCH.

You really deserve a coffee from my pocketSmile. It was really a cool piece of code. I have verified and it works well. I shall integrate the same to original source code and shall be available with the next release. 

I have modified the other mailing sections for changing the text format to HTML. Coz now emailing is always on HTML format.

N6REJ, hats off to your great work. I really appreciate it. Expect more of these types in future.Cool

 

Thanks

Thomas

Please note, when you do modifications or add new functionalities, it would be ideal to do it on the latest version always.

IP Logged
Together we can make history :star:
Page # 


Powered by ccBoard



Latest News

Latest Posts

More...


Popular Posts


Powered by Joomla!. Designed by: Joomla Template, url. Valid XHTML and CSS.

© 2008-2009 CODECLASSIC.ORG. All Rights Reserved.

) { echo