vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.8 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=235)
-   -   Mini Mods - [Core - FIX] Broken Unsubscribe from forum (https://vborg.vbsupport.ru/showthread.php?t=322313)

Dr.CustUmz 04-05-2016 09:00 PM

[Core - FIX] Broken Unsubscribe from forum
 
1 Attachment(s)
im not too sure how good of a fix this is, i have been up and down the core files, trying to figure this out. Just because it bothered me they include in the default template a condition for this, yet it does not work (by default)

By default when you subscribe to a forum (not a thread) underneath the forum you should see an unsubscribe link
Attachment 154644

This is supposed to happen with the code from:
forumhome_forumbit_level1_post
forumhome_forumbit_level2_post
Code:

<if condition="$show['forumsubscription']"><div class="smallfont"><strong><a href="subscription.php?$session[sessionurl]do=removesubscription&amp;f=$forum[forumid]" rel="nofollow">$vbphrase[unsubscribe_from_this_forum]</a></strong></div></if>
But this code does not work.

I was trying to show images for this using an if / else statement but couldn't for the life of me get it to work.
so hours browsing / searching / asking; I finally find a fix (source: http://tracker.vbulletin.com/browse/VBIV-8931)

in includes/functions_forumlist.php
Find:
Code:

$show['forumsubscription'] = ($subsonly ? true : false);
Replace with:
Code:

$show['forumsubscription'] = !empty($forum['subscribeforumid']);
I was happy for a minute because now the link was showing, but then i realized it doesn't work on forumhome. (why not lvl1 and lvl2 are there, this code should work)

so I searched the core files up and down and I came up with this, which i took from another core file.

in index.php (forumhome)
add:
Code:

cache_ordered_forums(1, 1, $vbulletin->userinfo['userid']);
$show['subscribed_to_forum'] = ($vbulletin->forumcache["$foruminfo[forumid]"]['subscribeforumid'] != '' ? true : false);

below:
Code:

// ######################## START MAIN SCRIPT ############################
im not sure how good of a fix this is, but it works. i have not noticed any ill side effects applying these changes.

I did how ever notice in index.php is
Code:

cache_ordered_forums(1, 1);
and i do not know if the added code will conflict with that, i tried adding just
Code:

$show['subscribed_to_forum'] = ($vbulletin->forumcache["$foruminfo[forumid]"]['subscribeforumid'] != '' ? true : false);
below that, and in other places but it wouldn't work without
Code:

cache_ordered_forums(1, 1, $vbulletin->userinfo['userid']);

Now for an addon!
got the fix applied? well you have to for this.

Attachment 154641

so now if your users are subscribed to a forum they can see an unsubscribe link under the forum title, but hey you've come all this way, lets not keep it ugly.

so in both forumhome_forumbit_level1 & level2_post
find:
Code:

<if condition="$show['forumsubscription']"><div class="smallfont"><strong><a href="subscription.php?$session[sessionurl]do=removesubscription&amp;f=$forum[forumid]" rel="nofollow">$vbphrase[unsubscribe_from_this_forum]</a></strong></div></if>
replace with: (change style and img locations as you see fit)
Code:

<if condition="$show['forumsubscription']">
    <div style="float:right;">
      <a href="subscription.php?$session[sessionurl]do=removesubscription&amp;f=$forum[forumid]" rel="nofollow" title="$vbphrase[unsubscribe_from_this_forum]"><img src="unsubscribe.png" alt="$vbphrase[unsubscribe_from_this_forum]"/></a>
    </div>
  <else />
    <div style="float:right;">
      <a href="subscription.php?$session[sessionurl]do=addsubscription&amp;f=$forum[forumid]" rel="nofollow" title="$vbphrase[subscribe_to_forum]"><img src="subscribe.png" alt="$vbphrase[subscribe_to_forum]"/></a>
    </div>
  </if>

attached are the images in the screenshot.


All times are GMT. The time now is 03:52 PM.

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.00989 seconds
  • Memory Usage 1,723KB
  • 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
  • (10)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (1)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete