Git Product home page Git Product logo

q2a-badges's Introduction

Question2Answer Badges

Description

This is a plugin for Question2Answer that provides basic badge functionality.

Features

  • currently 57 badges implemented (see Badge List below)
  • badges are categorized into types (e.g. gold, silver, bronze)
  • badge notification system triggers jquery notice when awardee accesses the site
  • option to notify users of badge awarding by email (fully customizable)
  • public badge page displays awardable badges
  • awarded badges may be shown in individual profile pages, with links to source (if available)
  • awarded badge may be shown as medals in individual posts and on global users lists
  • badge names and requirements are modifiable via admin page
  • badge system may be deactivated via admin page
  • badges may be individually deactivated via admin page
  • logs badge awarding if event logging is enabled (integrates with history plugin)
  • recent badges widget (requires event logging to database)
  • full translation table available (see Translation below)
  • all css fully customizable
  • ability to add custom badges via plugin (see Custom Badges below)

Installation

  1. Install Question2Answer
  2. Get the source code for this plugin from github, either using git, or downloading directly:
    • To download using git, install git and then type git clone git://github.com/NoahY/q2a-badges.git badges at the command prompt (on Linux, Windows is a bit different)
    • To download directly, go to the project page and click Download
  3. Go to Admin -> Plugins on your q2a install and select the 'Activate badges' option, then 'Save Changes'.

Translation

The translation file is qa-lang-badges.php. Copy this file to the qa-lang/<your-language>/ directory. Edit the right-hand side strings in this file with notepad2, notepad++, etc. (don't ever use Window's Notepad. For anything. Ever.), for example, changing:

'good_question'=>'Good Question',

to

'good_question'=>'Swali nzuri',

for Swahili. Don't edit the string on the left-hand side or bad things will happen.

Once you've completed the translation, don't forget to set the site language in the admin control panel... to Swahili.

Custom Badges

Custom badges may be implemented in any plugin module in a similar way as option_default. Steps are as follows:

1. create a function in your module class called custom_badges(). It should return an array of badges with the badge slugs as indexes for nested arrays with var (default requirement) and type (bronze=0,silver=1,gold=2) indexes. Here is an example from the comment-voting plugin:

function custom_badges() {
        return array(
                'nice_comment' => array('var'=>2, 'type'=>0),
                'good_comment' => array('var'=>5, 'type'=>1),
                'great_comment' => array('var'=>10, 'type'=>2)
        );
}

2. create a function in your module class called custom_badges_rebuild() that will award badges when rebuilding via admin/plugins and return the number of badges awarded. Here is an example from the comment-voting plugin:

function custom_badges_rebuild() {
        $awarded = 0;

        $posts = qa_db_query_sub(
                'SELECT userid, postid, netvotes FROM ^posts WHERE type=$ AND netvotes>0',
                'C'
        );
        while ( ($post=qa_db_read_one_assoc($posts,true)) !== null ) {
                $badges = array('nice_comment','good_comment','excellent_comment');
                $awarded += count(qa_badge_award_check($badges,(int)$post['netvotes'],$post['userid'],$post['postid'],2));
        }
        return $awarded;
}

3. implement qa_register_plugin_phrases() via your qa-plugin.php, including two entries for each badge: badge_<slug> and badge_<slug>_desc. Here is an example from the comment-voting plugin:

return array(
        'permit_vote_c' => 'Vote on comments',
        'badge_nice_comment' => 'Nice Comment',
        'badge_good_comment' => 'Good Comment',
        'badge_great_comment' => 'Great Comment',
        'badge_nice_comment_desc' => 'Comment received +# upvote',
        'badge_good_comment_desc' => 'Comment received +# upvote',
        'badge_great_comment_desc' => 'Comment received +# upvote',
);
  1. Create your own mechanism for awarding badges - see some examples in the badges plugin code, or the bookmark plugin. Make sure to test for both qa_opt('badge_active'), which makes sure the badge plugin is active, and qa_opt('badge_custom_badges') to make sure the badge plugin version supports custom badges. Use the function qa_badge_award_check() to check for badges, where $badges is an array of badge slugs, $var is the number to test against the badges, $oid is the postid (if any), $notify = 0 for no notification, 1 for email and popup, 2 for just popup. You should probably check if this function exists as well, in case the badge plugin has been deleted while active.

Disclaimer

This is beta code. It is probably okay for production environments, but may not work exactly as expected. Refunds will not be given. If it breaks, you get to keep both parts.

Release

All code herein is Copylefted.

About q2A

Question2Answer is a free and open source platform for Q&A sites. For more information, visit:

http://www.question2answer.org/

Badge List

Level [1] Title Description
1 Verified Human Successfully verified email address
1 Autobiographer Filled out all profile fields
1 Photogenic Uploaded an avatar image
1 Nice Question Question received +# upvote
2 Good Question Question received +# upvote
3 Great Question Question received +# upvote
1 Notable Question Asked question received # views
2 Popular Question Asked question received # views
3 Famous Question Asked question received # views
1 Nice Answer Answer received +# upvote
2 Good Answer Answer received +# upvote
3 Great Answer Answer received +# upvote
1 Renewal Received "Nice Answer" badge in response to a question more than # days old
2 Revival Received "Good Answer" badge in response to a question more than # days old
3 Ressurection Received "Great Answer" badge in response to a question more than # days old
1 Gifted # answers selected as best answer
2 Wise # answers selected as best answer
3 Enlightened # answers selected as best answer
1 Grateful Selected # answers as best answer
2 Respectful Selected # answers as best answer
3 Reverential Selected # answers as best answer
1 Liked Received # total upvotes
2 Loved Received # total upvotes
3 Revered Received # total upvotes
1 Asker Asked # questions
2 Questioner Asked # questions
3 Inquisitor Asked # questions
1 Answerer Posted # answers
2 Lecturer Posted # answers
3 Preacher Posted # answers
1 Commenter Posted # comments
2 Commentator Posted # comments
3 Annotator Posted # comments
1 Voter Voted # times
2 Avid Voter Voted # times
3 Devoted Voter Voted # times
1 Editor Performed total of # edits
2 Copy Editor Performed total of # edits
3 Senior Editor Performed total of # edits
1 Watchdog Flagged # posts as inappropriate
2 Bloodhound Flagged # posts as inappropriate
3 Pitbull Flagged # posts as inappropriate
1 Reader Read total of # questions
2 Avid Reader Read total of # questions
3 Devoted Reader Read total of # questions
1 Dedicated Visited every day for # consecutive days
2 Devoted Visited every day for # consecutive days
3 Zealous Visited every day for # consecutive days
1 Visitor Visited site on total of # days
2 Trouper Visited site on total of # days
3 Veteran Visited site on total of # days
1 Regular First visited more than # days ago
2 Old Timer First visited more than # days ago
3 ancestor First visited more than # days ago
1 100 Club Received total of # points
2 1,000 Club Received total of # points
3 10,000 Club Received total of # points
1 Medalist Received total of # badges
2 Champion Received total of # badges
3 Olympian Received total of # badges
[1]Level refers to difficulty level (e.g. gold, silver, bronze).

q2a-badges's People

Contributors

noahy avatar svivian avatar yuttadhammo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

q2a-badges's Issues

Small bug in user list

I overwrote the function qa_get_user_handles_html() to display the user's full name instead of the handle. The badges showed up correctly everywhere except the users list. I found the regrex in the ranking function and replaced it with the regex in the post_meta_who function, which just grabs the user handle from the href instead of the <a> value.

Updating from v2.2 to latest v3.9 - New values not saving

Hi NoahY,

I updated the badges plugin to 3.9 and ran into some issues, maybe it is important for others to note them down:

  1. Before changing language strings in qa-badge-lang-default.php switch texteditor's encoding to UTF-8 without BOM
  2. Dependency in q2a-history-plugin
  3. After the update values for achievements, e.g. "x^answers of users were..." → x values get all reset to default?!

How can I solve n°3? I tried to enter the new values, hit save, nothing was saved. Just showing default values. What could be the reason?

All the best,
Kai

Edit:
Possible duplicate of: #15

Badges plugin v4.8 : badges are not shown in user profile

When I go to the "User profile" and click on "Recent Activity" or on "All questions" or on "All answers", the badges are not shown.

I do not know if this is "work as designed" or it is an issue.
But personally I think it would be better to display them also on these lists for uniformity with the other lists (activity, questions, hot, unaswered, ...)

Any dependencies when updating from v2.2 to latest v3.9?

Hi Noah, before updating the badges plugin I would like to know if I can expect any errors.

I know that there are dependencies, such as:

Badges language string, dependency in q2a-history-plugin, qa-history-layer.php, line 414:

$badge_name=qa_badge_name($slug);

// before:
$badge_name=qa_lang('badges/'.$slug); // eetv: former badges version needs 'badges/'

What changes has been implemented? Where do I need to take care?

Table qa_userbadges has not changed its structure, so this for instance would be fine.

Thanks,
Kai

Recheck Badge Awarding throws Fatal error: Allowed memory size bytes exhausted

Recheck Badge Awarding throws

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 227018240 bytes) in /srv/users/serverpilot/apps/mathelounge/public/qa-include/qa-db.php on line 197

9000 users, 200.000+ posts.

How to overcome this?

PS: ini_set('memory_limit','512M'); did not work.

No count for "Profile complete" and others

This is not a bug, just a tiny issue: For the "profile complete" badge (and others) there should be no counter "1x" as this can only be done one time by the user.

I assume it is enough to show the badge without count.

Greetings @NoahY :)
Kai

Updating from v2.2 to latest v3.9 - New database fields in qa_options?

I just saw that there is a new field for every existing badge with empty value:

from v2.2:
('badge_famous_question_desc', ''), ('badge_famous_question_enabled', '1'), ('badge_famous_question_name', 'Beliebte Frage+++'), ('badge_famous_question_var', '1000'),

from v3.9:
**('badge_famous_question', ''),** ('badge_famous_question_desc', ''), ('badge_famous_question_enabled', '1'), ('badge_famous_question_name', 'Beliebte Frage+++'), ('badge_famous_question_var', '1000'),

What is this extra field for?

Badges Plugin Bug: PHP Error headers already sent by qa-theme-base.php in qa-app-cookies.php

Dear Noah,

Here is the issue:
What is causing the error: headers already sent by qa-theme-base.php in qa-app-cookies.php?

The php warning comes about 3 - 5 times per day. From the logs I don't see any special file called.

Calling qa_cookie_get_create():

Badges plugin:
- in qa-plugin.php, function qa_badge_award_check, line 261. Link to code line
- in qa-badge-check.php, function award_badge, line 627. Link to code line

All the best,
Kai

Wrong URL in "badge awarded" notification

When "Show badges on main profile field (not badges tab) " is set, notification bar makes wrong URL to user profile, using ?tab=badges GET parameter instead of something like #badges

Profiler badge assigned even for empty profiles

After rechecking the badges, I see 'profiler' badges ("profile completed") even for empty profiles.

Example: http://www.gute-mathe-fragen.de/badges (see "Profil vollständig", click on user "gidgreen" who has no fields completed)

Can we only grant the profiler badge if all default fields have information?

  • Full Name
  • Location
    [- Website] optional
  • Description

See fields in qa_userprofile column title.

Have a good Sunday!
Kai

Fatal error: Allowed memory size..

I'm getting this error:

Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 29189 bytes)

How do I fix this? I tried looking at the closed issues, but it doesn't seem to work, and now this error pops up again. Any thoughts?

Undefined variable: post_result

Notice: Undefined variable: post_result in /path/qa-plugin/badges/qa-badge-admin.php on line 426

Happens when you recheck the badges. It's because the unset function call is still there (sorry thought I'd removed it). Just need to remove that line and it all works fine.

Table qa_userbadges: Field "awarded_at" showing same time for all entries

awarded_at              user_id     notify  object_id   badge_slug  id
2013-01-08 20:07:52         186     0       NULL        avatar      1358
2013-01-08 20:07:52         186     0       NULL        profiler    1359
2013-01-08 20:07:52         200     0       NULL        avatar      1360
2013-01-08 20:07:52         233     0       NULL        avatar      1361
2013-01-08 20:07:52         236     0       NULL        avatar      1362
2013-01-08 20:07:52         239     0       NULL        avatar      1363
2013-01-08 20:07:51         393     0       6091        notable_question    612
2013-01-08 20:07:51         396     0       NULL        asker       613
2013-01-08 20:07:51         396     0       NULL        commenter   614
2013-01-08 20:07:51         396     0       6839        notable_question    615
2013-01-08 20:07:51         402     0       NULL        answerer    616
2013-01-08 20:07:51         412     0       NULL        commenter   617
...

The list goes on.

The events were not at the same time. Why do the entries have all the same time?

Is this a bug?
Kai

Default Badge Names not loading from language file

I assume the badge names (i.e.,'badges/good_question', 'badges/grateful', etc) should automatically be replaced by names listed within qa-badge-lang-default.php, but the past two releases has not addressed this issue.

Clicking the 'Reset Names' does not load default names from the lang file nor does it reset manually inputted names.

Widget UserId lookup code change request

We recently converted our internal Question2Answer site to use a custom SSO implementation and as part of that also implemented a Q2A plugin to switch from displaying the user's handle to displaying the user's name from their profile (if its filled in). This change affects the question list, question page and the user list.

As soon as the user's handle display was replaced for user that had entered a name in their profile, the badge widgets stopped displaying. This is because of how the badges plugin is looking for the user handle on those pages.

We modified your code to look at the URL that's associated with the user display, which still references the user-handle. I thought I would let you know - we think it may be a better way for your badges widgets to work and can provide the code changes we made if you would like to take a look at them.

It would be a tad crass for me to ask you to update your plugin to suit our needs, so I won't do that - I just wanted to provide you with the information to see if you think our code changes might be an improvement.

Let me know if you are interested in seeing them.

Issue with Implementation (after editing core)

Hi Noah, I tried your plugin in 4 differents Q2A I have made : http://odlg.org - http://net-on.org - http://mr-ginseng.com and http://www.trentonfl.com - the point is because I have edit some files (not your plugin files) but some core files, badges are not appearing under profile in 2 for 3 of my Q2A, and I don't want to put a backup and lose all my work.

So my question is: do you think I can implement your plugin into the core? or I can add a code in user profiles?

Apache Crashes when Badges merges arrays from custom_badges(); Bookmarks and Comment Voting plugins affected

So here's how to reproduce the crash or error:

  • Install Q2A
  • Install and activate Badges plugin
  • Install Comment Voting plugin
  • Navigate to Admin >> Plugins control panel

I have been trying to debug this for quite some time. The crash seems to be caused when qa_get_badge_list() merges arrays from custom_badges() methods within Bookmarks and Comment Voting plugins or any other implementations of Custom Badges. With some echoing, I could see that qa_get_badge_list() is infinitely and recursively being called when an array_merge() is successful; whereas, if array_merge() never merges anything and $badges only contains the default badges, there will be no errors.

[badges file: qa-plugin.php]

function qa_get_badge_list() {
...
$badges=array_merge($badges,$module->custom_badges());
...
}

[comment voting file: qa-comment-voting-admin.php]

function custom_badges() {
return array(
'nice_comment' => array('var'=>2, 'type'=>0),
'good_comment' => array('var'=>5, 'type'=>1),
'great_comment' => array('var'=>10, 'type'=>2)
);
}

Essentially, if you comment out the 3 array entries (returning an empty array), apache won't crash or throw an error, but obviously, Custom Badges just won't work as promised. It was be really nice to get this working. Thanks.

Table-inside-table on user page

On the user pages the badge table appears inside another table. It looks OK on the default theme but it looks bad on my theme:

badges

Is it possible to put it in its own table, without the wrapper table? And add your own CSS class to the table so we can style it differently if need be?

Error on refresh badges: Undefined index: name, qa-badge-admin.php line 891

I'm receiving three errors each time I refresh badges (with the clear badges first checkbox checked):

Notice: Undefined index: name in C:\apps\question2answer\qa-plugin\q2a-badges\qa-badge-admin.php on line 891

I suspect these errors may be related to a badge plugin I created because I added three new badges and there are three errors that pop up each time. The source code for that badge plugin has been checked into github at q2a-searcher-badges if that helps diagnose the problem.

Small error in readme - must activate plugin for userbadges table to be created

In the installation section of the README.rst file, the instructions are four simple steps:

#. Install Question2Answer_
#. Get the source code for this plugin from github_, either using git_, or downloading directly:

   - To download using git, install git and then type 
     ``git clone git://github.com/NoahY/q2a-badges.git badges``
     at the command prompt (on Linux, Windows is a bit different)
   - To download directly, go to the `project page`_ and click **Download**

#. navigate to your site and check your database to make sure the ^userbadges table was created
#. Go to **Admin -> Plugins** on your q2a install and select the '**Activate badges**' option, then '**Save Changes**'.

Step three has me validating that the userbadges table was created.

In my environment (Windows), the userbadges table was not created until I activated the plugin and save my changes.

Infinite recursion on first plugin activation

copying all my relevant comments from issue#1

Hi, friends.

I've just installed badges plugin from master branch and experiencing the same problem after it activation when trying to open /admin/plugins page. Further more, sometimes PHP process crashes with "memory size 128Mb exhausted" error and some-times it just crashes silently without any errors at all (this time php5-fpm.log says something like WARNING: [pool www] child exited on signal 11 (SIGSEGV)).

Tried to set memory_limit to 256mb or 180mb later, but it didn't help. The only difference is that PHP started to crash with SIGSEGV everytime.

...

Found infinite recursion. The problem is around function qa-plugin.php::qa_badge_name() and it first statement - call to qa_opt(). qa_opt() causes qa_badge_admin::option_default() to be called, which in turn cause a call to qa_badge_name() within case 'badge_'.$slug.'_name'.

...

It looks like the root cause is wrong call to qa_badge_name() in option_default().
Check first case clause within a switch. Call to qa_badge_name('badges/'.$slug); uses different notation than it does usually. I guess, it should be qa_lang('badges/'.$slug); like this:

switch($option) {
    case 'badge_'.$slug.'_name':
        //return qa_badge_name('badges/'.$slug);
        return qa_lang('badges/'.$slug);

It fixes the recursion and works (at least as far as I can see from now).

Badge recalculate button...

When I click it, it's saying 0 badges rewarded.
I'm definitely certain more badges should be rewarded.

I migrated thousands of questions from an old forum database and it's linked to valid users in that database.

It should be gravy!

Who knows...?

Test notification is not closeable

You won't be able to close notification bar after clicking "Test notify" button within a /admin/plugins

This happens because onclick handler is invalid jQuery(this).parent()..slideUp()
Replace it to jQuery(this).parent().parent().slideUp() in qa-badge-layer.php::function trigger_notify($message).

What's the state of Master branch of this plugin? Look like it is extremely unstable, is there a stable well-tested version available?

Watchdog

Hi,
When we submit a reporting we earn watchdog badge, but when we cancel the reporting because of a mistake, the badge remains and is not delete from our account .

User meta not working anymore on version 4.8

The version 4.3 was displaying a weird error at user page similar to

"Notice: Undefined index: who in /.../qa-include/qa-app-format.php(1448) : eval()'d code on line 186"

It was caused by selecting the options #1, #5, #6, #7 in control panel.

The problem was apparently fixed on version 4.8 but I can no longer set that option to display badges on the question page. I've tried several combinations and none of them seem to work. In the previous version it was all about turning on the "user meta" option.

Suggestion for Badge page: Use comma instead BR to list users

Having 400+ users who verified their email address gives a long user list that you have to scroll a lot.

Suggestion: List all users comma separated instead each user on one line.

To do that, change qa-badge-page.php line 103 from:

$qa_content['custom'.$c] .= implode('<br/>',$users).'</div>';

to:

$qa_content['custom'.$c] .= implode(', ',$users).'</div>';

Thanks and merry xmas to all =)

Several badges not awarding correctly

Some of the badges don't appear to be given to the right people. No one on my site appears to be awarded the "Verified Human" badge, but everyone should have their email verified (you need that in order to post).

"Club" badges are wrong also. I set up "1k Club", "10k Club" and "100k Club" with 1,000, 10,000 and 100,000 points respectively. But it's only awarded the first 2 badges to my account, whereas I have 8 members over 10k and 45 users over 1k.

Badge 'liked', 'loved' and 'revered' not awarded automatically (when upvotes received)

Noticed it myself, and now a user pointed out the issue as he did not get the badge.

Settings:
'liked' → 10 up-votes
'loved' → 50 up-votes
'revered' → 100 up-votes

Issue:
A user reaches x upvotes but is not rewarded the 'loved' badge.

Hunting the bug:

  1. I checked the badge parameters in qa_options, everything seems correct.
  2. I checked the user's upvotes, correct, got more than x upvotes.
  3. I checked that badge is not awared yet (badge_slug), correct, empty result in mysql.

Could it be that check_voted($uid) does not get the userid? Somehow it is not triggered automatically... How is it triggered?

Greetings :)
Kai

*PS: If I go to >Admin >Plugins >Badge Plugin and do Recheck Badge Awarding, those badges get rewarded!

Fatal error: memory exhausted

Just installed the badge plugin. I activated the plugin, then selected all badges and saved. Then I clicked "Recheck Badge Awarding" but get a fatal error:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 97 bytes) in /qapath/qa-include/qa-db.php on line 530

I'm guessing it's because I have a pretty huge database right now: nearly 3k users, 7k questions, over 14k answers and 15k comments. I tried ticking only a couple of badges but still get the same error.

Might be worth trying an AJAX style recalculation, like Q2A does with user points. Run a separate AJAX query for each few users or something.

After update, the user area badges area badge names are all messed up

I can't seem to figure out how to put images to these issues forms so I'll copy-paste the text to see if that illustrates the problem. I had just updated the Badges Plugin to resolve an issue with the Comment Voting plugin and its new badges.

This is what it's doing - looks like its messed up the end tags or something - note the addition of "> after the text.

Bronze

questions (Bronze)">Asker x 1
answers (Bronze)">Answerer x 1
comments (Bronze)">Commenter x 1
upvote (Bronze)">Nice Question x 2
upvote (Bronze)">Nice Answer x 2
times (Bronze)">Voter x 1
total upvotes (Bronze)">Liked x 1
answer selected as best answer (Bronze)">Gifted x 1
answer as best answer (Bronze)">Grateful x 1
edit (Bronze)">Editor x 1
questions (Bronze)">Reader x 1
points (Bronze)">100 Club x 1
Photogenic x 1
Autobiographer x 1
badges (Bronze)">Medalist x 1
Silver

times (Silver)">Avid Voter x 1
answers selected as best answer (Silver)">Wise x 1
edits (Silver)">Copy Editor x 1
questions (Silver)">Avid Reader x 1
points (Silver)">1,000 Club x 1
Gold

edits (Gold)">Senior Editor x 1

Badge widget not displaying correctly at two places

Plugin Options:
1- Show badge widget beside points in user meta
(does not show up)
2- Show badge widget beside points in question list
gives an error something like Undefined index: .......qa-include/qa-app-format.php(1466) : eval()'d code - at user profile in recent activity questions.
Also page for badges is not displaying correctly.

I am using latest version of this plugin with Q2A 1.5.4.

Great great plugin but needs fixes.

Thanks

Rechecking badge awarding: Undefined index in /badges/qa-badge-admin.php on line 891

About 600 error messages in my error log, 12:49 am:

Undefined index: name in /badges/qa-badge-admin.php on line 891
Undefined index: website in /badges/qa-badge-admin.php on line 891
Undefined index: location in /badges/qa-badge-admin.php on line 891
Undefined index: about in /badges/qa-badge-admin.php on line 891

Error comes up when doing >Admin >Recheck Badge awarding!

badges-plugin-version: 3.9

Sorting Badges Alphabetically in User Profile

Dear NoahY, could you add a SORT for the badges of each user?

When doing the manual Recheck badge awarding I compare (in one browser window) the newly assigned badges to the "old" version (in another browser window), being on a user's profile page.

I always noticed that the order of badges changes after manual awarding.

Another way to see unsorted badges, open up two different user profiles. Both have the badges sorted differently.

Could we add a mysql sort (alphabetically) to keep the order persistent?

Thank you,
Kai

Badges watchdog, bloodhound, pitbull set to 0 after "Recheck Badge Awarding"

Hi Noah,

Today I have realized that the badges for flagging inappropriate posts (watchdog, bloodhound, pitbull) are set to 0 after I used "Recheck Badge Awarding" in admin panel.

I regularly delete flagged posts, that could be the reason.

I could not see yet, how you count flags / events for flags.

Do you know any solution?

Thanks!
Kai

Undefined variable: oids

I get this notice when viewing a user page. On investigation it's coming from qa-badge-layer.php, around line 440. Notice goes away if you change this:

if(qa_opt('badge_show_source_posts')) {
    $oids = @$info['oid'];
}

to this:

if(qa_opt('badge_show_source_posts')) {
    $oids = @$info['oid'];
}
else
    $oids = null;

Badges page invalid html

It seems there is a bug on the badge page list.

Actually I have fixed it with this nasty patch on line 109 of qa-badge-page.php:

foreach($qa_content as $k => &$v) {
        if(strpos($k,'custom') !== 0)
                continue;
    if (in_array($k, array('custom','custom2')))
        continue;
    $qa_content['custom2'] .= $v;
    unset($qa_content[$k]);
}

$qa_content['custom2'] .='<tr><td class="badge-entry"><span class="total-badges">'.count($badges).' '.qa_lang('badges/badges_total').'</span>'.($totalawarded > 0 ? ', <span class="total-badge-count">'.$totalawarded.' '.qa_lang('badges/awarded_total').'</span>':'').'</td></tr></table>';

Badges plugin v. 4.8 options : when selected do not have any effect

The following options, when selected, do not have any effect :

Show list of source posts for each badge on user profile
Show list of rewarded users for each badge on badge page
Show badge widget beside points in user meta
Show badge widget beside points in question list
Show badge widget beside points for logged in user

The only option that works is :

Show badge widget beside user name on users list page

I'm using q2a 1.6.2 with badges plugin 4.8

Undefined Index after disabling custom badges plugin

I had created a custom badges plugin which added three new badges but with the recent problems with the badges plugin, I disabled it, along with your badges plugin. Only one user (me) had been awarded any of the custom badges I'd created - just the bronze one.

Now, when trying to re-enable the your badges plugin without my badges plugin being installed, I get an undefined index error:

Notice: Undefined index: searcher in C:\apps\question2answer\qa-plugin\q2a-badges\qa-plugin.php on line 163

Line 163 in your badges code is:

function qa_get_badge_type_by_slug($slug) {
    $badges = qa_get_badge_list();
    return qa_get_badge_type($badges[$slug]['type']);

This is obviously because my custom badges plugin isn't installed and its found the one badge that was awarded that was part of that custom badge plugin but shouldn't the code be more robust and not complain that it can't find the badge any longer and just skip over it instead of reporting the error in the output stream?

javascript function badgeEdit(slug,end) on each page - necessary?

On every page - it does not matter if you are logged in or not - in the html source there is the function: function badgeEdit(slug,end)

Maybe we can only output that for admin? ... as the badge edit should be only for admin :)

... or is that the badge notifier? But why is it called badgeEdit then?

Thank you 👍
Kai

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.