WordPress Ver. 1.5/2.0 - MMS Dropin Ver. 0.43
Update: Latest version is now available HERE
This version has been tested with both Wordpress version 1.5 and 2.0
Many thanks to Jon Watson over at http://www.jonwatson.ca/ for his considerable effort in helping me to debug problems associated with using this dropin on systems where “safe mode” is enabled. This was apparently causing several folks to not get the 100% received message back to their cellphone after posting.
This version uses the file mmsdecoder.php instead of the mmslib.php used in earlier versions. So make sure you copy it from the zip to your WordPress root directory. See the readme files for more info.
This version allows a file to be created on your server which can be used in liew of actually sending MMS messages while testing the setup. This is accomplished by editing flags in the wp-mms.php source as outlined in the comments.
Security is accomplished by requiring the user to register using their cell # as their login in WordPress. Each incoming MMS message is checked to see if it’s phone number has already been registered as a login. Remember that their nickname is published on the blog. It is a good idea to use a different nickname for the account so their cellphone number is not out there for all to see. They will have to do this using a browser and go through the normal email verification process to create the account.
If you turn this option off then anyone can post. (not a great idea) Version 0.1 allowed this so beware!!! Carriers often use country code in front of the cell phone number and in some countries the numbers are not 10 digits I suspect. I recently found that Verizon sometimes adds a 1 in front of the 10 digit number and at other times does not add the 1. In this version number of digits of the cellphone number used is a user variable (default 10). This should be your cell number with area code. Read the notes for info on determining the number your cellphone actually sends in the from field.
The wordpress security is then checked against the incoming MMS cellphone # and will only allow registered users with a high enough user level to post via MMS just like with regular posts.
An option to select thumbnail size for both max width and max height is easily changed in the user options. (default is 400X300) Thumbnailing is accomplished using php only and does not require installing Image Majic or the like.
The subject of the incoming MMS is parsed and attempts to locate a category to place the post in. A subject line like (Photos) Me Skydiving would search WordPress to see if a category called Photos exists and if so the post will be placed in it otherwise it goes to the WordPress default category. The (Photos) gets stripped off the subject and the remainder Me Skydiving becomes the post title. Also works for numeric category entry like (3). If no category is entered then the default general category is used. If the subject is left blank then the post title is set to the default “MMS Post”.
Any text accompaning the photo is placed below the photo thumbnail in the post. If an audio file was also attached a link to it is also placed in the text area below the photo.
An example of an MMS post is HERE
If you do a search here on my blog for “MMS Post” you will find that I have sucessfuly uploaded not only pics but audio files and even short movie file via MMS.
I found imbeding audio and video files caused page load times to be excessive. A link to them is placed in the post instead.
[…]
« Javascript for WP-MMS Dropin
WordPress MMS Dropin Ver. 0.37 »
WordPress MMS Dropin Ver. 0.36
Update: Latest v […]
Pingback by Grin ‘N Bare It » Blog Archive » WordPress MMS Dropin Ver. 0.36 — 12/29/2005 @ 6:02 pm
Hi,
I am trying to setup the MMS Dropin on my website with WordPress using the Kiwi skin (used to use Humpa’s server). When I tried it on other skins, it worked amazingly well– Great dropin!
Anyway, whenever a post is made in WordPress using the Kiwi skin, a custom field with the key “prepic” is placed into the metadata of the post. The value of the key is the location of a banner (such as “/wp-content/themes/kiwi/metapics/banner.jpg”) that shows up at the top of the post.
When I make a post on WordPress using your dropin, the entry is made, but obviously no custom fields are inserted as they would be if I was using the normal WordPress publishing method. This means that whenever I upload a picture, I simply get a dead, improperly sized banner and it messes up the format of the front page of the blog.
Do you know what kind of a code change I could make to the wp-mms.php file that would add the “prepic” custom field to my posts? I am not very good with PHP, but I assume it wouldn’t be much different than the way the dropin currently assigns the topic and other information…
Thanks for any help!
Comment by KevIncognito — 1/2/2006 @ 6:02 am
Also, I realized I may not have been very clear… I would not be looking for any sort of a dynamically updating custom field or anything. All I am trying to do is get the dropin to assign the same static value of “/wp-content/themes/kiwi/metapics/banner.jpg” to the “prepic” key every time a post is made.
Thanks again.
Comment by KevIncognito — 1/2/2006 @ 6:06 am
Kevincognito,
I am not sure exactly where in the post this “prepic” tag is placed. I tried to look at your site to see if I could get a hint but it was unreachable. I also went to http://no.oneslistening.com but it did not respond. So the best I can do at this point is give you a guess.
At line 277 you should find the following statement:
if ($photo_tag != “”) { $content = $content . $photo_tag . “<br\n>”; }
If you replace this line with the following:
if ($photo_tag != “”) {
$content = ‘/wp-content/themes/kiwi/metapics/banner.jpg’ . $content . ‘<br\n>’;
$content = $content . $photo_tag . “<br\n>’”; }
That would make the banner.jpg the very first thing in the post content. If that doesn’t do what you need and you have a test site I can look at I may be able to help you more.
Comment by Otis Riggins — 1/2/2006 @ 10:17 am
Otis,
I think you may be on to something in those areas of the code, but I am not sure exactly how to format this properly… I don’t think the information is actually stored in the post itself, but in the post’s metadata under the tag “prepic,” (which was created for Kiwi).
I am trying to figure out where in your code it actually writes the subject line and other data… because I think it may be as simple as adding another tag to write back to the server called “prepic.”
Whenever no.oneslistening.com comes back up, http://no.oneslistening.com/?p=125 explains the prepic value and what I am trying to get your dropin to add automatically.
To give you a better understanding of what is happening, If you go into the “Write Post” page on WordPress, down at the very bottom, there are some options. Right under the “Trackbacks” option, there is an option labeled “Custom Fields.” If you expand that, you can add in an additional key to the post. If I were to manually write “prepic” in the “Key” field, and then the path to my banner in the “Value” field, it fills in the proper banner for my post.
What I am trying to do is setup your dropin so that every time I send a moblog post, it will pass these custom values to the server along with all the other data about the post.
I have setup two posts, one directly from the phone with no alterations– and one from the phone that I then went into the WordPress administration panel and manually added the custom value to.
Fixed post: http://blog.somethingcryptic.com/?p=35
Direct upload: http://blog.somethingcryptic.com/?p=36
Thanks again.
Comment by KevIncognito — 1/2/2006 @ 2:56 pm
Hi Kevincognito,
Ok if a field has already been created with the fieldname “prepic” and you want the value “/wp-content/themes/kiwi/metapics/banner.jpg” inserted into that field for every post then try the following:
Begining at line 292 you should find the following:
$details = array(
‘post_author’ => $mms_uid,
‘post_date’ => $post_date,
‘post_date_gmt’ => $post_date_gmt,
‘post_content’ => $content,
‘post_title’ => $subject,
‘post_modified’ => $post_date,
‘post_modified_gmt’ => $post_date_gmt,
‘ping_status’ => $ping_status,
‘post_name’ => $subject
);
The above array contains the fieldname and value pairs so make it like the following by adding the pair you wish to add:
$details = array(
‘post_author’ => $mms_uid,
‘post_date’ => $post_date,
‘post_date_gmt’ => $post_date_gmt,
‘post_content’ => $content,
‘post_title’ => $subject,
‘post_modified’ => $post_date,
‘post_modified_gmt’ => $post_date_gmt,
‘ping_status’ => $ping_status,
‘post_name’ => $subject,
‘prepic’ => ‘/wp-content/themes/kiwi/metapics/banner.jpg’
);
Actually after looking at the two examples I think you need to leave off the first / and make it just
‘prepic’ => ‘wp-content/themes/kiwi/metapics/banner.jpg’
That will add it for every MMS post do you just need it when there is a photo post as opposed to a text only or say video message? Also is the real role of the prepic to contain an actual thumbnail of the photo in the MMS message. If so a little more code would be needed.
Comment by Otis Riggins — 1/2/2006 @ 5:05 pm
The role of the prepic is generally to have a little preview for an article. In my use of it, I am simply going to have a generic banner that pops up for any post that comes from an MMS message.
I find what is happening very strage… I was originally trying to do almost exactly what you wrote back, but it was never working quite right. I do believe that what you wrote is exactly what I am trying to do, however when I make those changes, it seems to break the script– my phone says that the send was successful, yet nothing ever gets posted.
Actually, it looks like the script saves the pictures to the wp-photos directory, but it never makes the post. If I remove that line, it starts posting again.
Comment by KevIncognito — 1/2/2006 @ 6:02 pm
Looks like I was taking the wrong approach at this… I found a guide on the advanced usage of Custom Fields, and it looks like 4 values actually have to be written to make this work. (write “postpic” to the value sql field “meta_key,” and the location of the banner to the sql field “meta_value.” Additionally, the values are getting written to wp_postmeta in SQL, not to wp_posts as I originally thought.
I guess this would require doing the same thing as it does right now for a basic post, but a second time dedicated to posting these values into a seperate sql array?
http://codex.wordpress.org/Using_Custom_Fields#Advanced_Techniques_for_Custom_Fields
Does this make sense to you? I think I have the concept down now, but I just don’t know how the code would be setup to post that properly…
Comment by KevIncognito — 1/3/2006 @ 2:31 am
Hi Kevin,
Yes after some study of the way meta data is handled in WordPress I agree you are on the right track. It will require a second sql insert to the wp_postmeta table to insert the metadata. I am still unable to access the http://no.oneslistening.com site and I don’t have the Kiwi Theme here so I can’t test; but I emailed you some code to try to accomplish this. Let me know if it works and I’ll post it here.
Comment by Otis Riggins — 1/3/2006 @ 4:52 am
Hi Kevin,
I have been trying to send you a patched version of wp-mms.php for use with the kiwi theme; however I keep gettign bounce messages from my emails. I placed a copy here on the server so you can download HERE
Good Luck!
Comment by Otis — 1/5/2006 @ 10:30 am
Hi Otis,
I downloaded the file but unfortunately it looks like I wont be able to do anything with it for a few days. My mail wasn’t coming in this morning so I went to check on my website and the hosting company has since taken the whole server down for repairs and EV1Servers is having trouble getting CPanel back on the thing…
I’ll let you know how it worked as soon as they get my account back up!
Thanks again!
–Kevin
Comment by KevIncognito — 1/5/2006 @ 11:06 am
Hi Kevin,
Glad to hear the patches worked for you. Perhaps there will be others who need the code for use with the Kiwi Theme also. I’ll keep it here and make it available to anyone who needs it. If they contact me I can describe how you used it and see if they need something different.
I peeked at your site and it is looking real nice. Oh and thanks for the plug!
Comment by Otis Riggins — 1/8/2006 @ 12:59 pm
Hello…
I’m really looking forward to getting this running. Posting from my V710 straight to my blog is a cool idea.
I’m having trouble getting it running, however. When I send a photo, the image file itself shows up in the wp-photos dir and an entry is indeed made and posted.
The problem is that the image isn’t put into the post (although the subject works) and my phone gets to 95% and tells me that the pic can’t be sent.
Is there anywhere I can look for debugging info?
Thanks!
Jon
Comment by Jon — 1/8/2006 @ 11:21 pm
Hi Jon,
Sorry your having some problems! First can you tell me if you changed and of the USER VARIABLES settings? Especially if you have the $USE_JAVA flag set True and have not loaded the javascript to your theme header’s header section.
Please copy and paste the USER VARIABLES settings section (lines 120-137)as they are from wp-mms.php into an email to me?
You say the photo is getting placed in the wp-photos dir but is there a tn_ or thumbnail file being created in the same dir?
Can you email me the URL to your wp-mms.php?
In the USER VARIABLES section:
1) please set the $SAVE_MESSAGE flag to true.
2) then send a pic to the server (note and let me know if you get the 100% completed message on your cellphone)
3) go look in the wp-photos dir for the raw_mms.txt file which should have been created and email it to me.
4) now go back to the USER VARIABLES area and set the $SAVE_MESSAGE flag back to False and set the $SIM_INPUT flag to True
5) Now point your regular browser to the URL of your wp-mms.php (this should post the pic you sent earlier to your blog.)
6) Copy and paste the browser output into and email to me.
Otis
Comment by Otis Riggins — 1/9/2006 @ 6:00 am
Heya!
Actually, with your newwest version (at the top of this page), the photos don’t even show up in the wp-photos folder anymore.
TO answer your question, there was no thumbnail files, no, and there’s also no raw_mms.php file anywhere to be found.
I have tried steps 4 and 5 before and I just get a blank browser screen. I suspect there’s some sort of PHP error, but my host has error reporting turned off, so I always have to guess at this stuff.
Shoud I go back to the older version that had the pics showing up at least or can we trouble shoot this problem?
Thanks!
J
Comment by Jon — 1/9/2006 @ 8:24 am
Hi Jon,
Ok sounds like some sort of php error did occur.
I actually just posted version 0.39 above a couple of minutes ago. Download and give that a shot. You just need to copy over the new wp-mms.php file.
If you still have problems with the pics and thumbnails getting to the directory let me know and I’ll email you a raw_mms.txt file to test with.
Also please send me the URL to your wp-mms.php! I may be able to spot a problem from here.
Otis
Comment by Otis Riggins — 1/9/2006 @ 9:44 am
Hi Otis,
Do comments go into moderation? I can’t remember and now I can’t remember if I posted my response to you or not. Here it is again just in case:
My wp-mms.php uri is: http://www.jonwatson.ca/blog/wordpress/wp-mms.php and the blog itself is at…well…remove the /wp-mms.php. I guess you could have figured that out.
The new version seems to work better. The image file shows up in the wp-photos directory and the blog post is made. In fact, I did some poking around and I think the only thing that’s not working is the thumbnail part. Since the post tries to display the thumbmail, said post comes up with title and text, but no pic.
Oh, and my phone still pukes at 95%, but I imagine that’s because of a lack of positive response from my server because the thumbnailing fails, no?
I h ave Humpa’s PIX server running on my box and it makes thumbnails, so I know I have whatever is required, but I don’t know what that is.
Here’s my user vars, even though I don’t think I changed them from the defaults:
//USER VARIABLES
$USE_JAVA = False; // This flag set true is used by me personally to allow popup window and centering of pics
$SAVE_MESSAGE = False; //Use this set true to save a copy of the MMS message to a file
$SIM_INPUT = False; // Set this true to have input come from the recorded message file
$DEFAULT_TITLE = ‘Testing MMS Post - Please Ignore!’; //if you don’t want to add a subject in the email then you assign a default
$THUMBNAILS = True; // Use thumbnails?
$OPENSITE = False; // Be careful if you set this true then anyone can post to your blog bypassing WordPress security.
if ($SIM_INPUT){ $OPENSITE = True; } // Force opensite so that cell number can be displayed
$CELL_DIGITS = 10; // The number of digits of the cell number to use for user account in WordPress
$TN_MAXHEIGHT = 300; // maximum height - Photo maximum thumbnail size for Width & Height
$TN_MAXWIDTH = 400; // maximum width
$VID_WIDTH = 175; //175 for V710 3g2 vids
$VID_HEIGHT = 160; //160 for V710 3g2 vids
$VID_WIDTH = $VID_WIDTH - 20; //Adjust for java display routine offset
$VID_HEIGHT = $VID_HEIGHT - 25; //Adjust for java display routine offset
$AUDIO_WIDTH = 300;// Width of Audio Player Bar
$KIWI_META = ‘’; //’wp-content/themes/kiwi/metapics/banner.jpg’; //This allows folks using the KiWi Theme to insert alink to their banner pic
//END OF USER VARIABLES
Thanks for your help on this. I’m REALLY looking forward to posting right off my phone into my blog. That’s way cool
J
Comment by Jon — 1/9/2006 @ 3:34 pm
Hi Jon,
I was glad to hear from you that the changes to work around servers who have “safe mode” appear to work Ok! I have posted the modified version above now as 0.40
Enjoy!
Otis
Comment by Otis Riggins — 1/9/2006 @ 6:29 pm
Thanks for all your work. For the record, so everyone else knows, Otis reworked a bunch of code for me and really worked hard to get this thing working for me. I really appreciate all the hard work!
Jon
Comment by Jon — 1/9/2006 @ 6:47 pm
[…] I got the code from Otis over at Grin N’ Bear It!, but it didn’t work quite right for me right off the bat. I left a comment for Otis thinking that he may or may not get back to me, and turned my thoughts to hacking Humpa’s code to let me post right into Wordpress. […]
Pingback by Jon Watson's Tales from the Motherboard - Blogger. Podcaster. Internet Jedi. — 1/9/2006 @ 11:27 pm
[…] Full instructions and downloads are here. […]
Pingback by Blogger Idol :: There is only one blogosphere — 1/27/2006 @ 10:12 am
WP-MMS is now a WordPress 2.0 Plugin. For more info and download please see http://gnbi.com/wp-mms/
Comment by Otis Riggins — 2/22/2006 @ 11:23 pm
Hi there!
I still don’t get to which number should I send the mms
(using Vodafone Spain)
Thanks!
Comment by Alejandro — 12/29/2006 @ 12:05 am