Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
23.2k views
in Plugins by

How can I add Recent Badge Widget to the Badges page?

In administration center layout we have:

Show widget in this position on the following pages:
 Question pages
 Recent questions and answers
 Recent activity
 Question lists
 Hot questions
 Recent questions without answers
 Most popular tags
 Browse categories
 Top scoring users
 Ask a question
 Tag pages
 User pages
 Send a private message
 Search results
 Send feedback
 Log in
 Register as a new user
 My account details
 My favorites
 Recent updates for me
 IP address pages
 Administration center

There isn't Badge page

by
Any ideas???

1 Answer

+2 votes
by
selected by
 
Best answer

It works fine to me. Here is the configuration and the result:

EDIT: Based on comments I see the idea is to ONLY display this widget in that page. Firstly, setup the layout as it is displayed in the screenshot. Then add this code to the doctype function in your qa-theme.php file:

public function doctype() {
    foreach ($this->content['widgets']['side']['bottom'] as $index => $value) {
        if ($value instanceof qa_badge_widget && qa_request() !== 'badges') {
            unset($this->content['widgets']['side']['bottom'][$index]);
            break;
        }
    }
    parent::doctype();
}

If you already have that function defined then just add the foreach part up to the parent::doctype();

by
Thanks Pupi.
I know about that!
But I want to show recent badges widget only in the page of badges not on all available pages.
Badges plugin adds a link to the navigation "Badges".
by
I've updated the answer to match the new requirement
by
Thank you. works fine.
by
reshown by
Hi Pupi.
This code doesn't work on version 1.7.1 for me. Could you please help me?
by
I added your code to the public function sidebar() and it works fine.
...