jnews add subs

prophoto

Active Member
I need to create a form that allows the user to submit a few fields. Their info should also be added to jnews for subscription to the email newsletter. What is the best way in fabrik to accomplish this? Should I set it up with a remote db or submit it via php?

Most likely jnews does not support all the data I want to save, so can I also save the record to multiple dbs or db tables? For example I doubt a 'message' field used in a normal contact form would work in jnews but I want to store that in a table somewhere. Both sites will be on the same server and db server if that makes a difference. Secondary site is a microsite with squeeze pages for PPC ads.
 
jnews says no go on any fields except for text, now I just need to find docs on how to submit fields to jnews.
 
I've never looked at jnews, I'll have to install it, and see if they have any API docs, or if there is any "official" way of adding items rather than just directly accessing the database.

Did you ever find any docs?

-- hugh
 
Have you actually tested this? Does the user need to be logged in, for the list addition to work?

You can't control automatically redirect back from that link to your page. If you redirect, what happens when they land on that page is entirely up to jnews.

If the user doesn't have to be logged in, you could do it with a form submission script, using a CURL call.

So I need you to test, and see if you can add a user to a list without being logged on to J!, by just providing the id's, etc on that URL.

-- hugh
 
OK ... assuming the user is logged in when they submit your Fabrik form, a PHP form submission script, running onAfterProcess, which does this:

PHP:
$user = JFactory::getUser();
$url = COM_FABRIK_LIVESITE . 'index.php?option=com_jnews&act=urlsubscribe&userid=' . $user->get('id'). '&listid=LISTID&receive_html=1&passwordA=lnOkgyNV26gm6ux';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$return = curl_exec ($ch);
curl_close ($ch);

If the form is submitted by guests, who specify their name and email in the form, you'd have to do this:

PHP:
$name = $formModel->getElementData('yourtable___name');
$email = $formModel->getElementData('yourtable___email');
$url = COM_FABRIK_LIVESITE . 'index.php?option=com_jnews&act=urlsubscribe&name=' . $name . '&email=' . $email . 'listid=LISTID&receive_html=1&passwordA=lnOkgyNV26gm6ux';

... replacing the element names for name and email with your full element names. The rest (from curl_init() onwards) will be the same as the previous example.

In either case, replace LISTID and the password with the relevant jnews values you need.

If it doesn't work, put this:

PHP:
var_dump($result);exit;

.. as the last line of the code, submit the form again, you'll get some debug output, copy and paste that here.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top