vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Watched threads in menubar (https://vborg.vbsupport.ru/showthread.php?t=318070)

darnoldy 03-31-2015 05:39 PM

Watched threads in menubar
 
Folks-

I've got Subscribed Threads in Notifications Link installed, and it works fine.

However, I've decided to eliminate friends and private messages entirely... which leaves subscribed threads as the only notification. I'd like to just put it directly into the menubar.

So, can i just change the hook location for the plugin (and to which)—or do I need to do something else?

Thanks!

--don

blind-eddie 04-01-2015 02:25 AM

Hello Don,
The first thing you need to do is change the plugin hook location to global_start

Save

Then in your navbar template

Find:

Code:

                <phrase 1="$pmbox[lastvisitdate]" 2="$pmbox[lastvisittime]">$vbphrase[last_visited_x_at_y]</phrase>
Add below:
Code:

<br />
                  <a href="subscription.php">$vbphrase[new_subscribed_threads]</a> <strong>$new_subscribed_threads</strong>

Save

darnoldy 04-01-2015 02:07 PM

Thanks, Tim!

I'll move the plugin to global start... but there's something missing from the template edit you suggested.

Currently, I have:
HTML Code:

      <span  id="notifications_menu">
        <a rel="nofollow" href="usercp.php$session[sessionurl_q]" id="notifications">
          <if condition="$notifications_total>0">
            <span class="icon">&commat;</span><span class="word">Notifications</span><span id="notifications_number">$notifications_total</span>
          <else />
            <span class="icon" style="color:#deccb5;">&commat;</span><span class="word" style="color:#deccb5;">Notifications</span>
          </if>
        </a>
        <!-- notifications menu -->
        <div class="dropdown">
          $notifications_menubits
        </div>
        <!-- / notifications menu -->

      </span>

in the navbar template, and:
HTML Code:

<a href="$notification[link]"<if condition="$notification['total'] > 0"> style="font-weight:bold"</if> class="menu_item"><span class="padder">$notification[phrase] ($notification[total])</span></a>
in the navbar_notifications_menubit template.

The plugin seems to be passing variable here:
PHP Code:

 $vbulletin->userinfo['adam_subsct_count'] = $new_subscribed_threads

     
$notifications['adam_subsct_count'] = array( 
        
'phrase' => $vbphrase['new_subscribed_threads'], 
        
'link'   => $vbulletin->options['bburl'] . '/subscription.php?do=viewsubscription&daysprune=-1&folderid=all'
        
'order'  => 50 
    
); 

I tried:
HTML Code:

        <a rel="nofollow" href="usercp.php$session[sessionurl_q]" id="notifications">
          <if condition="$userinfo[adam_subsct_count]>0">
            <span class="icon">&commat;</span><span class="word">$vbphrase[new_subscribed_threads]</span><span id="notifications_number">$userinfo[adam_subsct_count]</span>
          <else />
            <span class="icon" style="color:#deccb5;">&commat;</span><span class="word" style="color:#deccb5;">$vbphrase[new_subscribed_threads]</span>
          </if>

The phrase works fine, but the subscription count seems to be empty. Is it a syntax error in my template edit, or something else?

--don

blind-eddie 04-01-2015 02:38 PM

Hey Don,
I was under the impression you were removing that code and were no longer using the notification dropdown.
What I posted works perfectly on my 3.8.8 site.
It will show zero if there are no replies.

darnoldy 04-01-2015 02:44 PM

I am removing the dropdown!

What I can't do, at this point, is get the number of new watched threads to display (or work within the conditional). I'm sure its something I'm doing wrong.

A thought: The value I want is displayed on the subscribed threads section of the UserCP template, in the variable $numthreads. Might I be better off ditching this plugin and getting a simpler one that just fetches this value?

--don

blind-eddie 04-01-2015 03:00 PM

It works just as it did when it was in the drop down but you always see it now at zero until one of your subscribed threads are replied on.
I may be able to hide the whole thing until a reply has been posted.
When I get home, I will see what I can do.

darnoldy 04-01-2015 03:44 PM

Got it working!

I was using the wrong variable for the count.

Thanks for your help.

Here's what works:
HTML Code:

        <a rel="nofollow" href="usercp.php$session[sessionurl_q]" id="notifications">
          <if condition="$new_subscribed_threads>0">
            <span class="icon">&commat;</span><span class="word">$vbphrase[new_subscribed_threads]</span><span id="notifications_number">$new_subscribed_threads</span>
          <else />
            <span class="icon" style="color:#deccb5;">&commat;</span><span class="word" style="color:#deccb5;">$vbphrase[new_subscribed_threads]</span>
          </if>
        </a>


blind-eddie 04-01-2015 04:36 PM

Why have it show at all, why not show it when new replies to subscribed threads are posted.

I now have this.

Code:

<br />
          <if condition="$new_subscribed_threads>0">
                  <a href="usercp.php">$vbphrase[new_subscribed_threads]</a> <span style="color:#FFA5A5;"><strong>$new_subscribed_threads</strong></span></if>


darnoldy 04-01-2015 04:50 PM

I dunno... I guess there is no real reason to show it if there are no new posts.

darnoldy 04-03-2015 02:05 AM

Okay... weird side-effect—
When I use the "Find all posts by..." link in the postbit, It displays the posts, but displays the following error message:
Code:

Warning: Cannot use a scalar value as an array in [path]/search.php on line 2504
deactivating the plugin eliminates the error.

I don't know why this interacts with search.php. Any ideas, folks?


All times are GMT. The time now is 11:35 AM.

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.01046 seconds
  • Memory Usage 1,756KB
  • 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_code_printable
  • (4)bbcode_html_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)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