Members: 16,996
Threads: 38,831
Posts: 159,349
Online: 47

Newest Member: Kl_broka@rediffmail.com


Odoo.tv - Outdoor Television


Sedo - Domains kaufen und verkaufen das Projekt mambers.com steht zum Verkauf Besucherstatistiken von mambers.com etrackerŽ Web-Controlling statt Logfile-Analyse
Old 04.02.2005, 20:03   #1 (permalink)
Baby Mamber
 
santier's Avatar
 
Join Date: Jan 2005
Posts: 6
santier is on a distinguished road
Default Yanc and Community Builder integration

I like CB alot and I'd like to see it become a common platform for other components that incorporate the user profile. The integration with simpleboard & pms are great steps in that direction. So here's my part in furthering that effort.

YANC 1.4 offered instruction on integrating the Yanc newsletter component with the stock Mambo user registration. Based on that I was able to devise a way for admins using the Community Builder component to enable users to sign up for available newsletters at the time of registration. Confirming their registration in Community Builder also confirms their registration for the newsletter lists.

[Step 1]
Install both the YANC and Community Builder components. In my tests I used Yanc 1.4 beta and CB 1.0 Beta 4. You could also use YAnc 1.32 (since 1.4 seems to have issues with PHP 5) but you'll need to get the file class.dbclasses.php from the 1.4 distribution and copy it to \administrator\components\com_yanc\classes.

[Step 2]
In the file \components\com_comprofiler\comprofiler.php

Search for this code (around line 16)

Code:
require_once ( $mainframe->getPath( 'front_html' ) );
And insert the following code below

PHP Code:
require_once ($mosConfig_absolute_path .'/components/com_yanc/codehacks/cb_integration.php'); 
[Step 3]
In the file \components\com_comprofiler\comprofiler.php

Search for this code (around line 70)

Code:
case "saveRegistration":
saveRegistration( $option );
break;
And replace with the following

Code:
case "saveRegistration":
saveYancRegistration($ueConfig['name_style']);
saveRegistration( $option );
break;
[Step 4]
In the file \components\com_comprofiler\comprofiler.php

Search for this code (around line 79)

Code:
case "confirm":
confirm($confirmCode);
break;
And replace with the following

Code:
case "confirm":
confirmYancSubscriber($confirmCode);
confirm($confirmCode);
break;
[Step 5]
edit the file \components\com_comprofiler\comprofiler.html.php

Search for this code (around line 1097)

Code:
<tr>
      <td colspan="2">&nbsp;</td>
</tr>

Add the following code below

PHP Code:
<?php showLists(); ?>

[Step 6]
Yanc 1.3 users need to create a directory called codehacks in \components\com_yanc
Create a file called cb_integration.php in this directory and insert the following code in this file.

PHP Code:
<?php
// --------------------------------------------------------------------------------
// YaNC - Yet another Newsletter Component
// Copyright (C) 2003-2004 TIM_online
// http://www.tim-online.nl
//
// All rights reserved.  YaNC is a component for Mambo 4.5. 
// It allows you to compose various newsletters and send then to subscribers 
// to different lists. You can use HTML or text mailings
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
//
// The "GNU General Public License" (GPL) is available at
// http://www.gnu.org/copyleft/gpl.html
// --------------------------------------------------------------------------------
// $Id: reg_integration.php,v 1.1 2004/11/04 17:51:29 websmurf Exp $

// modified for Community Builder integration Eric Santiago http://www.ericsantiago.com 2005/02/04

// ensure this file is being included by a parent file
defined'_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

include( 
$mosConfig_absolute_path '/administrator/components/com_yanc/classes/class.dbclasses.php' );



function 
showLists() {
  global 
$letters;
  
  
$lists getLists();
  if(
count($lists) > 0){
      echo 
'<tr><td colspan="2" class="componentheading">Subscribe yourself to the following mailing 

lists:</td></tr>'
;
      
//echo '<tr><td colspan="2">&nbsp;</td></tr>';
      
echo '<tr><td colspan="2"><blockquote>';
      foreach(
$lists AS $list){      
          echo 
'<p><input checked type="checkbox" name="list[]" value="' $list->id '" /> ' 

$list->list_desc '</p>';
      }
      echo 
'<blockquote></td></tr>';
      echo 
'<tr><td>&nbsp;</td>
          <td><input checked type="checkbox" name="html" value="1" /><i>Receive emails in HTML format?</i></td>
        </tr>'
;
        echo 
'<tr><td colspan="2"><hr></td></tr>';
   }
  
}

function 
getLists(){
    global 
$database$my;
    
    
$query "SELECT * FROM #__newsletter_letters WHERE hidden <= "intval($my->gid) ." ORDER BY list_name";
    
$database->setQuery($query);
    
$total $database->loadObjectList();
    echo 
$database->getErrorMsg();

    return 
$total;                
}

function 
saveYancRegistration($name_style){
  global 
$database
  
$lists mosGetParam($_POST'list', array());
  
  
//accomodates for various name styles in cb
  
SWITCH($name_style) {
    case 
2:
        
$name mosGetParam($_POST'firstname''') . " " mosGetParam($_POST'lastname''');
        break;
    case 
3:
        
$name mosGetParam($_POST'firstname''') . " " mosGetParam($_POST'lastname''');
        break;
    DEFAULT:
        
$name mosGetParam($_POST'name''');
        break;
    }
  
$email mosGetParam($_POST'email''');
  
$html mosGetParam($_POST'html'1);
  
  foreach(
$lists AS $list){
    
$row = new yancSubscriber$database );
       
// load the row from the db table
       
$row->subscriber_name $name;
       
$row->subscriber_email $email;
       
$row->receive_html $html;
       
$row->list_id $list;
      
$row->subscribe_date date"Y-m-d H:i:s" );
      
    
$row->store();
  }

}
  function 
confirmYancSubscriber($confirmCode){
  global 
$database$log;
  
      
//get the email of the user confirming
    
$query "SELECT * FROM #__comprofiler c JOIN #__users u ON c.id=u.id WHERE md5(c.id) = '" $confirmCode 

"'";
    
$database->setQuery($query);
    
$user $database->loadObjectList();
    
    if(
mysql_affected_rows() == 0){
        
//echo $lang->translate("noaccountfound");
    
}
    else{
        
//subscriber_id is different from user id, use email to match users in the two tables
          
$email $user[0]->email;

        
//set confirmed for all instances of this email in the yanc subscribers table
        
$query "UPDATE #__newsletter_subscribers SET confirmed = 1 WHERE subscriber_email = '" $email 

"'";
        
$database->setQuery($query);
        
$database->query();
    }  
}
  

?>
That's all. Enjoy.
__________________
Eric Santiago
http:\\www.ericsantiago.com
santier is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Old 05.02.2005, 15:14   #2 (permalink)
Junior Mamber
 
scubaguy's Avatar
 
Join Date: Oct 2004
Location: Milwaukee, WI
Posts: 31
scubaguy is on a distinguished road
Send a message via ICQ to scubaguy Send a message via AIM to scubaguy Send a message via Yahoo to scubaguy
Talking Re: Yanc and Community Builder integration

Eric, great hack!

I changed/added a couple of things that you might like....

- the name of the list with $list->list_name
- the ability to choose checked or unchecked by $list->id
- the ability exclude lists in the SELECT query based on list id number (ex. AND id != '4' )

You should be able to cut-n-paste this code right over this code section in Eric's code. Just change or add to make it fit your needs.


Code:
      foreach($lists AS $list){
								if ($list->id == 1) {
          echo '<p><input checked type="checkbox" name="list[]" value="' . $list->id . '" /> ' .$list->list_name . ' - ' .$list->list_desc . '</p>';

								} else {
          echo '<p><input type="checkbox" name="list[]" value="' . $list->id . '" /> ' .$list->list_name . ' - ' .$list->list_desc . '</p>';
      }
      }
      echo '<blockquote></td></tr>';
      echo '<tr><td>&nbsp;</td>
          <td><input checked type="checkbox" name="html" value="1" /><i>Receive emails in HTML format?</i></td>
        </tr>';
        echo '<tr><td colspan="2"><hr></td></tr>';
   }
  
}

function getLists(){
    global $database, $my;
    
    $query = "SELECT * FROM #__newsletter_letters WHERE hidden <= ". intval($my->gid) ." AND id != '4' ORDER BY list_name";
    $database->setQuery($query);
    $total = $database->loadObjectList();
    echo $database->getErrorMsg();

    return $total;                
}
scubaguy is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08.02.2005, 00:18   #3 (permalink)
Expert Mamber
 
