PDA

View Full Version : Watched threads in menubar


darnoldy
03-31-2015, 05:39 PM
Folks-

I've got Subscribed Threads in Notifications Link (https://vborg.vbsupport.ru/showthread.php?t=250461) 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:

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

Add below:
<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:
<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:
<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:
$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: <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:
<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.

<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:
Warning: Cannot use a scalar value as an array in [path]/search.php on line 2504deactivating the plugin eliminates the error.

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

blind-eddie
04-03-2015, 08:16 AM
I cannot reproduce this error.
Installed on 3.8.8, working fine.
Were you getting this error before making the changes above?

darnoldy
04-03-2015, 04:50 PM
I cannot reproduce this error.I was afraid you'd say something like that!
Were you getting this error before making the changes above?I don't know... I don't specifically remember using the "View all posts by..." between the time I installed the plugin and the time I moved it to global_start. I think I did, but I'm not sure.

I guess I need to do some more investigating... I'll move it back to the hook its intended to use (if I can remember which it is) and see what happens.

--don

blind-eddie
04-03-2015, 06:29 PM
I am not using the code that you posted, I am using what I posted.

I tried to view all post by the user that made a post in one of my subscribed threads, no errors.
I viewed all my post from postbit where the subscribed thread post was made, no errors.

I changed the plugin location to where it was, no errors.

Maybe something else is causing that error.

Try disabling all plugins and turn each back on one by one until you see the error.

I remember the first time I was told that and I had way to many addons installed, it took me a little why until I found my issue.