Opened 6 months ago
Closed 6 months ago
#2052 closed enhancement (fixed)
New Shortcode: Forum Statistics
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.3 |
| Component: | Shortcodes | Version: | 2.2 |
| Severity: | normal | Keywords: | has-patch needs-ui |
| Cc: | wordpress@… |
Description
Introduce new bbPress shortcode [bbp-statistics] for bbPress Forum Statistics
Utilizing existing page template /extras/page-forum-statistics.php
Attachments (3)
Change History (11)
- Cc wordpress@… added
The get_template_part won't work here because if you check templates/default/extras/page-forum-statistics.php, that's a full template, with header, footer, and all.
Probably we should create a new function that returns the statistics and use that function both in the template and in the shortcode.
Hmmmmm... WordPress templating sink or swim time ;)
eg. bbp-lost-pass shortcode calls form-user-lost-pass.php
The form-user-lost-pass.php also has get_header(); ?> <?php get_sidebar(); ?> <?php get_footer(); ?> and is basically the same code except for what is inside the <divs> yet this works fine.
Is this because page-forum-statistics.php is a 'page' template whereas form-user-lost-pass.php is a 'form' template?
EDIT: p.s. Thanks for the reply and info
Replying to netweb:
eg. bbp-lost-pass shortcode calls form-user-lost-pass.php
The form-user-lost-pass.php also has get_header(); ?> <?php get_sidebar(); ?> <?php get_footer(); ?> and is basically the same code except for what is inside the <divs> yet this works fine.
uhmm nop. It's just a form. Click again in the file you posted :)
Is this because page-forum-statistics.php is a 'page' template whereas form-user-lost-pass.php is a 'form' template?
Yes. When you load that template inside the shortcode, basically you're doing an inception thing. And what's worst, that template calls the_content(), so you get an infinit loop, because the_content() loads that same shortcode again.
What we need to do IMHO is get the code from line 30 to line 92 of page-forums-statistics.php into a new template part, and then call this new template part both from page-forums-statistics.php and the shortcode.
- Keywords has-patch added
2052.2.diff implements the shortcode.
Doesn't look very good, probably it needs some better markup / styles, but that's far from my strong suit.
comment:7
johnjamesjacoby — 6 months ago
- Keywords needs-ui added
- Milestone changed from Awaiting Review to 2.3
That's a pretty good first pass. Moving to 2.3 for more iteration.
comment:8
johnjamesjacoby — 6 months ago
- Resolution set to fixed
- Status changed from new to closed
The attached 2052.diff is as far as I can get :(
I am presuming 'something' else regarding the actual page template needs to be initialized 'somewhere' else, any clues on what else needs to be done would be welcomed and I'll happily have a go at it. :)