Im looking for someone to help me install the Wysija newsletter form to the application form on the bottom of my page at http://www.thesocialmarketeers.org
Doug Montgomery answers:
Need more information. It appears that you have the widget.
Also, didn't go all the way to your site...got a wot warning.
Arnav Joy answers:
where would you like to show it ? can you provide a screenshot of it?
Arnav Joy comments:
paste this to functions.php of your theme
function processMyForm(){
//you could make some validation even though validation
//is also processed in our function
$myEmailVariable=$_POST['myEmailVariable'] ;
$myListId1=$_POST['myListId1'] ;
$myListId2=$_POST['myListId2'] ;
//in this array firstname and lastname are optional
$userData=array(
'email'=>$myEmailVariable,
'firstname'=>$firstname,
'lastname'=>$lastname);
$data=array(
'user'=>$userData,
'user_list'=>array('list_ids'=>array($myListId1,$myListId2))
);
$userHelper=&WYSIJA::get('user','helper');
$userHelper->addSubscriber($data);
//this function will add the subscriber to wysija
//if double optin is on it will send a confirmation email
//to the subscriber
//if double optin is off and you have an active automatic
//newsletter then it will send the automatic newsletter to the subscriber
}
//initialize this function only when your subscription form data has been posted
add_action('init','processMyForm') ;
and paste this where you want form to be visible:;;-
<?php $data=array('name','list_id'),array('is_enabled'=>1) ;
$modelList = &WYSIJA::get('list','model');
$wysijaLists = $modelList->get($data);
//this loop will just echo the information selected for each list
foreach($wysijaLists as $l ist){
echo 'list id : '.$list['list_id'].' , list name : '.$list['name'] ."<br/>";
}
?>
Inam Hassan answers:
Hi
create Application form using their standard method, preview that and at botton generate php version form there, copy that code and paste it in your footer.php file or anywhere you want, what is your footer file
I generated a test form for you and thats code is like
$widgetdata=array (
'widget_id' => '-php',
'lists' =>
array (
0 => '1',
),
'lists_name' =>
array (
1 => 'My first list',
),
'autoregister' => 'not_auto_register',
'labelswithin' => 'labels_within',
'submit' => 'Subscribe!',
'success' => 'Check your inbox now to confirm your subscription.',
'customfields' =>
array (
'firstname' =>
array (
'column_name' => 'firstname',
),
'lastname' =>
array (
'column_name' => 'lastname',
),
'email' =>
array (
'label' => 'Email',
),
),
);
$widgetNL=new WYSIJA_NL_Widget(1);
$subscriptionForm= $widgetNL->widget($widgetdata,$widgetdata);
echo $subscriptionForm;
Hope this helps