Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 05 Apr 2011, 23:00
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Real name: Rob
Quick edit ajax question

I'm stuck here, guys. I have a replacement variable in my sig. When I do a quick edit of the post, after I save it, you can see the variable. When I refresh the page, the variable is parsed like it should be. Is there a hook that deals with the ajax portion of that so it can be parsed without having to refresh the page first?
Reply With Quote
  #2  
Old 14 Apr 2011, 14:33
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Real name: Rob
No one has any ideas on this?
Reply With Quote
  #3  
Old 22 Aug 2012, 14:54
Ziki's Avatar
Ziki Ziki is offline
 
Join Date: Nov 2005
I'd like to know the answer to Boofo's question as well :-/
__________________
My free mods~click here
Reply With Quote
  #4  
Old 22 Aug 2012, 14:59
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Can you have replacement variables in a sig? It sounds like a mod that doesn't completely work right.
Reply With Quote
  #5  
Old 22 Aug 2012, 15:02
Ziki's Avatar
Ziki Ziki is offline
 
Join Date: Nov 2005
I was actually wondering why this doesn't work on postbit_display_complete:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

It should display two boxes beneath the post text, which does fine but after using the quick edit it disappears and I have to refresh.
__________________
My free mods~click here
Reply With Quote
  #6  
Old 22 Aug 2012, 15:15
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Originally Posted by Ziki View Post
I was actually wondering why this doesn't work on postbit_display_complete:

Oh, ok. I think the reason is that $vbulletin and $foruminfo don't seem to be available at that hook. For $vbulletin you can put in a "global $vbulletin" or you can use $this->registry instead. And it looks like you can use $forum instead of $foruminfo.

Last edited by kh99; 22 Aug 2012 at 15:23. Reason: typo in 'registry'
Reply With Quote
  #7  
Old 22 Aug 2012, 15:23
Ziki's Avatar
Ziki Ziki is offline
 
Join Date: Nov 2005
You're right, but that didn't help either, still after quick saving, the box disappears.
__________________
My free mods~click here
Reply With Quote
  #8  
Old 22 Aug 2012, 15:25
Scanu's Avatar
Scanu Scanu is offline
 
Join Date: Nov 2010
Lol guess what i'm asking to myself the same question ahaha
However kevin it seems that the code is working well, the problem is just the when you edit via ajax, i have fields for links and scans just on newthread.php and editpost.php when you click edit post (ajax) as you don't have links fields when you click save it seems to update links with empty values
Reply With Quote
  #9  
Old 22 Aug 2012, 15:38
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Hmm...well, when I save after doing an inline edit, it seems to make 2 calls - one is to ajax.php with do=editorswitch, which seems to allow it to convert the message text based on the editor mode. Then it calls editpost with do=updatepost, and it looks to me like that ends up calling construct_postbit, which should run the postbit_display_complete hook code. I guess I'll have to experiment more to see if code on that hook can actually change the postbit in that situation.
Reply With Quote
  #10  
Old 22 Aug 2012, 15:44
Scanu's Avatar
Scanu Scanu is offline
 
Join Date: Nov 2010
Yes it's a bit difficult, there is only one hook for ajax edit, i serached for other mods and i found this: http://www.vbulletin.org/forum/showthread.php?t=250948 but if you disable redirecting plugins and try to do a quick edit it deletes the link, so he had the same problem. Another mod was this: http://www.vbulletin.org/forum/showthread.php?t=269667. But the ajax thing is a pro feature so nothing to do with it.
Reply With Quote
  #11  
Old 22 Aug 2012, 15:46
Ziki's Avatar
Ziki Ziki is offline
 
Join Date: Nov 2005
Originally Posted by kh99 View Post
Hmm...well, when I save after doing an inline edit, it seems to make 2 calls - one is to ajax.php with do=editorswitch, which seems to allow it to convert the message text based on the editor mode. Then it calls editpost with do=updatepost, and it looks to me like that ends up calling construct_postbit, which should run the postbit_display_complete hook code. I guess I'll have to experiment more to see if code on that hook can actually change the postbit in that situation.
Yes, that is correct, that's why I was baffled when it didn't work :-/
__________________
My free mods~click here
Reply With Quote
  #12  
Old 22 Aug 2012, 15:51
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Originally Posted by Ziki View Post
Yes, that is correct, that's why I was baffled when it didn't work :-/
If you take away your "if" statements and hardcode your $links and $scans, does it work then? (Assuming it's a test forum - you wouldn't want to do that on a live forum of course). I was going to set up that test but it's probably easier for you.
Reply With Quote
  #13  
Old 22 Aug 2012, 15:53
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Originally Posted by Scanu View Post
Yes it's a bit difficult, there is only one hook for ajax edit, i serached for other mods and i found this: http://www.vbulletin.org/forum/showthread.php?t=250948 but if you disable redirecting plugins and try to do a quick edit it deletes the link, so he had the same problem. Another mod was this: http://www.vbulletin.org/forum/showthread.php?t=269667. But the ajax thing is a pro feature so nothing to do with it.
I'm not sure I understand, but if you're working with form fields that exist only when you're creating the post, then yeah, you'd need to save them somewhere so you can have them if the post is being edited (or somehow arrange for them to be submitted when the edited post is submitted, like hidden fields?). Edit: it seems like you'd have the same problem when non-inline editing a post, unless you expect the user to re-enter the info.

Last edited by kh99; 22 Aug 2012 at 16:08.
Reply With Quote
  #14  
Old 22 Aug 2012, 16:59
Scanu's Avatar
Scanu Scanu is offline
 
Join Date: Nov 2010
Well i've added a field to the new thread page then i saved it, after this i can use threadinfo['myfield'] in postbit_display_complete, i added the field to editpost.php too, where you can update this field, until now everything is ok i create a new thread and i put a value to my field and i can see it in the showthread page, if i click edit post and go advanced i can edit this value and it works fine, the problem was adding this field to quickedit so i decided to leave it just on editpost.php but actually if i click edit post and then save it deletes my value, i hope i made myself clear and again, sorry for my english
Reply With Quote
  #15  
Old 22 Aug 2012, 17:07
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Well, I guess I'd have to study the mod to understand it completely. But at hook postbit_display_complete, you should have the thread info in $thread. The difference of course is that that's called when it's displayed instead of when it's saved in the db.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 19:50.

Layout Options | Width: Wide Color: