Jump to content

Recommended Posts

@kongondo. Thank you for this very useful module. It will find a home in a couple of installs I have in the queue right now. I owe you one!

  • Like 1

Share this post


Link to post
Share on other sites

Update: Blog version 1.2

Read below before updating.

For new installs, proceed as normal

-------------------------------------

Changelog

TL:DR: Comments visibility settings + Posts' Bulk Actions + Update Script

Comments

Comments visibility can be controlled 'globally' as well as on a 'per post' basis

Default is that comments and comment form are visible. You do not need to specify this setting; it just applies

A post's comments SPECIFIED visibility overrides the global setting except for one case (see below).

Post Comments Settings are set via a page select on a Post's page (also in 'Settings' tab in Blog Dashboard - see below)

  • No selection: Default [comments and comments form will be shown]
  • Always Show Comments: This will enforce overriding of global setting (e.g. Disable Comments) 
  • Disable New Comments: Will show old comments but not the comments form; visitors will not be able to submit new comments & message 'Comments closed for this post' will be shown.
  • Disable Comments: Will neither show old comments nor the comments form; visitors will not be able to submit new comments & will see message 'Comments not allowed for this post'. Old comments WILL NOT be deleted :D.

Global Comments Settings are set via a page select on the Comments page (in Dashboard as well). Settings here DO NOT override a Post's Comments settings WHERE A SELECTION has been made (i.e. if NOT empty).

  • No selection: Default [comments and comments form will be shown]
  • Disable New Comments: Similar to above Post setting except will affect all Posts' comments where no comments visibility selection has been made. 
  • Disable Comments: Similar to above Post setting except will affect all Posts' comments where no comments visibility selection has been made. 

Global Maximum comments allowed per post.

If any number > 0 is specified in this new setting, IRRESPECTIVE of a Post's comments settings, if a post's comments is greater than the maximum set here, then 'Disable New Comments' will kick in. So, this takes precedence.

Note: If you are logged in as superuser, even PENDING and SPAM comments are counted; so, the Global Maximum may be 'temporarily reached', if that makes sense :-)

Recap of comments visibility, in order of descending priority:

1. Global Maximum comments allowed for posts (/blog/comments/)

2. Any comment visibility SPECIFIED on a post (i.e. not empty) (/blog/posts/your-post/)

3. Any Global comment visibility SPECIFIED on comments page (/blog/comments/)

4. Default.

'Settings' Tab

You can also set both the Global comments visibility and the Global Maximum comments allowed per post on this tab. The current setting will always be selected in the input field.

Note: A blank Global comments visibility means no setting specified :-). So, if you want to change to 'no global setting specified', just select a blank and save [equivalent to deselecting a page select] (hope this makes sense).

Note: Where no Global Maximum comments is set (i.e. blank), saving in the 'Settings' Tab's General Settings will subsequently show a '0' [zero]. This is equivalent to a blank, so not to worry :D

Bulk Actions

Introducing Bulk Actions for the Posts Tab! Make bulk changes to posts:

  • Unpublish/Publish
  • Comments visibility (as specified above for Posts' Comments visibility). In this case, also a 'Default Comments View' selection available. This is the equivalent of the 'no selection' specified in page selection field above.
  • Trash
  • Delete (note: no warning given before delete; careful with this one!)

New column in Posts' Table also shows currently specified Comments visibility for each post. 'Default' means no selection made.

Other

- Some code clean-up.

- See blog-side-bar.inc issue below.

UPDATING

I have written an update script (attached) that will add the new features in Blog 1.2 (2 fields, 1 template, 3 pages, 2 page updates, etc.).

I have thoroughly tested the script. However, try this first on a test/non-essential install! If everything works, you can use it on your live environment

Note: This assumes you haven't changed the native Blog paths and page names. Otherwise, it won't work properly. It won't corrupt any data but may just not install some stuff :D

Note: You will still need to update the module as normal in your PW admin! Above is just to save you manually creating the extra fields, etc.

To update:

# Copy and paste the contents of blog-upgrade-version1-2.txt at the very top of one of your template files. Save the template file.

# The script will only run if you are logged in as a superuser so other users won't know what's happening.

# View a page using the template file you've just amended. The new fields, template and pages will be created.

# Reverse the changes to your template file and save.

# Update Blog via PW Admin as usual (to version 1.2)

# Copy blog.css to /site/templates/css/

blog-upgrade-version1-2.txt

If you are using the blog-side-bar.inc you might want to make/note the following changes. This only affects existing Blog installs! (not new ones)

There was a missing <br> tag + $item->date instead of $item->blog_date. This will ensure Recent Comments widget also show the Post's date. If you are using the code from this file, you can make the following changes:

OLD:

$date = $blogOut->formatDate($item->date);
$out .= "<li><span class='date'>$date</span> <a href='{$item->url}'>{$item->title}</a></li>";

NEW:

$date = $blogOut->formatDate($item->blog_date);
$out .= "<li><span class='date'>" . $date. "</span><br> <a href='{$item->url}'>{$item->title}</a></li>";

In addition, the code has now been changed not to show 'recent posts widget' on the blog home page. @Adrian idea, thanks!

Screens

post-894-0-20033400-1401805227_thumb.pngpost-894-0-50240100-1401805228_thumb.pngpost-894-0-25658900-1401805233_thumb.pngpost-894-0-51929000-1401805234_thumb.pngpost-894-0-17408000-1401805231_thumb.pngpost-894-0-63958900-1401805229_thumb.png

Happy blogging! O0  :lol:

  • Like 7

Share this post


Link to post
Share on other sites

ASAP i will provide german language files...;) Great Work!

  • Like 4

Share this post


Link to post
Share on other sites

ASAP i will provide german language files... ;) Great Work!

Thanks! I think there are a few remaining strings that need to be made translatable as well like the 'No' and 'Yes' for published posts. I'll get to them later. 

Share this post


Link to post
Share on other sites

Kongondo. I am in awe!  WOW, WOW, WOW!!!  My mouth has dropped to the floor and my prayers have been answered! This has been designed so beautifully, logically, and intuitively  :'(You are super talented my friend. This is something that has been needed for quite some time. Thank you so much for this!!!

I'm speechless.

  • Like 4

Share this post


Link to post
Share on other sites

Great Module!

sorry, if it was answered before, i couldn't find any mention on this topic:

Does this module work in multilingual environments (german + english)?

Thanks!

  • Like 1

Share this post


Link to post
Share on other sites

....Does this module work in multilingual environments (german + english)?

Thanks!

I have never worked in a multilingual ProcessWire environment so I hope my answer doesn't seem foolish :D

Output strings are all translatable. See posts above; someone has worked on/produced German translations. There's maybe 1 or two texts not yet made translatable but will do a final check soon...

Glad you like the module :-)

Share this post


Link to post
Share on other sites

i'l translate the actual version - but last days was very bussy...

only problem that i'll see for now is the handling of dates and the calendar overview....this should changed to a multilingual version....i thought i've read a snippet for this from Apesia that support something simiar for displayed calendars, too....

  • Like 1

Share this post


Link to post
Share on other sites

here we go  == German language for ProccessBlog

i'll need this great Addon in some weeks for a own blog, so i will contribute some more lost strings that are not translatable until now....so stay tuned.

Thanks to Kongondo! This is really great Addon - i'll love ProcessWire at the first glance it is perfect to setup websites and get learning PHP faster!

  • Like 4

Share this post


Link to post
Share on other sites

I have built a few websites on Processwire now but for some reason cannot rap my head around implementing this blog into my current design. I don't understand why you have so many template files and how to edit or get things to output in my html/css coded pages. I would like to just be able to plug the right calls into my current design. Please advise. Complete stuck trying to implement this into my current design.

Share this post


Link to post
Share on other sites

Franko,

Sorry to hear you are having problems implementing Blog. Apologies, I have not had time to write the documentation. It is however quite easy to fit Blog in any design. The reason for the 'many' template files is explained in several posts in this thread :-). In a nutshell, the many template files have nothing to do with the module; they are only examples, are necessarily verbose and are meant to showcase the methods/functions available within MarkupBlog. Blog is a module and you can call it anywhere, any time you want in your template files. I will write up what its methods do and how to use them when I get some time. 

  • Like 1

Share this post


Link to post
Share on other sites

Ok, so maybe you can point me in the right direction. How do I output my code? I edited the template files with my html and added the php calls you had in your template files. That seems to work, but there is a bunch of code outputting that is not mine and messing things up. I'm assuming that I need to edit the MarkupBlog.module file? The only thing is I can't figure out what needs to be changed in that file to output my html. I'm also assuming that I change the things where there is code listed after all the $out .=   but there seems to be a lot of code that that I do not need. Please advise. 

Share this post


Link to post
Share on other sites

No. Do not edit MarkupBlog.module. On update, your changes will just be overwritten. In addition, remember, this is a Markup Module; such modules output some markup. The markup has IDs and classes that you can target with your CSS and do whatever you wish.

What do you mean by messing things up? What template file are you referring to? Even blog.css is just a demo file. If you are using that, you can delete it or use it as a baseline for your blog. Same goes for pocketgrid.css. 

Using the example template file blog-post.php (for single posts), to get you up and running quickly, only use the PHP up to line 48. Delete the rest of the HTML below. However, to output the main content of the post, you will need to echo somewhere $content. In that example template file, I have called that variable $content; it could be anything you want. Still on this example, I include the right sidebar stuff using blog-side-bar.inc. You may choose to do it differently. Have a look at the code in there to see how simple it is. My guess is that you are new to PHP? Anyway, try that first and let me know. Are you developing locally or there is a test site I could look at?

Share this post


Link to post
Share on other sites

Yes I am new to php. Ok so I am now assuming that I need to write the php in the top section of the page and echo the content with the tag on the page. I then need to write the css based on the output of your code that comes out when it is echo on the page. Correct?

Here is my code which is different from what outputs. Some elements like the <article> are repeating.

<section id="content" class="cols-a">
<div class="news-a">
<article>
<header>
<p>Thursday, April 3, 2014</p>
<h2><a href="./">Safety Tips for the Garage</a></h2>
</header>
<figure><img src="http://placehold.it/660x160" alt="Placeholder" width="660" height="160"></figure>
<p>You have taken special care to be sure that your home is safe. If you have small children, you’ve childproofed the electrical outlets. If you have older children, you’ve discussed Internet safety and might have installed a filter to block objectionable material. You likely have used baby gates, screened babysitters, and are careful when you use a ladder. Undoubtedly, safety is important. Many times, however, safety issues in the garage are unintentionally overlooked, because the area is not seen as an actual room that your family lives in. Here is a list of things to double check to be sure that your garage is as safe as possible...</p>
<p class="link-b"><a href="./">Read more</a></p>
</article>
</div>
</section>
 
The article section needs to repeat for each post like in the image. screenshot.png
 
 
This is whats outputting
 
screenshot2.png
 
 
 
 
This is the code I am using in the page.
 
    //main content
    $limit = $page->blog_quantity;//number of posts to show on Blog Home Page (pagination kicks in if more posts than limit)
    $content = '';
    $content .=  $blogOut->renderPosts("limit={$limit}");
 
So I am not sure how to get it to output that I want. My lack of php skills is most likely the problem but I have come to love Processwire over Wordpress and Modx. Any help would be appreciated. 
 

Share this post


Link to post
Share on other sites

- For "Read more" funktionality you should take a look at the settings in the "posts" Page for truncate...

- like i see in the example files there is no imageoutput maybe her could konkondo give a best practise example that fits the example templates that ships with the MarkupBlog

- the templates for the main output is

  • the blog-post - how look a single post
  • and the blog-posts - overview of all posts
  • and the blog template with a little different overview

there is always a php setting for the content and some vars and below there is the HTML Markup Output.

Or you could write your own template for overview and single-post view and grab the content like shown in example template files direct in your HTML via the PW API.

kind regards mr-fan

Share this post


Link to post
Share on other sites

This module looks awesome - thanks hugely for sharing :)

Could I ask (pretty new to Processwire so apologies if this is easy or not possible or anything like that). Would it be possible to modify the post URI so that instead of something like /blog/posts/this-is-a-post you could have something like /blog/2014/06/this-is-a-post

So essentially it'd categorize the posts into year and month. This is similar to how Wordpress and a couple of other CMS/Blog systems do it as default, and it's pretty handy as if you've got 2 posts with the same name, they are less likely to clash if you're also including/checking the month/year.

Also, I read through the thread and saw a mention of having a publish date/time - has this been implemented? If not I'm probably going to be doing some work on a few of my own modules in the next week or two, so would be happy to see about doing a pull request with it as it's something I'll need to add anyway :)

  • Like 1

Share this post


Link to post
Share on other sites

Also, I read through the thread and saw a mention of having a publish date/time - has this been implemented? If not I'm probably going to be doing some work on a few of my own modules in the next week or two, so would be happy to see about doing a pull request with it as it's something I'll need to add anyway :)

Scheduled publishing is an integral part of the workflow for many bloggers, so this would definitely make sense. I couldn't live without such a feature anymore.. :)

@kongondo: if you're still pondering whether to use SchedulePages somehow or cook up your own method, I'd vote for SchedulePages. Admittedly I'm being somewhat selfish here (I'm sure we'll be using this module for our client sites and I don't like the idea of having to explain why and how scheduling posts is different from all other pages) but it's also a great module :)

  • Like 2

Share this post


Link to post
Share on other sites

Seriously? If yes, out of the box, no. But with some trickery, you can have MarkupBlog output posts from only a particular author, assuming each author has their own blog. I am just thinking out loud here. If this is a feature request, I'd like to have more details but also hear what others think :-)

Glad you like the module. :D

Sorry for spamming (sort of), but just wanted to comment on this one that most (quite possibly all) of the sites we've implemented a blog for have more than one blog. Doesn't sound that far fetched to me: one or more for internal use, one for each division (a lot of our blogging clients are municipalities and they've got a ton of these), one for CEO/mayor, one for each temporary project etc.

Also, if you were referring to creating a bunch of user-specific blogs: I've explained this sort of behaviour (in another system) to clients over and over and over and can assure you that, though it may sound like the logical solution, in real world it just doesn't work.. unless you also allow some sort of "blog superusers" to post with any user account, which could introduce an entire set of new problems :)

One typical situation is a CEO or mayor having his/her own blog. Most people of that caliber simply don't have much spare time and blogging is rarely considered a core task, so even if this person does really write his/her own posts, there's a very high probability that someone else handles posting them online.. which is where the trouble starts if each blog is tied to one user. I'm sure you get the point.

Anyway, I'd appreciate if you could consider this kind of feature, but I get that it's probably not too high in priority :)

  • Like 1

Share this post


Link to post
Share on other sites
One typical situation is a CEO or mayor having his/her own blog. Most people of that caliber simply don't have much spare time and blogging is rarely considered a core task, so even if this person does really write his/her own posts, there's a very high probability that someone else handles posting them online.. which is where the trouble starts if each blog is tied to one user. I'm sure you get the point.

One nice thing that Wordpress has is the ability to change the author of a post from the person who is creating it and logged in. Maybe an author PageField that allows you to select from other PW users that have a blog author role, or something along those lines?

  • Like 1

Share this post


Link to post
Share on other sites

One nice thing that Wordpress has is the ability to change the author of a post from the person who is creating it and logged in. Maybe an author PageField that allows you to select from other PW users that have a blog author role, or something along those lines?

Adrian, you can already change the author of the post..unless am not getting you? Check the settings tab when editing a blog post page

  • Like 1

Share this post


Link to post
Share on other sites

One nice thing that Wordpress has is the ability to change the author of a post from the person who is creating it and logged in. Maybe an author PageField that allows you to select from other PW users that have a blog author role, or something along those lines?

Agreed. This might be a valid solution for the user-specificity part, though "regular" bloggers probably shouldn't have the permission to do this -- right?

Whether this solves the question of having multiple separate blogs still doesn't seem entirely obvious to me. In another system we've used it was possible to create and embed separate blogs, with their own names and other settings, to different parts of the site. That was pretty handy, actually. Each blog being tied to one user account (in a way that made it impossible to change later) was the problematic part.

If only we could somehow had both.. :)

Edit: I'll have to take a closer look at post settings based on @kongondos reply above, but just wanted to clarify the part about "regular bloggers' permissions". In our case bloggers are sometimes actually users that have absolutely no other permissions -- can't edit content etc. Them being able to edit other bloggers' posts or change authors of those would be far from optimal. Could be specific to our case, though..

Edited by teppo

Share this post


Link to post
Share on other sites

Guys,

Sorry I have been rather quiet in the recent past. You may have noticed I am in holiday mode and have been following, rather keenly, the trajectory of a certain spherical leather object :P  :lol: ....Two more weeks to go and I should be back in play....(forgive the pun  O0 )

  • Like 5

Share this post


Link to post
Share on other sites

Adrian, you can already change the author of the post..unless am not getting you? Check the settings tab when editing a blog post page

Sorry - I haven't actually implemented your blog profile on a site yet, so I forgot about that!

Agreed. This might be a valid solution for the user-specificity part, though "regular" bloggers probably shouldn't have the permission to do this -- right?

Whether this solves the question of having multiple separate blogs still doesn't seem entirely obvious to me. In another system we've used it was possible to create and embed separate blogs, with their own names and other settings, to different parts of the site. That was pretty handy, actually. Each blog being tied to one user account (in a way that made it impossible to change later) was the problematic part.

If only we could somehow had both.. :)

Edit: I'll have to take a closer look at post settings based on @kongondos reply above, but just wanted to clarify the part about "regular bloggers' permissions". In our case bloggers are sometimes actually users that have absolutely no other permissions -- can't edit content etc. Them being able to edit other bloggers' posts or change authors of those would be far from optimal. Could be specific to our case, though..

In Wordpress regular bloggers can't change the author - it requires an editor (or maybe admin, I don't remember) level permission setting.

Share this post


Link to post
Share on other sites

This module looks awesome - thanks hugely for sharing :)

Could I ask (pretty new to Processwire so apologies if this is easy or not possible or anything like that). Would it be possible to modify the post URI so that instead of something like /blog/posts/this-is-a-post you could have something like /blog/2014/06/this-is-a-post

So essentially it'd categorize the posts into year and month. This is similar to how Wordpress and a couple of other CMS/Blog systems do it as default, and it's pretty handy as if you've got 2 posts with the same name, they are less likely to clash if you're also including/checking the month/year.

Also, I read through the thread and saw a mention of having a publish date/time - has this been implemented? If not I'm probably going to be doing some work on a few of my own modules in the next week or two, so would be happy to see about doing a pull request with it as it's something I'll need to add anyway :)

Hi Rickm,

Glad you are liking the module.

URI:

I see your point. There was a similar request a couple of posts further up. My response then and still is that this is one of those things where people have different preferences. Sorry, for now, I am leaving it up to the user to manipulate the URL segment if they so wish.

Publish date/time:

I haven't had time to implement this yet (sorry, distracted by football currently  :P) but it's on my TODO list. 

Thanks!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By gebeer
      I am happy to present my new fieldtype FieldtypeImageFromPage. It is made up of 2 modules:
      Fieldtype Image Reference From Another Page is a Fieldtype that stores a reference to a single image from another page. The image can be selected with the associated Inputfield.
      Inputfield Select Image From Page is an Inputfield to select a single image from images on a predefined page and it's children.
      And there also is a helper module that takes care of cleanup tasks.
      This module evolved out of a discussion about my other Module FieldtypeImagePicker.  It caters for use cases where a set of images is being reused multiple times across a site. With this fieldtype these images can be administered through a chosen page. All images uploaded to that page will be available in the inputfield.
      When to use ?
      Let editors choose an image from a set of images that is being used site-wide. Ideal for images that are being re-used across the site.
      Suited for images that are used on multiple pages throughout the site (e.g. icons).
      Other than the native ProcessWire images field, the images here are not stored per page. Only references to images on another page are stored. This has several advantages:
      one central place to organize images when images change, you only have to update them in one place. All references will be updated, too. (Provided the name of the image that has changed stays the same) Features
      Images can be manipulated like native ProcessWire images (resizing, cropping etc.) Image names are fully searchable through the API Accidental image deletion is prevented. When you want to delete an image from one of the pages that hold your site-wide images, the module searches all pages that use that image. If any page contains a reference to the image you are trying to delete, deletion will be prevented. You will get an error message to help you edit those pages and remove references there before you can finally delete the image. How to install and setup
      Download and install this module like any other modules in ProcessWire Create a page in the page tree that will hold your images. This page's template must have an images field Upload some images to the page you created in step 2 Create a new field. As type choose 'Image Reference From Another Page'. Save the field. In 'Details' Tab of the field choose the page you created in step 2 Click Save button Choose the images field name for the field that holds your images (on page template from step 2) Click Save button again Choose whether you want to include child pages of page from step 2 to supply images Add the field to any template You are now ready to use the field View of the inputfield on the page edit screen:

      View of the field settings

      The module can be installed from this github repo. Some more info in the README there, too.
      In my tests it was fairly stable. After receiving your valued feedback, I will eventually add it to the modules directory.
      My ideas for further improvement:
      - add ajax loading of thumbnails
      Happy to hear your feedback!
       
    • By gebeer
      Although the PW backend is really intuitive, ever so often my clients need some assistance. Be it they are not so tech savvy or they are not working in the backend often.
      For those cases it is nice to make some help videos available to editors. This is what this module does.
      ProcessHelpVideos Module
      A Process module to display help videos for the ProcessWire CMS. It can be used to make help videos (screencasts) available to content editors.
      This module adds a 'Help Videos" section to the ProcessWire backend. The help videos are accessible through an automatically created page in the Admin page tree. You can add your help videos as pages in the page tree. The module adds a hidden page to the page tree that acts as parent page for the help video pages. All necessary fields and templates will be installed automatically. If there are already a CKEditor field and/or a file field for mp4 files installed in the system, the module will use those. Otherwise it will create the necessary fields. Also the necessary templates for the parent help videos page and it's children are created on module install. The module installs a permission process-helpvideos. Every user role that should have access to the help video section, needs this permission. I use the help video approach on quite a few production sites. It is stable so far and well received by site owners/editors. Up until now I installed required fields, templates and pages manually and then added the module. Now I added all this logic to the install method of the module and it should be ready to share.
      The module and further description on how to use it is available on github: https://github.com/gebeer/ProcessHelpVideos
      If you like to give it a try, I am happy to receive your comments/suggestions here.
    • By Robin S
      A module created in response to the topic here:
      Page List Select Multiple Quickly
      Modifies PageListSelectMultiple to allow you to select multiple pages without the tree closing every time you select a page.
      The screencast says it all:

       
      https://github.com/Toutouwai/PageListSelectMultipleQuickly
      https://modules.processwire.com/modules/page-list-select-multiple-quickly/
    • By gebeer
      Hello all,
      sharing my new module FieldtypeImagePicker. It provides a configurable input field for choosing any type of image from a predefined folder.
      The need for it came up because a client had a custom SVG icon set and I wanted the editors to be able to choose an icon in the page editor.
      It can also be used to offer a choice of images that are used site-wide without having to upload them to individual pages.
      There are no image manipulation methods like with the native PW image field.
      Module and full description can be found on github https://github.com/gebeer/FieldtypeImagePicker
      Kudos to @Martijn Geerts. I used his module FieldTypeSelectFile as a base to build upon.
      Here's how the input field looks like in the page editor:

      Hope it can be of use to someone.
      If you like to give it a try, I'm happy to hear your comments or suggestions for improvement. Eventually this will go in the module directory soon, too.
    • By bernhard
      @Sergio asked about the pdf creation process in the showcase thread about my 360° feedback/survey tool and so I went ahead and set my little pdf helper module to public.
      Description from PW Weekly:
       
      Modules Directory: https://modules.processwire.com/modules/rock-pdf/
      Download & Docs: https://github.com/BernhardBaumrock/RockPDF
       
      You can combine it easily with RockReplacer: 
      See also a little showcase of the RockPdf module in this thread:
       
×
×
  • Create New...