Jump to content
View in the app

A better way to browse. Learn more.

Invision Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Any way to get a total word count for all posts in the forum, blogs, status updates, and clubs?

Featured Replies

What would be the best way to get a total word count for all posts on the forum? I'd also like this to include Blog posts and comments, Status Updates, and Clubs, but not anything in the personal messenger system.

Thank you!

There's no clean way to achieve this because the content columns contain the content as HTML code, so one can't just count the words, so first you'll need to remove it;)

You could try this:

SELECT
  SUM(
    LENGTH(TRIM(REGEXP_REPLACE(post, '<[^>]+>', ''))) - LENGTH(REPLACE(TRIM(REGEXP_REPLACE(post, '<[^>]+>', '')), ' ', '')) + 1
  ) AS total_word_count
FROM forums_posts
WHERE TRIM(REGEXP_REPLACE(post, '<[^>]+>', '')) != '';

to get the total word count from all forum posts (this DB query doesn't contain any filtering for only visible, published ones)

  • Author

Hi Daniel,

Thank you for that, looks like that would work great for the forum posts -- presumably that would work on blog posts, blog comments, and status replies as well? I'm not familiar with the Club database structure to know what would be involved with that are of the forum.

Unfortunately, as I am now using Invision's cloud hosting service, I am unable to run queries myself (at least as far as I can tell). I'd be greatly appreciative if Invision could run these queries against my database. This is just a one-time thing, just trying to gather some statistics about the forum for a project we're working on.

15 hours ago, Daniel F said:

to get the total word count from all forum posts (this DB query doesn't contain any filtering for only visible, published ones)

Yeah, that is fine for my needs, this doesn't need to be any more complicated.

Thank you again!

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.