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

Hi all, just thought people might like to know I have just made some updates to my Edit History plugin. Thanks to JalalJaberi who made a few changes which I have incorporated into my version. Here's a list of the main changes:

  • Fix links to support any Q2A URL structure.
  • Option to control 'ninja' edit time (default 5 minutes same as Q2A).
  • Single Sign-On support (e.g. Wordpress integration).
  • Newly designed revision page that's easier to read.
  • Don't show content if only the title changed.
  • Allow reverting of edits to earlier revision (and option to control permission level).
Each release is now tagged on Github. You can grab v1.4 from here, please let me know what you think!
 
Features for next version: deleting revisions, page displaying recent edits, and allowing silent edits. I'll probably be busy on Q2A core over the next few weeks so may not get to these soon.
by
Nice that you did it, now back to the core. ;-)
by
Nice, thanks : )
by
Wow, this is a huge improvement! Thanks.

3 Answers

+7 votes
by
Very nice Scott. Revert to earlier version is an important and helpful option. Thank you
+2 votes
by

I've been making some changes to the plugin for my website, and I'm trying to transform it into a on-site-notification like plugin using the "Show new incoming events notification". Now I'm trying to get the list to be displayed in the navigation bar, on a div box that will be triggered by the new-events-count. But I still want the history page tho, so I don't want to replace it, I just want to grab the code that  generates the list to display on a div that will be placed on the navbar. What's the code to display the history list? Here's the modification I've done so far:

function userpanel() {
        qa_html_theme_base::userpanel();
        
        $last_visit = qa_db_read_one_value(
                qa_db_query_sub(
                    'SELECT UNIX_TIMESTAMP(meta_value) FROM ^usermeta WHERE user_id=# AND meta_key=$',
                    qa_get_logged_in_userid(), 'visited_profile'
                ),
                true
            );
            if($last_visit) {
                $events = qa_db_read_one_value(
                    qa_db_query_sub(
                        'SELECT COUNT(event) FROM ^eventlog WHERE userid=# AND DATE_SUB(CURDATE(),INTERVAL # DAY) <= datetime AND FROM_UNIXTIME(#) <= datetime AND event LIKE \'in_%\''.(qa_opt('user_act_list_max')?' LIMIT '.(int)qa_opt('user_act_list_max'):''),
                        qa_get_logged_in_userid(), qa_opt('user_act_list_age'), $last_visit
                    )
                );
                if($events) {
                    $tooltip = str_replace('#',$events,qa_opt('user_act_list_new_text'));
                    
                    // pluralizing

                    preg_match('/\S+\/\S+/',qa_opt('user_act_list_new_text'),$voicea);
                    $voices = explode('/',$voicea[0]);
                    foreach ($voices as $voice) {
                        if(!preg_match('/[0-9]/',substr($voice,-1))) {
                            $tooltip = preg_replace('/\S+\/\S+/',$voice, $tooltip);
                            break;
                        }
                        else if((int)substr($voice,-1) >= $events) {
                            $tooltip = preg_replace('/\S+\/\S+/',substr($voice,0,-1),$tooltip);
                            break;
                        }
                    }
                    
                    $this->output(' <a class="qa-history-new-event-link" title="'.$tooltip.'" href="'.qa_path_html('user/'.qa_get_logged_in_handle(), array('tab'=>'history'), qa_opt('site_url')).'" target="_blank"><span class="qa-history-new-event-count">'.$events.'</span></a>');
                } else {
                    $this->output(' <a class="qa-history-event-link" title="zero events" href="'.qa_path_html('user/'.qa_get_logged_in_handle(), array('tab'=>'history'), qa_opt('site_url')).'" target="_blank"><span class="qa-history-no-event-count"> 0 </span></a>');
                }
            }
    }

 

+2 votes
by
Hello, is it working in 1.7.4. version ?

I have errors:

PHP Q2A MySQL query error 1103: Incorrect table name '' - Query: SHOW COLUMNS
FROM `` LIKE '', referer: /admin/plugins?show=28b077856a86253baa707d6e96f146a9

Any ideas how to fix this? :)

Peter
by
I have used in 1.7.4 and even on 1.8. No issues. Are you using the latest version? git log shows

commit da7d264000adb45794412812affbeff2027f14aa
Author: Scott <scott.vivian@gmail.com>
Date:   Thu Jul 30 22:20:04 2015 +0100

    Fix button CSS
...