vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Quick edit ajax question (https://vborg.vbsupport.ru/showthread.php?t=261495)

Ziki 08-22-2012 12:46 PM

Quote:

Originally Posted by kh99 (Post 2359011)
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 :-/

kh99 08-22-2012 12:51 PM

Quote:

Originally Posted by Ziki (Post 2359014)
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.

kh99 08-22-2012 12:53 PM

Quote:

Originally Posted by Scanu (Post 2359013)
Yes it's a bit difficult, there is only one hook for ajax edit, i serached for other mods and i found this: https://vborg.vbsupport.ru/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: https://vborg.vbsupport.ru/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.

Scanu 08-22-2012 01:59 PM

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

kh99 08-22-2012 02:07 PM

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.

Scanu 08-22-2012 02:32 PM

Ok i will try to add global $vbulletin and $thread instead of $threadinfo

Ziki 08-22-2012 02:37 PM

Quote:

Originally Posted by kh99 (Post 2359015)
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.

Nah it works fine, when the code is in postbit_display_complete and the thread is loaded the boxes show up, they just disappear for some reason after saving quick edit. I looked at the code I think postbit_display_complete should be called somewhere around that part, just not sure why it's not working.

kh99 08-22-2012 02:46 PM

Well, something's got to be different during the edit. I'll play around and see if I can figure out anything.

Ziki 08-22-2012 02:51 PM

It somehow must go through inlinemod.php as well I think

kh99 08-22-2012 03:03 PM

Oh well, I'm already stumped. I added a variable to the postbit_legacy template and used preRegister to set the value in a plugin on postbit_display_complete using values from $vbulletin and $forum, and it works even if I inline edit.


All times are GMT. The time now is 06:51 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01566 seconds
  • Memory Usage 1,739KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete