Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
  #16  
Old 21 Jul 2010, 09:13
philwareham philwareham is offline
 
Join Date: Jun 2010
Ah OK thanks, I'll change all occurrences of 'global_start' to 'global_bootstrap_init_start' to futureproof the hooks.
Reply With Quote
  #17  
Old 21 Jul 2010, 13:16
Triky's Avatar
Triky Triky is offline
 
Join Date: Mar 2007
Location: [Italy]
I was having problems both with the hook and the PHP code of the plugin. This is the correct code:


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

Thank you!
__________________
I'm italian, I am learning english.. so, please, if you see any errors in my grammar or spelling, let me know via PM. Danke!
Reply With Quote
  #18  
Old 06 Oct 2010, 19:49
southie southie is offline
 
Join Date: Jul 2009
i am having the same issue, did you ever find a solution to this problem Centrix ? or anybody else who could help ?

Originally Posted by Centrix View Post
I tried this, but it made my forum crash miserably. I had to restore a database backup in order for it to work again.



I made a custom template and I dont know which hook location to use for this...? if I use global start my site and forum (site is linked to the forums) is just the contents of the php file im trying to include.
Reply With Quote
  #19  
Old 09 Oct 2010, 01:54
webmaster74 webmaster74 is offline
 
Join Date: Mar 2007
Originally Posted by Crimm View Post
vB_Template::preRegister('TEMPLATE YOU ARE USING',array('php_include' => $php_include));[/code]

Step 2: You will have to figure out these two entries for yourself: LOCATION OF EXTERNAL FILE & Hook Location

To give you an example of what you should use is that if you want to display your external PHP file on your Forum's Home. Then replace these two with these values:

Hook Location with forumhome_start
TEMPLATE YOU ARE USING with FORUMHOME
I created this plug-in and activated it.

ob_start();
include('/home/mydomain/public_html/php/includes/ineverypost.inc.php');
$includedineverypost = ob_get_contents();
ob_end_clean();


vB_Template::preRegister('postbit_display_complete',array('includedineverypost' => $includedineverypost));

in vb 3.8.6, this was hooked to 'postbit_display_complete'

Now with VB4, there is no template for post_display_complete....

I tried "postbit" it did notwork. I tried other postbit related templates, this still did not work.

any help ??
__________________
the vbulletin script is way too expensive for the support you get.....

Last edited by webmaster74; 09 Oct 2010 at 09:44.
Reply With Quote
  #20  
Old 19 Nov 2010, 19:23
hihello hihello is offline
 
Join Date: Nov 2010
The included page shows up but it's showing on every page. I used the parse_template hook. Do I need to include anything else to only show one a specific page?
Reply With Quote
  #21  
Old 10 Dec 2010, 11:51
webmaster74 webmaster74 is offline
 
Join Date: Mar 2007
Originally Posted by webmaster74 View Post
I created this plug-in and activated it.

ob_start();
include('/home/mydomain/public_html/php/includes/ineverypost.inc.php');
$includedineverypost = ob_get_contents();
ob_end_clean();


vB_Template::preRegister('postbit_display_complete',array('includedineverypost' => $includedineverypost));

in vb 3.8.6, this was hooked to 'postbit_display_complete'

Now with VB4, there is no template for post_display_complete....

I tried "postbit" it did notwork. I tried other postbit related templates, this still did not work.

any help ??

any generous person wants to share his knowledge ?

--------------- Added 11 Dec 2010 at 03:23 ---------------

would any kind person help with this ?
__________________
the vbulletin script is way too expensive for the support you get.....

Last edited by webmaster74; 11 Dec 2010 at 01:23. Reason: Auto-Merged DoublePost
Reply With Quote
  #22  
Old 22 Dec 2010, 02:32
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
 
Join Date: Jun 2008
Real name: Joe D.
postbit_display_complete is a php code hook... not a template... the template is named postbit and it's the same in VB3 and VB4.
__________________
-Joe
Former vBulletin.org Staff Member

(@BirdOPrey5) Former vb.org Moderator. Fighting for a free & independent vb.org.
BirdOPrey5.com - Exclusive VB Mods! (Formerly Qapla.com) | Joe's Ultimate Off Topic
Note - I do not read my PMs often, do not expect quick replies.
Reply With Quote
  #23  
Old 22 Dec 2010, 14:15
fluidswork's Avatar
fluidswork fluidswork is offline
 
Join Date: Apr 2010
Real name: Arnab Bhadra
Nice idea i will give this a try ..........
Reply With Quote
  #24  
Old 22 Dec 2010, 15:24
aileron79 aileron79 is offline
 
Join Date: Apr 2009
Which hook to use in online.php?

Hi everybody,
sorry in advance for me maybe talking rubbish, but I am completely new to developing plugin code for vbulletin. I am quite experienced in coding PHP, though. Boofo pointed me in the right direction (thanks for that), but, however, I am still facing the following problem:

I want to extend the list of online users (online.php) by another column. Information within that column is not extracted from the database but fetched from a third party. This has to be done for each user that shows up in the list of online users - but I have no idea which hook I may use.

At the moment, my plugin works pretty fine - but it is a bad mixture of source code hacking and template modifications. If any future upgrade replaces online.php, all my changes are gone. I added a very few lines of code in online.php (v4.1.0 PL2) starting from line 414, which basically adds another value to the $userinfo array which (as if this variable is registered) can be accessed from the whoisonlinebit template, where the output is generated from the additional value.

As mentioned before - so far, everything works fine but I truly hate source code modifications as they are gone after an update. Therefore, it would be great to know if there is another way of executing code (maybe in an external file) for each line in the result set. If I interpret the PHP source in online.php correctly, anything that should be executed for each user name should go inside the while loop on line 393. The instructions above explain how to use external files with hooks but I just can't figure out which hook to use in that case...

Is there a way to execute PHP code from templates without having a hook?

As I said, I am completely new to this stuff, please help...
Reply With Quote
  #25  
Old 22 Dec 2010, 16:38
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
 
Join Date: Jun 2008
Real name: Joe D.
There's a hook at the very end of the while loop:

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

So if you can use that hook, "online_user."
__________________
-Joe
Former vBulletin.org Staff Member

(@BirdOPrey5) Former vb.org Moderator. Fighting for a free & independent vb.org.
BirdOPrey5.com - Exclusive VB Mods! (Formerly Qapla.com) | Joe's Ultimate Off Topic
Note - I do not read my PMs often, do not expect quick replies.
Reply With Quote
  #26  
Old 22 Dec 2010, 17:33
aileron79 aileron79 is offline
 
Join Date: Apr 2009
Indeed, I have found that hook and I thought it would be what I was looking for, but obviously this hook only affects spiders/guests, according to the comment on line 449:


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

The hook is inside the else branch which obviously handles unregistered users, the code I have added is in the if branch... Did I misinterpret anything...?
Reply With Quote
  #27  
Old 22 Dec 2010, 17:49
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
 
Join Date: Jun 2008
Real name: Joe D.
Probably not... although it's of no use when releasing a mod to others you can add your own hooks to the code anywhere you want- so if it's just for you adding a 1 line hook and keeping the bulk of the code in a plugin will make life easier than keeping all edits in the files.
__________________
-Joe
Former vBulletin.org Staff Member

(@BirdOPrey5) Former vb.org Moderator. Fighting for a free & independent vb.org.
BirdOPrey5.com - Exclusive VB Mods! (Formerly Qapla.com) | Joe's Ultimate Off Topic
Note - I do not read my PMs often, do not expect quick replies.
Reply With Quote
  #28  
Old 22 Dec 2010, 21:48
aileron79 aileron79 is offline
 
Join Date: Apr 2009
Thanks for replying to fast! Well, that of course would be possible and still, this is probably the best idea. I still could add instructions on how to create the custom hook in my install guide. However, I consider this hook a bug... I just can't believe it makes any sense in that position. But as mentioned before, I am quite new to this plugin system, probably I just do not understand enough...

But am I right that there is no way to achieve what I want without modifying the original vb source code?
Reply With Quote
  #29  
Old 23 Dec 2010, 00:20
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
 
Join Date: Jun 2008
Real name: Joe D.
Originally Posted by aileron79 View Post
But am I right that there is no way to achieve what I want without modifying the original vb source code?
Best I can tell if you really need that location you would have to manually edit the source code but I'm far from an 'expert' on this topic myself.

However if you're fetching data from an external source could you not just "run the loop" a second time and collect the data needed per user id, and put the data in an array who's keys are the userid's themselves so it's say $mydata[1] for userid 1, $mydata[200] for user 200, etc... then call it in the template where needed (after pre-registering it of course.)
__________________
-Joe
Former vBulletin.org Staff Member

(@BirdOPrey5) Former vb.org Moderator. Fighting for a free & independent vb.org.
BirdOPrey5.com - Exclusive VB Mods! (Formerly Qapla.com) | Joe's Ultimate Off Topic
Note - I do not read my PMs often, do not expect quick replies.
Reply With Quote
  #30  
Old 30 Dec 2010, 13:43
robert garrett robert garrett is offline
 
Join Date: Mar 2010

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

tried also leaving custom_ out this is not working at all.

global bootstrap init start, is the hook I am using. I had some bugs in the code when I first included it, and it showed up as I worked the bugs out, and the code ran clean, it made it through the hook. Thats great. I clicked on the tab, that is linked to the template I added it to, and it just wont display Ideas anybody?

RG
Reply With Quote
Reply



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

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 17:21.

Layout Options | Width: Wide Color: