[Add-on] AJAX Quick Reply 0.2.0

Viewtopic, viewforum, posting related hacks and MODs.
Viewing topics, forums, or posting add-ons.

How would you rate this mod?

Excellent!
28
70%
Very Good
4
10%
Good
4
10%
Fair
3
8%
Poor
1
3%
 
Total votes : 40

[Add-on] AJAX Quick Reply 0.2.0

Postby Handyman » 15 Apr 2007, 02:35

Classification: Add-on
phpBB Part: Forum

MOD Name: AJAX Quick Reply
MOD Version: 0.2.0
Author: Handyman
MOD Description: Super Quick Post without loading page.

Works with:
  • phpBB 3.0 Beta 5 - < CVS April 13th.

Features:
  • posts without reloading the page

Language: English

Licence: GNU General Public License v2

Installation Level: Easy
Installation Time: 3 Minutes
Format: MODX
Requirements: Simple Quick Reply by Evil3
(note: this mod doesn't work with RC1/RC2 and the new Evil Quick Reply? it will need an update before it works with that)
[b]Download:
ajax_quick_reply.zip
AJAX Quick Reply 0.2.0
(30.63 KiB) Downloaded 4091 times

Screenshots: None needed for this mod

ToDo:
  1. Support Lew21's Quick Reply
  2. Posting review
  3. Redirect user to last page if not browsing last page of topic

Changes in 0.2.0
  1. Changed the way the errors are displayed to look cleaner.
  2. Added missing buttons in subSilver2
  3. Cleaned up code that was causing errors due to a single "&"
  4. Added avatar function to installation instructions for those who want to install this on Beta 5.

Special thanks: to Igor (Evil3) For helping me validate and test this mod.
Also for creating the simple quick reply, which this mod requires? it's a great mod to integrate with :)
Last edited by Handyman on 28 Jun 2007, 19:00, edited 2 times in total.
Reason: Updated to 0.2.0
Please contact me if you have any news to submit to SCOFF News.
SCOFFing at the candidates while you sleep.
My Mods || My Mod Queue
Image
User avatar
Handyman    
Rear Fleet Admiral
Rear Fleet Admiral
 
Posts: 7454
Joined: 08 May 2006, 04:45
Location: Where no man has gone before!
Favorite Team: Seattle Seahawks
Gender: Male


Re: [Add-on] AJAX Quick Reply 0.1.0

Postby sanis » 15 Apr 2007, 07:54

When I post post i got error:
Fatal error: Call to undefined function get_user_avatar() in /home/sanis/domains/stotis.net/public_html/quickposting.php on line 160
sanis
Cadet II
Cadet II
 
Posts: 28
Joined: 08 Mar 2007, 07:19
Gender: Male

Re: [Add-on] AJAX Quick Reply 0.1.0

Postby eviL3 » 15 Apr 2007, 08:16

That was added on the 12.04.2007 :D

Open:
Code: Select all
includes/functions_display.php


Find:
Code: Select all
?>


Before, add:
Code: Select all
/**
* Get user avatar
*
* @param string $avatar Users assigned avatar name
* @param int $avatar_type Type of avatar
* @param string $avatar_width Width of users avatar
* @param string $avatar_height Height of users avatar
* @param string $alt Optional language string for alt tag within image, can be a language key or text
*
* @return string Avatar image
*/
function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $alt = 'USER_AVATAR')
{
   global $user, $config, $phpbb_root_path;

   if (empty($avatar) || !$avatar_type)
   {
      return '';
   }

   $avatar_img = '';

   switch ($avatar_type)
   {
      case AVATAR_UPLOAD:
         $avatar_img = $phpbb_root_path . $config['avatar_path'] . '/';
      break;

      case AVATAR_GALLERY:
         $avatar_img = $phpbb_root_path . $config['avatar_gallery_path'] . '/';
      break;
   }

   $avatar_img .= $avatar;
   return '<img src="' . $avatar_img . '" width="' . $avatar_width . '" height="' . $avatar_height . '" alt="' . ((!empty($user->lang[$alt])) ? $user->lang[$alt] : $alt) . '" />';
}
Image
User avatar
eviL3    
MOD Author
MOD Author
 
Posts: 1002
Joined: 05 Nov 2006, 08:14
Location: Cooking in the MODs kitchen
Gender: Male

Re: [Add-on] AJAX Quick Reply 0.1.0

Postby sanis » 15 Apr 2007, 08:26

eviL3, thanks again :)
I hate beta and CVS :/
sanis
Cadet II
Cadet II
 
Posts: 28
Joined: 08 Mar 2007, 07:19
Gender: Male

Re: [Add-on] AJAX Quick Reply 0.1.0

Postby eviL3 » 15 Apr 2007, 08:48

Okay, i just tested this MOD, and i must say, great work, handyman! :D Very niceley done!

I'll give you some feedback, hope you don't mind ;)

Install file:
You should have the stuff indented fully :P (picky me):
Code: Select all
$ajax = false;
   if ($user->data['user_id'] != ANONYMOUS && $user->data['user_type'] != USER_INACTIVE && $user->data['user_type'] != USER_IGNORE)
   {
      $s_action = 'javascript:void(0);';
      $ajax = ' onsubmit="get(this);" name="postform"';
   }

Could be:
Code: Select all
   $ajax = false;
   if ($user->data['user_id'] != ANONYMOUS && $user->data['user_type'] != USER_INACTIVE && $user->data['user_type'] != USER_IGNORE)
   {
      $s_action = 'javascript:void(0);';
      $ajax = ' onsubmit="get(this);" name="postform"';
   }


Same goes for the edit after that ;)

I don't think this is allowed, i suggest you have separate actions for sub- and prosilver.
Code: Select all
Open: styles/*/template/viewtopic_body.html


For the edit in styles/*/template/posting_qr_body.html i suggest you use inline actions.

Then, when submitting a new post, i get this:
Code: Select all
Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. in C:\Program Files\server\apache\htdocs\phpbb\phpBB3\quickposting.php on line 115

Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. in C:\Program Files\server\apache\htdocs\phpbb\phpBB3\quickposting.php on line 115


This is because my php.ini is a little strictly configured (may also just be PHP5, i don't know). Well, all i can say is that variables should not be passed by reference when calling a function:
Code: Select all
submit_post('reply', $subject, $user->data['username'], $topicrow['topic_type'], &$poll, &$data, $update_message = true);


Should be:
Code: Select all
submit_post('reply', $subject, $user->data['username'], $topicrow['topic_type'], $poll, $data, $update_message = true);


Another wierd thing that i noticed is that you didn't handle multiple pages. I went to a topic with 2 pages, added a quick reply on the first page. It added the reply on the first page (without reloading). So you need to add some kind of check, to see if the user is on the last page, and if the reply goes onto a new page, and if that is the case, redirect them with javascript (or PHP, if you find some great way to do it :D).

And in quickposting.php, there's this:
Code: Select all
if (!$auth->acl_get('f_reply', $forum_id) || !$user->data['is_registered'])
{
   if ($user->data['is_registered'])
   {
      trigger_error('USER_CANNOT_REPLY');
   }
   login_box('', $user->lang['LOGIN_EXPLAIN_REPLY']);
}

if ($config['flood_interval'] && !$auth->acl_get('f_ignoreflood', $forum_id))
{
   // Flood check
   $last_post_time = $user->data['user_lastpost_time'];
   if (($current_time - $last_post_time) < intval($config['flood_interval']))
   {
      trigger_error('FLOOD_ERROR');
   }
}


Which can result in:
Image

Okay, i think that's all. Great work! Other than what i meantioned, the MOD works perfectly :thumbsup: Great work!
Image
User avatar
eviL3    
MOD Author
MOD Author
 
Posts: 1002
Joined: 05 Nov 2006, 08:14
Location: Cooking in the MODs kitchen
Gender: Male

Re: [Add-on] AJAX Quick Reply 0.1.0

Postby Kjell » 15 Apr 2007, 14:25

sanis wrote:eviL3, thanks again :)
I hate beta and CVS :/

I must be stupid, but it is a phpBB3 beta..... :blackeye:
Kjelle
My work - My farm - Ware I live - phpBB support Sweden
"The globe is round, think global", My rules: Be teased is okay on a funny way ;)
User avatar
Kjell    
Supporter
Supporter
 
Posts: 490
Joined: 14 Feb 2007, 13:09
Location: Nordic of Sweden
Favorite Team: NHL N-ville,Forsberg
Gender: Male
phpBB Knowledge: 8

Re: [Add-on] AJAX Quick Reply 0.1.0

Postby Sniper_E » 15 Apr 2007, 15:24

I downloaded this and wanted to check it out. But in the install direction this section points to a file I can't find.
Code: Select all
OPEN 
includes
/functions_quick_reply.php

Find 
(This is only a partial findthe actual line is longer)
$s_action 

AFTERADD
if ($user->data['user_id'] != ANONYMOUS && $user->data['user_type'] != USER_INACTIVE && $user->data['user_type'] != USER_IGNORE)
{
    
$s_action append_sid("{$phpbb_root_path}quickposting.$phpEx"falsetrue$user->session_id);
}
I'm at a stand still until I can find this file. Please Respond Immediately, you know how impatient we all are. :lol:
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!
User avatar
Sniper_E    
STG Jedi Master
STG Jedi Master
 
Posts: 6981
Joined: 31 May 2006, 06:29
Location: Shreveport, LA
Favorite Team: The STG Team
Gender: Male
phpBB Knowledge: 6

Re: [Add-on] AJAX Quick Reply 0.1.0

Postby eviL3 » 15 Apr 2007, 15:46

Check the requirements in the first post ;)
Image
User avatar
eviL3    
MOD Author
MOD Author
 
Posts: 1002
Joined: 05 Nov 2006, 08:14
Location: Cooking in the MODs kitchen
Gender: Male

Re: [Add-on] AJAX Quick Reply 0.1.0

Postby Highway of Life » 15 Apr 2007, 16:26

I should emphasize that the latest CVS is required for this Quick Reply to work properly.

You can obtain a CVS Snapshot by going to http://area51.phpbb.com/cvs

If you attempt to install this with Beta5, you?re going to end up dealing with a lot of problems, which can be avoided by using the CVS.
Remember, phpBB3 is still in the testing phase, so the CVS/Beta is required at this point.

Kjell, cook avatar! :good:
Watch out! I might do a code wheelie!

User avatar
Highway of Life    
STG Jedi Master
STG Jedi Master
 
Posts: 10458
Joined: 08 May 2006, 05:23
Location: Beware of Programmers carrying screwdrivers
Gender: Male
phpBB Knowledge: 10

Re: [Add-on] AJAX Quick Reply 0.1.0

Postby Sniper_E » 15 Apr 2007, 18:39

OK, I may have to wait and update before I play with that.... but I did the first part already and installed Simple Quick Reply by Evil3
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!
User avatar
Sniper_E    
STG Jedi Master
STG Jedi Master
 
Posts: 6981
Joined: 31 May 2006, 06:29
Location: Shreveport, LA
Favorite Team: The STG Team
Gender: Male
phpBB Knowledge: 6

Next

Return to Topic, Forum, Posting MOD Downloads

Who is online

Users browsing this forum: No registered users and 3 guests

cron