How do I extract specific information/ fields from my moblog email?
Posted: 20 July 2008 11:14 PM   [ Ignore ]  
Summer Student
Total Posts:  20
Joined  07-09-2008

I am new to moblog.
I am trying to set up a travel blog that I can send an email to which contains 3 different fields.  For example: Travel_date, Travel_location and Body.

I would like this information to get added to the blog in the proper field.  I am adding this line to my email: {field:travel_date}July 10{/field:travel_date} - assuming this is the syntax for adding information to a specific field.

When the blog is posted this information is posted as text instead of being entered in the proper field. 

Could someone explain how I can extract specific informaion from my email and have it posted to the proper location in my weblog?

Thanks for the help.

Profile
 
 
Posted: 08 August 2008 11:41 PM   [ Ignore ]   [ # 1 ]  
Summer Student
Total Posts:  21
Joined  07-01-2008

Summary:
  -AIM: Get Moblog to parse emails properly, grabbing several custom fields, and putting them in the appropriate weblog fields.
  -PROBLEM: Moblog only seems to see the entry title, and one of the fields.

Yackbladder: first things first - sorry that you probably got a notification about this post, clicked the link excitedly, and noticed that it doesn’t answer your questions (it just poses it again, with more crap in it this time raspberry)! I thought maybe with more info, someone could solve both our problems.


I’m having a similar problem: I have four custom fields in my weblog, and have set up the fields in FreeForm, to email them to a moblog address in hopes of the data being entered into the weblog via the moblog email (all because the SAEF wasn’t validating well enough on the server-side wink).

Anyway, initially it was getting the main custom field (‘offense’), but leaving a bunch of the {field… codes at the end. What should have been displayed as the text of the offense field instead looked like this (Yackbladder - yours was the same, I’m guessing):

This is the example text for the submitted offense field
{field:witnessemail format=“none”}{email}{/field:witnessemail}

{entry_title}{title}{/entry_title}

{field:offensesite format=“none”}{offensesite}{/field:offensesite}


{field:offense format=“none”}{offense}{/field:offense}

It wasn’t collecting any fields other than ‘offense’ (but it did work with {entry_title}). I stopped this appended code finally, by changing the default moblog field to “none” (it had been set as ‘offense’).

At this point, it collects the ‘offense’ field correctly (without the field codes below—hooray!) and it gets the entry title properly, but it leaves the other fields blank.

Since the email is sent with FreeForm and requires authorization, the emails are set up to look like this:

AUTH:my_username:my_password

{field:witnessemail format=“none”}{email}{/field:witnessemail}

{entry_title}{title}{/entry_title}

{field:offensesite format=“none”}{offensesite}{/field:offensesite}

{field:offense format=“xhtml”}{offense}{/field:offense}

And the problem doesn’t seem to be on the FreeForm end, because the emails come through as expected like this:

AUTH:PSNP:fakepw

{field:witnessemail format=“none”}admin@psnp.com{/field:witnessemail}

{entry_title}This is my title{/entry_title}

{field:offensesite format=“none”}This is the location.{/field:offensesite}

{field:offense format=“xhtml”}This is what happened: ... .{/field:offense}

So at this point, the question is, how can I get moblog to stop ignoring the other fields??

I hope this post was clear, despite its long-windedness. Thanks to anyone who can help (or anyone who bothers reading)!

Profile
 
 
Posted: 13 August 2008 10:09 PM   [ Ignore ]   [ # 2 ]  
Summer Student
Total Posts:  21
Joined  07-01-2008

I figured it out (i.e., putting data from a FreeForm web form into a weblog—no photos/files, sorry!—with custom fields parsed properly). So for anyone who’s wondering, here’s how I did it. (I’m not paid by EllisLabs, so this ‘tutorial’ might be a bit light).

You’ve got your custom fields (mine are witness, witnessemail, offensesite, and thatoffends). ALL OF THESE FIELDS have to be set as textareas (in “Field Type” under CP > Weblog Admin > Custom Fields > Field Groups)see here for documented proof; it’s in a red box! The good news is, FreeForm can display text inputs to the user to get the data.

So this is my moblog template. It requires authorization; hence the first line. Also (as a newbie this confused me), the FreeForm email template has to be different: IN THE MOBLOG TEMPLATE, the data is represented by “{text}” between the field tags. Not so in the other template.

AUTH:{username}:{password}

{field
:witness format="none"}{text}{/field:witnessemail}

{field
:witnessemail format="none"}{text}{/field:witnessemail}

{entry_title}{title}{
/entry_title}

{field
:offensesite format="none"}{text}{/field:offensesite}

{field
:thatoffends format="xhtml"}{text}{/field:thatoffends}


Now, if you’ve installed FreeForm from Solspace, you can set up an email template (CP Home > Modules > Freeform > Manage Templates). Whereas the previous template tells EE how to interpret the email to the moblog address, this template tells the form how to send data in a way that EE can interpret. My FreeForm template looks like this:

AUTH:{username}:{password}

{field
:witness format="none"}{author}{/field:witness}

{field
:witnessemail format="none"}{email}{/field:witnessemail}

{entry_title}{title}{
/entry_title}

{field
:offensesite format="none"}{offensesite}{/field:offensesite}

{field
:thatoffends format="xhtml"}{body}{/field:thatoffends}

NB: it looks similar to the other, but it’s different. The field tags are identical, but between them, it no longer says {text}. Instead, it says {author}, {email}, {body}. It doesn’t really matter what these say. These are the names of the FreeForm form fields.

My FreeForm form looks like this:

<!-- form_name corresponds to my FreeForm settings, required forces users to fill in all (and check the
checkbox
-- incidentally forcing the user to check the box was the reason I started on this moblog quest
in the first place
), template refers to the FreeForm template I showed above -->

{exp:freeform:form form_name="tom_moblog" required="password|title|offensesite|body|agreeToTerms"
notify="my_moblog_address@my_domain.com" template="tom_mob_template" form_id="tom_form"}


<!-- These are hidden, but EE fills in their values -->
<
input type="hidden" name="author" value="{screen_name}" size="25" />
<
input type="hidden" name="email" value="{email}" size="25" />

<!--
Unfortunately, you need to get the user to re-enter his/her pw, which is a pain for him/her,
and
it may lead to questions about who can see his/her pw -->
<
p class="small">* Please confirm your PSNP password<br />
<
input type="password" name="password" class="required" size="25" />
<
input type="hidden" name="username" value="{username}" /></p>

<!--
NOTE that the name="..." tag corresponds to WHAT GOES BETWEEN THE FIELD TAGS in the FreeForm email
template
. name="author" because '{field:witness format="none"}{author}{/field:witness}', and name="email"
(NOT name="witnessemail") because '{field:witnessemail format="none"}{email}{/field:witnessemail}' -->
<
p class="small">* Short descriptor<br />
<
input type="text" name="title" class="required" value="" maxlength="128" class="input" size="25" /></p>

<
p class="small">* Site of offense<br />
<
input type="text" name="offensesite" value="" maxlength="128" class="required" size="25" /></p>

<
p class="small">* Offense<br />
<
textarea name="body" cols="23" rows="3" class="required" tabindex="4"></textarea></p>
        

<
p class="small"><input type="checkbox" name="agreeToTerms" value="agreeToTerms" class="required" tabindex="6" />
I agree to the <a href="{path=">Terms and Conditions</a> of the site.</p>

<
p class="small"><input type="submit" name="submit" class="submit" value="Submit" tabindex="7" />

{/exp:freeform:form}

All the visible form elements have class=“required” because I use javascript to validate the form fields’ contents, using this nifty tool (and advice for implementing it in EE here)—the styling can still be accomplished with id=”“, and without this js there’s no need for class=“required” or for the form_id parameter in the FreeForm tag. It is not necessary for the moblog/FreeForm integration.

There you have it. User enters data into FreeForm. FreeForm formats it and emails it to my moblog address. EE checks the moblog address for emails with the username and password at the top, and parses the form data into the correct custom fields.

Magic! Tedious, time-consuming magic! Hopefully it’ll be less tedious for you readers.

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1743, on December 02, 2009 03:47 PM
Total Registered Members: 120505 Total Logged-in Users: 58
Total Topics: 126573 Total Anonymous Users: 36
Total Replies: 665456 Total Guests: 338
Total Posts: 792029    
Members ( View Memberlist )