Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Add-ons

Reply
 
Thread Tools
[developers] Custom datastore support for products Details »»
[developers] Custom datastore support for products
Version: 1.0.0a, by Brad Brad is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Version: 3.5.3 Rating:
Released: 02-09-2006 Last Update: 02-10-2006 Installs: 6
DB Changes Uses Plugins
Re-useable Code Code Changes Additional Files Translations  
No support by the author.

[high]Custom datastore support for products[/high]

Author: Andreas
Maintained By: Brad

This modification is an attempt to make adding datastore items to plug-ins and products easier on both the end users and modification authors.

The problem we hope to solve

The plug-in system relies on the datastore to function, this means we can not use datastore items unless they are called by vBulletin by default. The only work around for it is hacking the files. Due to this many hack authors have resorted to hacking the files in their own ways to load custom datastore items.

How we have currently 'solved' the problem

There is no way around hacking the files, so this hack does the next best thing. Only one file edit is required, and that is at the very end of ./includes/config.php

On the admincp side there is a new page in the plug-in manager. The 'Datastore Item Manager' allows you to map certain datastore items to a product, and restrict what area of the board it will be loaded on (The Forum, Admin cp, Mod cp, or Archive) and what script it will be loaded on (index, showthread, newreply, online etc. etc.). All of this is done to avoid extra overhead that would be caused by fetching data from the datastore that is not required for certain pages.

Once you've mapped your datastore items you can export a product like you normally would, it will include all the info needed to fetch the datastore items for you.

This is a community developed project

As this is something that will hopefully be used by a large number of developers here I encourage you all to assist us in developing this hack. There are a few guidelines to what you can do however:

1) Do not break old product files. - for example if version 1.1 of this hack is released, products made using version 1.0 should still work on the new version. I understand this may be impossible to do if something big needs to be changed down the line, but don't go out of your way to break the thing.
2) Try to keep all development discussion in this thread.
3) Do not re-distribute this code without the author's permission outside of this thread (The author is Andreas). There is however some leeway to this rule, given the nature of this hack.
4) You are allowed and encouraged to include the files/instructions required for the 'end user' install in your own hacks zip file. This will not only make it easier on the end user but it will keep general support questions out of this thread.
5) Try to have fun with it!

Hack alters/adds:

1 SQL Query (global)
1 New Table to the Database
1 File edit to ./includes/config.php

Installation instructions - Developers
  1. Download the zip file: ds4p[dev][1.0.0].zip
  2. Upload productrequirement.php to ./vbroot/admincp/
  3. Upload class_datastore_pluginsupport.php to ./vbroot/includes/
  4. Upload cpnav_ds4p.xml to ./vbroot/includes/xml/
  5. Import the product (product-ds4p.xml) via the admin cp
  6. Edit the file ./vbroot/includes/config.php

    Find:

    PHP Code:
    ?> 
    Above that add:

    PHP Code:
    require_once(CWD '/includes/class_datastore_pluginsupport.php'); 

Using the hack

In the Admin CP you'll find a new link in the left nav frame, under the Plugin System section click 'Datastore Item Manager'. On this page you'll find a link to add a new datastore item.

You should be familiar with this but here is a quick overview of what is on the add datastore item page:

Product: The product you want to associate the datastore item with.
Script: Allows you to select which php file the item will be included on. For example if your code only needs to run on member.php then you would select 'member' from the drop down.
Site Area: Similar to Script, but only restricts loading to a certain section of the software (forum, admincp, modcp, and archive).
Datastore Item: The name of the datastore item you want to fetch.

Once you have your datastore item set-up, you can get to the item in a plug-in like so:

PHP Code:
$vbulletin->datastore->do_fetch('custom_item'); 
From here it's the normal routine, export the product and you're done.

Installation instructions - End Users
  1. Download the zip file: ds4p[dev][1.0.0].zip
  2. Upload class_datastore_pluginsupport.php to ./vbroot/includes/
  3. Import the product (product-ds4p.xml) via the admin cp
  4. Edit the file ./vbroot/includes/config.php

    Find:

    PHP Code:
    ?> 
    Above that add:

    PHP Code:
    require_once(CWD '/includes/class_datastore_pluginsupport.php'); 

At this point the end user is done, he just imports your product like he normally would.

Big Thanks To:

Andreas - taking the time to write this php code and allowing me to release it.
MarcoH64 - for addressing the problem, sparking community interests in the problem and witting POC code.

Supporters / CoAuthors

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 02-10-2006, 01:05 AM
Blaine0002's Avatar
Blaine0002 Blaine0002 is offline
 
Join Date: Jul 2003
Location: Wisconsin.
Posts: 1,350
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice! first post!
Reply With Quote
  #3  
Old 02-10-2006, 02:15 AM
The Chief's Avatar
The Chief The Chief is offline
 
Join Date: Aug 2005
Location: Montreal
Posts: 1,037
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hope this helps all the mods out there
Reply With Quote
  #4  
Old 02-10-2006, 02:44 AM
Brad Brad is offline
 
Join Date: Nov 2001
Posts: 4,765
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Small update.

If you installed this modification before I made this post be aware that I have released a new version dubbed 1.0.0a.

This was a minor update that fixed a bug when adding new datastore items, instead of redirecting the user to the correct page they would get stuck.

To upgrade, Upload productrequirement.php to ./vbroot/admincp/ and import the new product.xml file.
Reply With Quote
  #5  
Old 02-10-2006, 11:14 AM
Barakat's Avatar
Barakat Barakat is offline
 
Join Date: Nov 2004
Location: Jerusalem
Posts: 571
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i tried to upload the xml file but its telling me "XML Error: unknown at Line 0 "
Reply With Quote
  #6  
Old 02-10-2006, 11:34 AM
Developer's Avatar
Developer Developer is offline
 
Join Date: Sep 2005
Location: EgYpT
Posts: 662
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

oh nice mod i like it and gonna install it tonight especially for me
Reply With Quote
  #7  
Old 02-10-2006, 11:58 AM
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Location: PA
Posts: 4,438
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for doing this guys. When I get a chance, I'll start playing with it.
Reply With Quote
  #8  
Old 02-10-2006, 01:16 PM
Snake's Avatar
Snake Snake is offline
 
Join Date: Mar 2005
Location: Cleveland, OH
Posts: 3,832
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Brad, thank you very much for the hack. ^_^
Reply With Quote
  #9  
Old 02-10-2006, 08:25 PM
Brad Brad is offline
 
Join Date: Nov 2001
Posts: 4,765
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Barakat
i tried to upload the xml file but its telling me "XML Error: unknown at Line 0 "
Are you sure you uploaded the correct .xml? Maybe you tried to import the .xml for the nav panel in the admin cp?
Reply With Quote
  #10  
Old 02-10-2006, 09:31 PM
Barakat's Avatar
Barakat Barakat is offline
 
Join Date: Nov 2004
Location: Jerusalem
Posts: 571
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

its the xml file which i upload . !!! not the ather one in the admin cp .

see the attachments ?
Reply With Quote
Reply

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

Forum Jump


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


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07017 seconds
  • Memory Usage 2,302KB
  • Queries Executed 24 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (5)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete