Welcome to the archive of the old FlatPress support forum. Browse more than a decade of FlatPress wisdom! Login is disabled.

The current FlatPress support forum is available here: forum.flatpress.org
Update blog entry programmatically?
  • Hello I need to build a MeetUp-like site where the blog part would actually be events to which registered members of the site can sign up AND the forum would be the place where they can talk. Obviously, they should only have to create an account once. 1. Does FlatPress support single sign-on, so that users can eg. post comments in blog entries AND post in the forum? 2. If not, as a work-around, I could add some code from PunBB in the template of the blog to include a login form which would call a PHP script. In that case: Does FlatPress support updating a blog entry through code, so that the PHP script can add/remove the user from an event, and update the entry? Thank you.
  • FP can update entries programmatically through the entry_save() API; anyway, FP *does not* support concurrent writes, so on a high-traffic site you would probably face soon issues with the index of your posts; in your case I'd rather suggest WordPress Multiuser + BBPress for instance
  • Thanks for the tip. I tried WP + bbPress, but couldn't get the two to work together. I'll see if I can manage something with a flat file-based tool like FP.
  • Posted By: littlebigman1. Does FlatPress support single sign-on, so that users can eg. post comments in blog entries AND post in the forum?

    You do mean THIS forum, and not one which you host yourself? I think the single sign-on feature was only introduced in Vanilla 2 and it wouldn't be possible if you're talking about this forum, because Vanilla (2) would need to go looking for a special page on every FP user's blog, providing they'd implemented some sort of membership system. There's nothing like that built into FlatPress, but you can add one and use that to give people permission to post comments on your blog AND have a single sign on to a Vanilla 2 forum which you host yourself. To a limited extent you can also allow your users access to a form where they can make posts but, as NWM has pointed out (here, and on many other occasions) FP is only designed for a single user to create posts. In my case I had a low volume of users wanting to make posts, and I wanted to moderate them all instead of simply allowing anyone to publish stuff directly to the blog, so I created a form based on contact.php but with a bit of code which created a new draft posting. Basically it just acts like a normal contact form and sends you a message but it also creates a text file in the drafts folder which I then go in via the admin panel and edit/publish/delete as I see fit. That method works just fine for me but it might not be suitable for what you want to do. If you (or anyone) does go that route you need to be careful of two things: 1) NEVER delete the last entry out of your drafts folder because FP will delete the drafts folder too, and then your special member's submit form probably won't work. I always create a dummy draft entry and leave it in drafts to keep the folder "alive", and 2) you need to stick to the same file naming convention which FP inherited which means that all posts end with yymmdd-hhmmss. Obviously this method introduces the risk of two people posting at the same time and they might try posting with the same file name, and the second post will win! You'd need to add some code to check whether the file exists and increment the last digit. I was too lazy to do that.
This discussion has been closed.
All Discussions
Start a New Discussion

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion