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

The Featured Plugin by Noah allows to make questions featured and let them come on top of question lists. This plugin adds a "Featured" tab for question lists and shows all the featured questions. Any question can be featured/unfeatured by clicking on a button. Also, featured questions can be listed "category-wise".

Screenshots attached..

Download:

https://github.com/arjunsuresh/q2a-feature

Q2A version: 1.7
by
This is a nice idea, it can also be used for a lot of more purposes if website owners think about it properly. :)
Finally, will this feature link be on the main menu or on just sub-menu of Questions page?
by
yes, a lot more options. On my site I'm adding it for Corrected Questions/Ambiguous Questions etc. Also, for other filters. But these are not generic to all Q2A users. Can be used for even blog purpose with slight modification..

This links to only the subnav in Question Pages. But you can add a navlink to the corresponding URL in the navbar.
by
So is this plugin ready to be downloaded and used...?
by
It's a good idea for a plugin.
Is it possible to set an order for the featured questions?
(Define which question will appear first in the list.)
by
@Gurjyot Yes, Sorry I had forgotten to add the link. Added now.
@Jonathan Currently the featured questions follow the created date order.

2 Answers

+1 vote
by
edited by
Hello @arjunsuresh,
How to fix this problem?

PHP Fatal error:  Call to undefined function qa_db_postmeta_set() in qa-include/qa-base.php(614) : eval()'d code on line 107 .

Line 107 is about qa_db_postmeta_set() function :/

LAYER file from plugin contains:

                        $q_view['form']['buttons'][] = array("tags" => "name='feature-button' value='$postid' title='".qa_lang_html('featured_lang/feature_pop')."'", "label" => qa_lang_html('featured_lang/feature'));

and then my button name is id from post, not "feature" like in language file. Maybe this will help You to fix this:)

Heeelp please ;)
by
I checked this and this plugin is working for me, but with bad "name" of button. Maybe someone know how to fix it:

OVERRIDES file from plugin, line near 100:

    if ( qa_is_http_post() ) {
        if(qa_get_logged_in_level()>=  qa_opt('qa_featured_questions_level'))
        {
            if(isset($_POST['feature-button'])  )
            {
                $postid = $_POST['feature-button'];   
                                                require_once QA_INCLUDE_DIR."db/metas.php";
                                                require_once QA_INCLUDE_DIR."db/post-create.php";
                                                require_once QA_INCLUDE_DIR."db/post-update.php";                                                                                                
                qa_db_postmeta_set($postid, "featured", "1");
                updatefeaturedcount($postid);
                qa_redirect( qa_request(), $_GET );
            }
            if(isset($_POST['unfeature-button'])  )
            {
                $postid = $_POST['unfeature-button'];   
                                                require_once QA_INCLUDE_DIR."db/metas.php";
                                                require_once QA_INCLUDE_DIR."db/post-create.php";
                                                require_once QA_INCLUDE_DIR."db/post-update.php";               
                qa_db_postmeta_clear($postid, "featured");
                updatefeaturedcount($postid);
                qa_redirect( qa_request(), $_GET );
            }
        }

So - It's necessary to add

                                                require_once QA_INCLUDE_DIR."db/metas.php";
                                                require_once QA_INCLUDE_DIR."db/post-create.php";
                                                require_once QA_INCLUDE_DIR."db/post-update.php";   

before db_post_meta_set and clear functions . Then featuring and unfeaturing working perfect .

But I don't know how to change "name" for this button "feature" in this plugin, because it calls in LAYER:

                        $q_view['form']['buttons'][] = array("tags" => "name='feature-button' value='$postid' title='".qa_lang_html('featured_lang/feature_pop')."'", "label" => qa_lang_html('featured_lang/feature'));
'
So "value" is $postid , not "feature" . Anybody knows how to fix it?
by
Thanks Piotr. I'll fix it.
by
What do you mean by "bad name of button"? What exactly is the issue?
by
There are buttons like edit, hide, answer and...175345 for example. There should be not 175345, but "feature" :-) now i have strange button labeled like postid ;), not "feature" .
by
@arjunsuresh It looks like this:
http://www.fandoms.pl/files/featured.png .
Button "252713" should be showing as "Feature" .

Any fix please? :)
by
:O that should not happen. "Feature" is coming from the language file. You have not edited any files right? Can you simply git clean and do a git pull? Are you using non-English language?
by
Yes, non english - but I know how to change this from language file ;) The problem is, that I have "number", not "feature" text on button ;)
Maybe something from source will help You to fix this issue:

<input name="feature-button" value="252697" type="submit" class="qa-form-light-button qa-form-light-button-0" original-title="Feature this question">

SO VALUE is showing as "name" of button .

My script has MANY core hacks and installed plugins, but i installed on standard q2a 1.7.4 too, and I have same problem :/
by
yes, the value of the button is the question id and it must be number. Actually "Feature" should come exactly after the close of the <input> tag you have shown. What exactly follows that?
by
can You explain Your question please? You ask me about what's in code (source) after ?
by
Yes, or can you give me the link to the page- but "Feature" button might not be visible to public right? If you have the new Q2A site which you tried on that is better.
0 votes
by

There is a new issue with version 1.8.0 of q2a:

I receive the following warning on

Notice: Undefined index row qa-include/qa-theme-base.php on line 1386

In addition to the fact it does not work in version 1.8.0 of q2a

My installed version of your plugin is Feature Questions v1.1 by Arjun Suresh (latest)

https://github.com/arjunsuresh/q2a-feature/issues/1

...