dimitrios

AutoFbPost

Recommended Posts

Hello,

I have created a module that, given a Facebook app ID and secret, posts on Facebook on behalf of a user profile or page after a PW page is saved.

This module is configurable as follows:

  • Templates: posts can take place only for pages with the defined templates
  • On/Off switch: specify a checkbox field that will not allow the post if checked
  • Specify a message and/or an image for the post

post-4087-0-60791400-1457660876_thumb.jp

Usage

edit the desired PW page and save; it will post right after the initial Facebook log in and permission granting. After that, a token is kept.

 
post-4087-0-78890000-1457661715_thumb.jp
 

Note: Facebook SDK for PHP is used.

post-4087-0-60791400-1457660876_thumb.jp

post-4087-0-78890000-1457661715_thumb.jp

Edited by dimitrios
updated module
  • Like 15

Share this post


Link to post
Share on other sites

Hello dimitrios,

Thank you for developing this! Could you also post it to the modules directory? Doing so makes it easier for people to locate and install your module.

Share this post


Link to post
Share on other sites

Hello netcarver,
 

you are absolutely right, I just updated my post. I have submitted the module and it is currently pending approval. Thank you!

  • Like 3

Share this post


Link to post
Share on other sites

I use PW3 and I always get this error message if I try to login in backend after uploading the module to the server:

post-2257-0-21694000-1458315891_thumb.jp

Is this module not compatible with the latest PW version?

Best regards Jürgen

Share this post


Link to post
Share on other sites

Removing the session_start() from the AutoFbPost.module at the beginning solves this problem

  • Like 2

Share this post


Link to post
Share on other sites

Hello Juergen,

I am sorry for such a late answer. You are right, this is not needed since PW manages the session.
I will try to test this module with various PW versions and update it. Thank you for your post!

  • Like 1

Share this post


Link to post
Share on other sites

Hi,

seems this is written for php 5.4... I'm not on that yet :-)

Would you consider making it < 5.4 compatible?

regards

Share this post


Link to post
Share on other sites

Hello,

I will consider it, although I am on a tight schedule lately. However, I'm not sure if it would be wise, because the old Facebook PHP SDK v3 is now deprecated, so there will be zero maintenance from their part.

Share this post


Link to post
Share on other sites

Hey,

First off, thanks for this great module.

I was just wondering where the On/off checkbox is meant to show as every time I save the page at the moment it gets posted to Facebook and I'd rather have it that you check that checkbox and it stops posting to facebook?

Thanks!

 

Share this post


Link to post
Share on other sites
42 minutes ago, alexmercenary said:

where the On/off checkbox is meant to show

You need to create a new checkbox field, give it a name like autofbpost and add the field to your template. Next configure the module: in the inputfield On/Off Checkbox, enter the name of the field you created.

 

Share this post


Link to post
Share on other sites

Hello,

thank you for your kind words @alexmercenary, I'm glad it was of use to you. @flydev, that is absolutely right, you need to create a checkbox field as with any other field or use an existing one and insert it into the template.

Share this post


Link to post
Share on other sites

cant seem to get it working with facebook. keeps giving me this error:

AutoFbPost: post failed; click here to log in with Facebook.

URL blocked: This redirect failed because the redirect URI is not white-listed in the app's client OAuth settings. Make sure that the client and web OAuth logins are on and add all your app domains as valid OAuth redirect URIs.

my settings: https://www.dropbox.com/s/y4ajeac4wwlyup4/Screenshot 2017-07-07 16.53.23.png?dl=0

and platform the website url.

any help would be appreciated

Share this post


Link to post
Share on other sites

This module seems not compatible with the latest Facebook policy. If you want to post something through a Facebook app, you need to apply for the permission. Otherwise, it ask for login every time just as your case.

Gideon

Share this post


Link to post
Share on other sites

Anyone noticing that the module isn't posting the images or description?

If so is there any fix or anything I am missing? 

Share this post


Link to post
Share on other sites

@videokid yeah I do have opengraph in the header but it isn't detecting the image field, it's just using the site logo as the post image and the default site description as the description. It's weird.

Share this post


Link to post
Share on other sites

I do: https://www.featherbow.co.uk/gallery/cherington-open-plan-kitchen/

By the way thanks for the help on this.

I'm using MarkupSEO which is auto detecting the image field as it turns out so I don't actually need to add anything into the AutoFbPost field for image field name etc. Although I have anyway. The default 'images' field.

Thank you for your time

Share this post


Link to post
Share on other sites

Well I don't see anything wrong....
But it is your default description indeed [MarkupSEO isn't picking up body/description field?].

Personally I'm not using MarkupSEO, I have everything in my _init.php configured and, so far at least, it is working....
It's a pretty old website, still running pw 2.7.1/2..... Haven't tried it on pw 3.x yet, but I guess this has nothing to with pw...

I had a strange experience once where FB wasn't picking up any opengraph whatsoever, and I actually had to create a facebook app id for that site, but so far I've encountered it only once.... that was very weird too.... 

Sorry I can't be more informative....

  • Like 1

Share this post


Link to post
Share on other sites

Weirdly it's working now... Or at least the image is loading the correct one.

I have just cleared the default meta description from the MarkupSEO module settings and added directly to the homepage and then used the body as the smart description so it is used for open graph description and meta description for all other pages and that isn't showing the correct description yet when being posted but perhaps Facebook caches the results for a while?
 

Either way you have been a BIG help and I can't thank you enough for taking the time to take a look with me!

Thank you @videokid

  • Like 1

Share this post


Link to post
Share on other sites

Hello,

this module has been updated and it is now compatible with Graph API version 2.10.

Parameters 'description' and 'name' are not supported by the new Graph API version. Therefore, fields for description and name cannot be provided anymore.

  • Like 4

Share this post


Link to post
Share on other sites

Hi,

I have problems to connect the module to FB app, I get the error mentioned by benbyf her above: AutoFbPost: post failed; click here to log in with Facebook. Then the error message says: "App not configured. This App is still in development mode and you can't access it"...

Is there anything else I need to set in facebook? I've tried all possible configuration and I don't know where to check now. Screenshot attached. Thanks a lot for any help.

 

fb.png

fb1.png

fb2.png

fb3.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By kixe
      Email Verification
      This module provides functions to validate email adresses and hosts. The module generates a textfile for blacklisted mailhosts (trashmail), which will be always up to date.
      Download
      https://modules.processwire.com/modules/email-verification/
      API
      // get module $mailcheck = $modules->get('EmailVerification'); // return bool/ string - automatted update of blacklist file $mailcheck->blacklisted(email|domain) // return bool - validate a top level domain, checks against IANA list $mailcheck->validTLD(tld) // return array of punycoded TLDs - cyclic updated, data pulled from IANA $mailcheck->getTLDs(cycle=2592000) // return bool - checks syntax converts to punycode $mailcheck->validDomainName(domain); // return bool - checks punycode encoded syntax $mailcheck->validHostName(host); // return bool - checks syntax and accessibility $mailcheck->validHost(email|domain) // add a single value to blacklist $mailcheck->addToBlacklist(email|domain) USAGE
      $mailcheck = $modules->get('EmailCheck'); $email = 'susi@trashmail.com'; if($mailcheck->blacklisted($email)) echo 'Email Provider not allowed'; if(!$mailcheck->validHost($email)) echo 'Mailhost not available'; Example blacklist file:  blacklist.txt
       
    • By teppo
      Code Blocks Textformatter is a tiny Textformatter module I cooked up to add support for code blocks to text/textarea/RTE fields on some of the sites I work with. Unlike a full-blown Markdown Textformatter – which is something that we already have in the core – this module simply adds support for fenced and inline code blocks.
      The syntax is based on the GitHub code block documentation, so please refer to that for additional instructions. The README at GitHub also includes some basic examples. As with any Textformatter, in order to enable this one, install it and enable it via field settings. Note that there's no syntax highlighting built in (at least for the time being), so use a tool of your choice for that – personally I prefer Prism.js.
      Since this module doesn't use a Markdown tool behind the scenes, but rather some home baked regular expressions, there's always the possibility that I've missed something – but please let me know if you use this module and run into any issues. On the other hand this module should be relatively fast and unobtrusive, as there are no unnecessary bits of code to run 
      GitHub repository: https://github.com/teppokoivula/TextformatterCodeBlocks Modules directory: http://modules.processwire.com/modules/textformatter-code-blocks/
    • By theo
      Here is my first processwire module (beta).
      https://github.com/theo222/ImagePickerField
      A lot of "first times". First time Github, Markdown and of course PW Modules.
      So be gentle please.
      I hope it works.

    • By horst
      Image Animated GIF  v 2.0.2
       
      Module for PW 2.5 stable or newer, but is obsolete for PW Versions greater then 3.0.89 (... read more ...)
       
      This module helps with resizing and cropping of animated GIFs when using the GD-Library.
      The GD-Library does not support this.


      This module is completely based upon the fantastic work of

         László Zsidi (http://www.gifs.hu/, builts the initial classes)
         xurei (https://github.com/xurei/GIFDecoder_optimized, enhanced the classes)


      I have ported it to a PW module and it works with core imagefields, together with Pia and with CropImagefields that uses the new naming scheme since PW 2.5.
       
      ------------------------------------------------------------------------------------------------------------------------------------------
      read more in this post about the rewrite from version 1.0.0 to version 2.0.0
      ------------------------------------------------------------------------------------------------------------------------------------------
      You can find it in the modules directory: https://modules.processwire.com/modules/image-animated-gif/
      and on Github: https://github.com/horst-n/ImageAnimatedGif
      ------
      A preview can be found here