Thread: Help with mod
View Single Post
  #1  
Old 04-08-2009, 01:25 AM
Ipuck's Avatar
Ipuck Ipuck is offline
 
Join Date: Jun 2006
Location: California
Posts: 131
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Help with mod

Hello

I'm trying to do a mod that replaced the "New Posts" link with "Posts and Threads".

When the link is press, a menu comes down showing 4 other links: New Posts, Today Post, New Threads, Unanswered Threads.

It works manually, but I wanted to share with others here and I wanted to make it a product.

If I upload the product to my site, it loads the template, add the menu to the page, but I cant make automatically replaced the "New Posts" link with "Posts and Threads".

I believe the problem is on the plugin, but I can't find it. I have tried 100 different ways and I can't make it work.

Here is the code:

PHP Code:

<?xml version="1.0" encoding="ISO-8859-1"?>
<product productid="posts_threads_menu" active="1">
    <title>Posts and Threads Navbar Menu</title>
      <description>Replace "New Posts" link with a dropdown menu that shows: New Posts, Today Post, New Threads, Unanswered Threads.</description> 
    <version>1.0</version>
    <versioncheckurl />
    <apm_author>iPuck</apm_author>
    <apm_relatedurl />
    <apm_extraedit />
      <dependencies>
          <dependency dependencytype="vbulletin" minversion="3.8" maxversion="" /> 
      </dependencies>
    <codes>
    </codes>
    <templates>
        <template name="navbar_posts_menu" templatetype="template" date="1223894172" username="iPuck" version="1.0">
<![CDATA[
<if condition="$show['popups'] AND $show['member']">
    <div class="vbmenu_popup" id="postsmenu_menu" style="display:none; margin-top:3px" align="$stylevar[left]">
        <table cellpadding="4" cellspacing="1" border="0">
            <tr><td class="thead">Posts & Threads</td></tr>
            <tr><td class="vbmenu_option"><a href="search.php?$session[sessionurl]do=getnew" accesskey="2">$vbphrase[new_posts_nav]</a></td></tr>
            <tr><td class="vbmenu_option"><a href="search.php?$session[sessionurl]do=getdaily">$vbphrase[todays_posts]</a></td></tr>
            <tr><td class="vbmenu_option"><a href="search.php?do=process&replyless=1&replylimit=100&exclude=0&nocache=0&sortby=threadstart">New Threads</a></td></td></tr>
            <tr><td class="vbmenu_option"><a href="search.php?do=process&replyless=1&replylimit=0&exclude=0&nocache=0">Unanswered Threads</a></td></td></tr>
        </table>
    </div>
</if>
]]>
        </template>
    </templates>
    <plugins>
        <plugin active="1" executionorder="5">
            <title>Posts and Threads Menu</title>
            <hookname>cache_templates</hookname>
            <phpcode>
<![CDATA[global $globaltemplates; $globaltemplates[] = 'navbar_posts_menu';]]>
            </phpcode>
        </plugin>

        <plugin active="1" executionorder="5">
            <title>Posts and Threads Menu</title>
            <hookname>parse_templates</hookname>
            <phpcode>
<![CDATA[$repl =array(
    array(
        '<td class=\"vbmenu_control\"><a href=\"search.php?$session[sessionurl]do=getnew\" accesskey=\"2\">$vbphrase[new_posts_nav]</a></td>',
        '<td id=\"postsmenu\" class=\"vbmenu_control\"><a href=\"search.php" . $GLOBALS[\'vbulletin\']->session->vars[\'sessionurl_q\'] . "\">Posts & Threads</a> <script type=\"text/javascript\"> vbmenu_register(\"postsmenu\"); </script></td>'
        ));
    foreach ($repl as $r)
        {
        $vbulletin->templatecache['navbar'] = str_replace($r[0],$r[1],$vbulletin->templatecache['navbar']);
        }
    unset($repl, $r);
        $vbulletin->templatecache['navbar'] = $vbulletin->templatecache['navbar'].$vbulletin->templatecache['navbar_posts_menu'];
]]>
            </phpcode>
        </plugin>
    </plugins>
    <phrases>
    </phrases>
    <options>
    </options>
    <helptopics>
    </helptopics>
    <cronentries>
    </cronentries>
    <faqentries>
    </faqentries>
</product>
Attached Files
File Type: xml posts_and_threads_prduct.xml (2.8 KB, 2 views)
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01137 seconds
  • Memory Usage 1,819KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_attachment
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete