Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 08-16-2010, 06:22 PM
AfterWorldForum AfterWorldForum is offline
 
Join Date: Dec 2008
Posts: 154
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by SecondV View Post
Looking at your code, in the foreach loop you may want to change:

PHP Code:
$optoutforumbits $templater->render(); 
To:
PHP Code:
$optoutforumbits .= $templater->render(); 
Ack. I initially had that.

Changed and tested, but still a surprising lack of the control in my options.

I just do not get it. To the best of my knowledge, this should be doing the trick. All articles I read here and all the advice I had seems to suggest this ought to work, but it does not. Very odd, indeed.

I might try and start from scratch with a new plugin and work my way up from there.
Reply With Quote
  #12  
Old 08-16-2010, 09:49 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Why don't you post the exact code you are using right now so we can try it out on our own test sites and see what is up.
Reply With Quote
  #13  
Old 08-17-2010, 03:10 PM
AfterWorldForum AfterWorldForum is offline
 
Join Date: Dec 2008
Posts: 154
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Lynne,

Sure.

Here's the code from the plugin:

Code:
function fetch_optout_forumids_array($parentid = -1, $depthmark = '')
{
	global $optoutforumids, $vbulletin;
	static $indexed_forum_cache;

	if ($parentid == -1)
	{
		$optoutforumids = array();
		$indexed_forum_cache = array();
		foreach ($vbulletin->forumcache AS $forumid => $forum)
		{
			$indexed_forum_cache["$forum[parentid]"]["$forumid"] =& $vbulletin->forumcache["$forumid"];
		}
	}

	if (is_array($indexed_forum_cache["$parentid"]))
	{
		foreach ($indexed_forum_cache["$parentid"] AS $forumid => $forum)
		{
			$forumperms =& $bbuserinfo['forumpermissions']["$forumid"];
			if ($forum['displayorder'] != 0
				AND ($forumperms & $vbulletin->bf_ugp_forumpermissions['canview'])
				AND ($forumperms & $vbulletin->bf_ugp_forumpermissions['cansearch'])
				AND ($forumperms & $vbulletin->bf_ugp_forumpermissions['canoptoutgnp'])
				AND ($forum['options'] & $vbulletin->bf_misc_forumoptions['active'])
				AND verify_forum_password($forum['forumid'], $forum['password'], false)
			)
			{
				$vbulletin->forumcache["$forumid"]['depthmark'] = $depthmark;
				$optoutforumids[] = $forumid;
				fetch_optout_forumids_array($forumid, $depthmark . FORUM_PREPEND);
			}
		}
	}
} 	
fetch_optout_forumids_array();
$optoutforumbits = '';
$haveforum = false;
$gnpoptoutforums = explode(',', $bbuserinfo['excludeforumsgnp']);

foreach ($optoutforumids AS $forumid)
{
	$forum =& $vbulletin->forumcache["$forumid"];

	if (trim($forum['link']))
	{
		continue;
	}

	$optionvalue = $forumid;
	$optiontitle = "$forum[depthmark] $forum[title_clean]";
	$optionclass = 'fjdpth' . (($forum['depth'] > 4) ? '4' : $forum['depth']);

	if (in_array($forumid, $gnpoptoutforums))
	{
		$optionselected = 'selected="selected"';
		$haveforum = true;
	}
	else
	{
		$optionselected = '';
	}

	$templater = vB_Template::create('mytemplate');
	$templater->register('optionvalue', $optionvalue);
	$templater->register('optiontitle', $optiontitle);
	$templater->register('optionclass', $optionclass);
	$templater->register('optionselected', $optionselected);
	$templater->register('show', $show);
$optoutforumbits = $templater->render();
	vB_Template::preRegister('option', array('optoutforumbits' => $optoutforumbits));   

}
$show['optoutgnp'] = sizeof($optoutforumids) > 0;
And this is the code from the template (below {vb:raw customfields.other}):

Code:
<div class="blockrow">
   <legend>{vb:phrase exclude_forums_from_gnp}</legend>
   	<div><phrase>{vb:phrase exclude_forums_from_gnp_desc, {session.sessionurl}}</phrase></div>
   	<label for="sel_optoutgnp">{vb:phrase exclude_forums}:</label>
   	<select style="width: 100%" size="13" name="optoutgnp[]" id="sel_optoutgnp" multiple="multiple">
   		<option value="">{vb:phrase none}</option>
		{vb:raw optoutforumbits}
   	</select>
</div>
Thanks again for your assistance.
Reply With Quote
  #14  
Old 08-17-2010, 03:24 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm surprised you were able to save your template when you had {session.sessionurl} instead of {vb:raw session.sessionurl}. It gave me an error until I corrected it.

This is supposed to show up on my Settings > General Settings page, right? I have it there, but it is not the "options" template, it is the "modifyoptions" template that it goes into and needs to be preregistered in. And, you didn't supply me with the contents of "mytemplate", so I can't see any output anyway. But, there is something there, it's just incomplete because you didn't provide me with the other needed info.
Reply With Quote
  #15  
Old 08-17-2010, 07:07 PM
AfterWorldForum AfterWorldForum is offline
 
Join Date: Dec 2008
Posts: 154
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Lynne,

Thank you. That seems to have done the trick. I now see something happening at least. It's not yet what I expected or needed, but it's way better than not seeing anything at all.

I am assuming it did not work because even though the option template was being evaluated, that was not the right template.

Thanks agian for your help. I'll see what I still need to do to get the rest working, but this is definitly an encouragement

Peter
Reply With Quote
Reply


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 04:13 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.03464 seconds
  • Memory Usage 2,212KB
  • Queries Executed 11 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)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