Customized FB Shares

I have a client that is wanting to be able to have the ability for users to be able to send a customized, pre-populated message to their friends on Facebook. I have a rough idea on how I would do it, but the last time I had a *brilliant* idea and asked for ideas on here, two or three people jumped on and shared a much easier, more efficient way of doing it. I making this too hard or is this a great idea?

My thought would be to create a page that would be a form for the user to fill out. It would have fields for the receiver's name, which message they would like to send, and a submit button. When they submitted it, it would take them to a page that would use the $_GET to pull down the name and the id of the custom post with the chosen message, then have a big arrow that points to the FB share button. At that point, they can share it with their friend on FB.

Custom posts would be used to create the different possible messages so that the client could easily create / delete them. On the page to customize the message, essentially it would just go through the loop and pull in all the titles, only instead of doing it in a long list, it would do it as either a select or radio buttons. When selected, using javascript it would pull up the content of the message so that they could see what the final message would look like. The name part would also be automatically updated. Then when it's submitted, it would take you to the second custom page with all of the data in the URL to define which custom message to pull up.

So that's my thought. Is there an easier way to do it? Or am I headed the right direction?

Thanks in advance for your help!

  • Imperative Ideas

    I think it's unlikely that you will find a WordPress ready solution for this. With that said, if you are comfortable with writing your own admins to integrate jQuery plugins, this might help:

    It's old code but no one is screaming that it's broken on GitHub so it my actually still function.

  • Chris G. Clapp

    If anyone wants to see how it's going, check out the page at

    The events listed are placeholders for the moment. One thing I'm having problems with is showing the content of the events dynamically. I tried loading the content into a javascript array / object but it has a problem with the hard returns. I tried json-encoding the info before putting it into the javascript variable but even then it has issues. When that didn't work, I tried a jQuery .load() but that gave me problems as well. Any thoughts?

    My workaround (that I'm not too excited about at the moment) is to pull in the custom post within an iframe, simply using jQuery to get the value of the event (which is the post ID) and then concatenate it into the URL for the iframe to pull in. I ended up creating a stripped down version of the header / footer for the template to pull in for those. How good / bad of an idea is all of this?

    The other part that seems to be giving me problems is the Facebook send / share button, which I'm attempting to put in there using the Ultimate Facebook plugin shortcode (using do_shortcode). Also, because I'm wanting it to be an invite, I'm working on how when the sender submits an invite, it posts the information as $_GET variables and then the same page actually displays the invitation, which the user would then click on a "Send" or "share" button that might come up as a modal (from twitter bootstrap).

    What I'm running into is how to make the modal show up when the sender sends the invite but not when the receiver opens the page. My initial thought is to possibly set a cookie when the button is pressed that could then be checked for. If the cookie is set, then the modal would pop up but if not, then it wouldn't. Maybe have a button on the modal to close that would also unset the cookie as well, not sure. Is there a better way to do this? Once again, I'm the type of person that tends to think I've come up with a great solution and then someone else comes along and says "have you tried this?" and their solution is WAY more simple and elegant than mine ever was.

    @aecnu So you're saying I might be on the right track? :slight_smile:

    @Imperative Ideas - I will check it out. I'm learning about doing admin pages and such; slowly getting better but not quite there yet. Thank for the heads up!

    Side note: When I signed up for WPMU, I thought that the plugins were going to be the biggest reason to use WPMU. While they have been truly invaluable, the thing that I've appreciated the most has by far been the support I've received on here. I don't have a lot of real-world people around me that know much about WordPress so I tend to be the expert around them. I have had so many questions answered and problems addressed, this is truly a great community! Thanks everyone and keep up the awesome work!

  • aecnu

    Greetings Chris,

    Thank you for the additional questions and though valid they are of course, they require and are in the realm of custom coding that is beyond the scope of the support we provide here though we do help if know the answer in any event.

    With that said, alternatively, you could see if there's a developer available at wpmu jobs who could get onto it right this minute

    Thank you for being a WPMU DEV Community Member!

    Cheers, Joe

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.