ℹ️
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
Private Team Blog
  • I've got an FP team blog running for about 6 people. I ran the setup 6 times when I first installed it and gave everyone a username & password. This seems to work fine. I then set the home page to a one line static saying that this is a private area so please login, and wrapped the widgets in an "if ($user = user_loggedin())" condition, to only show these items in the navigation bar if the user is logged in, so all people see (if they're not logged in) is a "login" link. Obviously we all have the same permissions but I made sure that the users follow certain rules about not editing other people's posts, and all seems to work fine (very good, in fact - it's turning into a great team working tool). My question is how to use the same "if ($user = user_loggedin())" condition to stop people from simply pasting an entry url in and seeing a blog post. I was looking at the functions in index.php but I started to get a bit lost. Can anyone give me a clue where I should be trying to paste this condition in, to stop people from seeing either an individual post using the ?x=entry string or the main blog page using the ?paged=n string. I noticed that private posts have been mentioned, but I couldn't see where anyone had actually tried to do it.
  • index.php handles paging and "entry" URLs you can in fact remove this part as a whole from in index_main() : if (!empty($fp_params['entry'])) { index_singlepost($params, $module); } elseif ( ($explicit_req = $page = @$fp_params['page']) || (empty($fp_params) && $page = @$fp_config['general']['startpage']) ) { index_staticpage($page, $explicit_req, $params, $module); if you don't need rss/atom feeds, you can delete the whole if/else block and replace it with a single call to index_showposts($params, $module); HTH
  • Stanley, you have made a great work. is possible to make a plug in to do these? Private area and multy member access?
  • sorry I didn't understood fully your question; in your case you don't have to DELETE the whole code block I've pointed out, but wrapping it into a user_loggedin() check
  • hey, I've figured out how to hack a plugin :) Now, a Warning, even though you are asking your users not to edit the *same* entry, this won't prevent the index from being corrupted, since the access to the indices is not exclusive. So, suppose A writes entry1 and B writes entry2, if A hits SAVE and then B hits SAVE while the update operation for entry1 has not completed, either you'll get a corrupt and non-working index, or one of the two entry won't show up (probably A's). However I've seen myself that rebuilding the indices is quite quick, so you'll just have to go to the maintainance tab and choose that option.
  • Posted By: NoWhereManNow, a Warning, even though you are asking your users not to edit the *same* entry, this won't prevent the index from being corrupted, since the access to the indices is not exclusive. So, suppose A writes entry1 and B writes entry2, if A hits SAVE and then B hits SAVE while the update operation for entry1 has not completed, either you'll get a corrupt and non-working index, or one of the two entry won't show up (probably A's). However I've seen myself that rebuilding the indices is quite quick, so you'll just have to go to the maintainance tab and choose that option.

    Yes, i seem to recall something you mentioned about that before. I'll try your plugin and let you know how I get on. Thanks!
    Posted By: lantacais possible to make a plug in to do these? Private area and multy member access?

    Well, I'm the first to admit that I just hack things about (in a controlled manner) until they work, so I'm not sure how to do a plugin, but see NWM's post above and my original one, regarding allowing multiple users and protecting the blog. But please be aware of NWM's many warnings about trying to make FP do something it wasn't designed to do, i.e. be used by more than one person. I'm using it in a very small & tightly controlled group of people, but there might be hidden problems with doing something like this, not only the possibility of corrupting the index (as mentioned above) but also the fat that the more people you have the more chance there is that one of them will make the password known to someone who can wreak havoc on your precious blog. I'm documenting it all while I'm doing it, so I'll be glad to share once I've reached the stage where I'm happy, but I'll never be so confident that I would recommend others try it, not while all users can wipe out the blog. Even editing someone else's post switches the author name to the person who last edited it, so it needs a lot of discipline. Great for two or three people collaborating on something though, so far.
  • Posted By: NoWhereManhey, I've figured out how to hack a plugin :)

    It seems to work, but I needed to add unset($fp_params['x']); For good measure I also did the wrap-around of the code you said in index_main() Any such urls now give out page not found errors. ^^^^ don't go there! The plugin seems to work fine on it's own, though I still kept the "x" parameter in it. I was thinking of disabling RSS (as that's where the urls could be picked up from) but I use the RSS feed myself, to re-check my posts are ok, right after I post them, so I wanted to keep it.
  • Hi, old thread, I know... I can't seem to make this plugin work. I copied the code above to a plugin.privateblog.php file (in fp-plugins/privateblog), then enabled it in the Plugins area on the Admin page. but it doesn't seem to do anything. is this plugin outdated? cheers, odd
  • Posted By: oddis this plugin outdated?

    No, tested with current SVN 315. please follow these steps: Copy the code from this Forum entry, paste it in an editor (UTF-8 file format) Flatpress Forum | Help: Private Team Blog and save it in /fp-plugins/ProtectedBlog as "plugin.ProtectedBlog.php". Next login in your Flatpress, go in the admin panel to "Plugins" and activate this plugin. Create a new static page called "Loginmask" with this title and content:
    title: Login required content: Hello, this is a private area, please [url=login.php]Login[/url]. Thanks in advanced ;)

    Save this static page as "Loginmask" and go in the admin panel to "Options". At this menu scroll down to "The home page of this web site is" and select in the list box your "Loginmask". Save and finish. Next open with an editor the "widgets.tpl" of your current theme. You will find this file here: fp-interface/themes/"your theme name"/widgets.tpl Now change it to:
    {if $flatpress.loggedin } {widgets pos=right}

    {$subject}

    {$content}
    {/widgets} {widgets pos=left}

    {$subject}

    {$content}
    {/widgets} {/if}
    Edit: One case will not work with the Plugin. If you have the complete url from any entry, you can visit this entry without logged in. This is a problem with this solution.
  • 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