Baal's Avatar
 
Join Date: May 2004
Location: California
Posts: 254
Baal is on a distinguished road
Default Re: Yanc and Community Builder integration

either of you guys know how to change the newsletter title so that you can include the [NAME] command - seems like Yank and Mamml only write it once, when I tried hacking it to use [NAME] it will put the first name in but uses that for all of them. Know any easy ways round this?
__________________
Wars only hurt those who die in them...

www.mediabox101.com
Baal is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 22.02.2005, 23:29   #4 (permalink)
Baby Mamber
 
Join Date: Aug 2004
Posts: 12
tobiaseigen is on a distinguished road
Default Re: Yanc and Community Builder integration

Hi -

Cool.

Does this also perchance add a tab to the CB profile page so registered users can manage their subscriptions later? Or can you only decide upon registration which newsletters you want to get, then unsubscribe later I guess via email or the YaNC component?

I gather this is not a real integration of CB and YaNC but simply adds the email address to the YaNC subscriber lists during registration if desired by the user.

Cheers,

Tobias
tobiaseigen is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 29.01.2006, 06:14   #5 (permalink)
Expert Mamber
 
BennieBlanco's Avatar
 
Join Date: Apr 2004
Posts: 464
BennieBlanco is on a distinguished road
Default Re: Yanc and Community Builder integration

the hack is great but the user need to confirm the subscription and this is not included in welcome email
how do we do this?
__________________
www.bluehost.com
BennieBlanco is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 18.02.2006, 19:11   #6 (permalink)
Senior Mamber
 
ehsabbi's Avatar
 
Join Date: Sep 2004
Posts: 131
ehsabbi is on a distinguished road
Default Re: Yanc and Community Builder integration

I´m using CB from Joomlapolis and it has a YANC Plugin. Can I use this Plugin or need to alter the code as described?
ehsabbi is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 18.05.2006, 06:26   #7 (permalink)
Baby Mamber
 
Join Date: May 2006
Posts: 1
flavarite is on a distinguished road
Default Re: Yanc and Community Builder integration

I was able to successfully install this hack. Thanks for the great work.

As questioned above from a previous post, how can we get the registration process to include the confirmation emails that are required for the user to confirm their subscription request? I tried this to see if it works under a test account and it subscribed me to both newsletters I selected during registration. However there is no way for the user to confirm to activate the subscription.

FYI - there is an plugin that integrates YANC and CB but I don't recall where I found it. I think it was on CB's home page at one time but I can't find where they are storing the plugins now.

I attached the last version I had if you want to use it. It basically will give the user the ability to see what newsletters they are suscribed to...probably would be neat to hack this plugin and have an option to "resend" the registration if it shows "not confirmed".
flavarite is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 26.06.2006, 11:15   #8 (permalink)
Baby Mamber
 
Join Date: Jun 2006
Location: Stockholm
Posts: 1
susanneaskesten is on a distinguished road
Send a message via ICQ to susanneaskesten
Default Re: Yanc and Community Builder integration

Hi

I'm trying to use this hack but cant fint following row in step 5

<tr>
<td colspan="2">&nbsp;</td>
</tr>


What do I do?

best regards

Susanne
susanneaskesten is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 21.11.2007, 16:51   #9 (permalink)
Baby Mamber
 
Join Date: Mar 2007
Posts: 2
chouxpastry2002 is on a distinguished road
Default Re: Yanc and Community Builder integration

me too wanted to say same thisng that even i cant find the same HTML code in html file of com profiler

I did added the function in the list but not able to see the list check box at the registration form.please help on this issue

regards,
Sam.
chouxpastry2002 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 21.11.2007, 17:25   #10 (permalink)
Baby Mamber
 
Join Date: Mar 2007
Posts: 2
chouxpastry2002 is on a distinguished road
Default Re: Yanc and Community Builder integration

it worked but it shows the news letters in the list I want it in the form.The user want to subscribe or not .The YES or NO select box accordingly the user will be subscribed to all news letters.
chouxpastry2002 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +2. The time now is 20:00.

Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0
A vBSkinworks Design
© Copyright 2004-2008 by Arthur Konze Webdesign.