Resource icon

[bd] Widget Framework 2.6.6

No permission to download
Replace this:
HTML:
<xen:if is="{$widget.options.type} == 'recent' OR {$widget.options.type} == 'latest_replies'">
with this:
HTML:
<xen:if is="({$widget.options.type} == 'recent' OR {$widget.options.type} == 'latest_replies') AND !{$visitor.customFields.FIELD_ID}">
then replace this:
HTML:
<xen:elseif is="{$widget.options.type} == 'most_replied'" />
with this:
HTML:
<xen:elseif is="({$widget.options.type} == 'most_replied') AND !{$visitor.customFields.FIELD_ID}" />
@Blast That should disable 'latest_replies' and 'most_replied' widgets when the user selected the custom user field. Don't forget to change the FIELD_ID.
 
Wait, now that I think about again, do you want to disable some specific widget with that approach? Instead of editing the template, why not adding !{$visitor.customFields.FIELD_ID} to the widget's expression instead?
 
How do I do that? I tried adding {$visitor.customFields.FIELD_ID} to the widget's conditional, and it is disabling it by default. So it would be hard for new users.
 
Naah, it's working well on my end (both production and dev forum running php 7.1.1). I've been using beta version since 7.0.x.
The latest Beta is not working with PHP 7.1.1 on our server @BobbyWibowo . We get these errors:

An exception occurred: Argument 1 passed to XenForo_Template_Helper_Core::helperIsMemberOf() must be of the type array, integer given, called in D:\cuswebs\www1\forums.mysite.com\library\XenForo\Template\Helper\Core.php on line 853 in D:\cuswebs\www1\forums.mysite.com\library\XenForo\Template\Helper\Core.php on line 1344

  1. XenForo_Template_Helper_Core::helperIsMemberOf() in XenForo/Template/Helper/Core.php at line 853
  2. XenForo_Template_Helper_Core::callHelper() in WidgetFramework/WidgetRenderer.php(571) : runtime-created function at line 1
  3. __lambda_func() in WidgetFramework/WidgetRenderer.php at line 574
  4. WidgetFramework_WidgetRenderer->_executeExpression() in WidgetFramework/WidgetRenderer.php at line 597
  5. WidgetFramework_WidgetRenderer->_testConditional() in WidgetFramework/WidgetRenderer.php at line 648
  6. WidgetFramework_WidgetRenderer->render() in WidgetFramework/Core.php at line 500
  7. WidgetFramework_Core->renderWidget() in WidgetFramework/Core.php at line 462
  8. WidgetFramework_Core->renderWidgets() in WidgetFramework/Core.php at line 429
  9. WidgetFramework_Core->_renderWidgetsFor() in WidgetFramework/Core.php at line 312
  10. WidgetFramework_Core->renderWidgetsFor() in WidgetFramework/Listener.php at line 118
  11. WidgetFramework_Listener::template_post_render() in XenForo/CodeEvent.php at line 58
  12. XenForo_CodeEvent::fire() in XenForo/Template/Abstract.php at line 195
  13. XenForo_Template_Abstract->render() in XenForo/Template/Public.php at line 110
  14. XenForo_Template_Public->render() in XenForo/ViewRenderer/HtmlPublic.php at line 124
  15. XenForo_ViewRenderer_HtmlPublic->renderContainer() in XenForo/FrontController.php at line 639
  16. XenForo_FrontController->renderView() in XenForo/FrontController.php at line 158
  17. XenForo_FrontController->run() in D:/webs/forums.mysite.com/index.php at line 13
 
@BobbyWibowo it finally worked with the widget conditional. However, after enabling it for a couple of seconds, I got bombarded with this:
Code:
Server Error Log
Error Info
ErrorException: Undefined index: sideTopDiscussions - library/WidgetFramework/Helper/Conditional.php(20) : eval()'d code:2
Generated By: username, 1 minute ago
Stack Trace
#0 /home/***/public_html/library/WidgetFramework/Helper/Conditional.php(20) : eval()'d code(2): XenForo_Application::handlePhpError(8, 'Undefined index...', '/home/***...', 2, Array)
#1 /home/***/public_html/library/WidgetFramework/Helper/Conditional.php(20): eval()
#2 /home/***/public_html/library/WidgetFramework/WidgetRenderer.php(594): WidgetFramework_Helper_Conditional::test('!{$visitor.cust...', '$__output = '';...', Array)
#3 /home/***/public_html/library/WidgetFramework/WidgetRenderer.php(648): WidgetFramework_WidgetRenderer->_testConditional(Array, Array)
#4 /home/***/public_html/library/WidgetFramework/Core.php(500): WidgetFramework_WidgetRenderer->render(Array, 'forum_list', Array, Object(XenForo_Template_Public), Object(_WidgetFramework_ArrayOfString))
#5 /home/***/public_html/library/WidgetFramework/Core.php(462): WidgetFramework_Core->renderWidget(Array, 'forum_list', Array, Object(XenForo_Template_Public), Object(_WidgetFramework_ArrayOfString))
#6 /home/***/public_html/library/WidgetFramework/Core.php(429): WidgetFramework_Core->renderWidgets(Array, 'forum_list', Array, Object(XenForo_Template_Public), Object(_WidgetFramework_ArrayOfString))
#7 /home/***/public_html/library/WidgetFramework/Core.php(312): WidgetFramework_Core->_renderWidgetsFor('forum_list', Array, Object(XenForo_Template_Public), '\n\t\n\n\t\n\t\t\n\t\t\t\n\n<...')
#8 /home/***/public_html/library/WidgetFramework/Listener.php(118): WidgetFramework_Core->renderWidgetsFor('forum_list', Array, Object(XenForo_Template_Public), Array)
#9 [internal function]: WidgetFramework_Listener::template_post_render('forum_list', '\n\t\n\n\n\n\t\n\t\n\n\n\n\n\n...', Array, Object(XenForo_Template_Public))
#10 /home/***/public_html/library/XenForo/CodeEvent.php(58): call_user_func_array(Array, Array)
#11 /home/***/public_html/library/XenForo/Template/Abstract.php(195): XenForo_CodeEvent::fire('template_post_r...', Array, 'forum_list')
#12 /home/***/public_html/library/XenForo/Template/Public.php(110): XenForo_Template_Abstract->render()
#13 /home/***/public_html/library/XenForo/ViewRenderer/HtmlPublic.php(124): XenForo_Template_Public->render()
#14 /home/***/public_html/library/XenForo/FrontController.php(639): XenForo_ViewRenderer_HtmlPublic->renderContainer(Object(XenForo_Template_Public), Array)
#15 /home/***/public_html/library/XenForo/FrontController.php(158): XenForo_FrontController->renderView(Object(XenForo_ControllerResponse_View), Object(XenForo_ViewRenderer_HtmlPublic), Array)
#16 /home/***/public_html/index.php(13): XenForo_FrontController->run()
#17 {main}
Request State
array(3) {
  ["url"] => string(27) "https://***.site/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 
The latest Beta is not working with PHP 7.1.1 on our server @BobbyWibowo . We get these errors:

An exception occurred: Argument 1 passed to XenForo_Template_Helper_Core::helperIsMemberOf() must be of the type array, integer given, called in D:\cuswebs\www1\forums.mysite.com\library\XenForo\Template\Helper\Core.php on line 853 in D:\cuswebs\www1\forums.mysite.com\library\XenForo\Template\Helper\Core.php on line 1344
That sounds like something caused by expressions. Did one of your widgets use expressions? In the beta version, expressions should have been dropped and replaced with conditionals (similar to the ones used in templates). I don't know the consequences of upgrading to beta version when having widget with expressions though, so you'll have to reach @xfrocks for that as I'm not too sure myself (in fact, my speculation could have totally missed).
@BobbyWibowo it finally worked with the widget conditional. However, after enabling it for a couple of seconds, I got bombarded with this:
Did you only have that !{$visitor.customFields.FIELD_ID} as your conditionals? I'm not even sure how sideTopDiscussions came into this. Unless is that the ID of the custom user field? If so, then undefined index, that probably means that the user field with such ID was not found in the $visitors.customFields array. But in my dev forum, even if $visitors.customFields array was totally empty (such as Guests), there was no error whatsoever. Oh well, dunno then, lol
 
Also, I found out that maybe the conditionals feature of this add-on have some limitations or something. I tried making a conditionals like this:
Code:
!in_array({$visitor.customFields}, 'FIELD_ID')
OR
!{$visitor.customFields.FIELD_ID}
but the widget won't appear regardless of the fact that the conditionals should have returned TRUE (tested by having another widget with normal <xen:if /> tag using the same conditionals to print 1 when it passed and 0 when it failed - also tested by dumping the content of {$visitor.customFields} array to manually verify the logic).
 
That sounds like something caused by expressions. Did one of your widgets use expressions?
You put me on the right track! I went into the admin and then list widgets. I made a note off all the ones that were checked, then unchecked them all and enabled PHP 7.1 on the site and it loaded, then I went and enabled each widget one by one until I discovered the culprit! So yes, it does work fine with PHP 7.1 and I'm also on a Windows Server. In my case it was a widget called profile posts and it had an expression listed as XenForo_Template_Helper_Core::callHelper('ismemberof', array(16)).

I'm not sure that was even being used. Anyway, the site is now up and running with PHP 7.1 with no errors, thanks everyone! @Blast you should try this as well.
 
I'd like a different Poll Thread widget to show up ONLY in the four game subforums I have. How do I set this up? Four polls, one for each game.

Currently I have a poll up for the game Dungeons & Dragons Online. I'd like to ONLY show the poll in the Dungeons & Dragons Online subforum. Here is the link:

http://tyrspaladium.com/index.php?categories/dungeons-dragons-online.3/

Help much appreciated.

cqWBpHz.png
 
Last edited:
That sounds like something caused by expressions. Did one of your widgets use expressions? In the beta version, expressions should have been dropped and replaced with conditionals (similar to the ones used in templates). I don't know the consequences of upgrading to beta version when having widget with expressions though, so you'll have to reach @xfrocks for that as I'm not too sure myself (in fact, my speculation could have totally missed).

Did you only have that !{$visitor.customFields.FIELD_ID} as your conditionals? I'm not even sure how sideTopDiscussions came into this. Unless is that the ID of the custom user field? If so, then undefined index, that probably means that the user field with such ID was not found in the $visitors.customFields array. But in my dev forum, even if $visitors.customFields array was totally empty (such as Guests), there was no error whatsoever. Oh well, dunno then, lol
Sorry for my late response. Yes, sideTopDiscussions is the field ID. I only have !{$visitor.customFields.FIELD_ID} as the conditional in the widget as you may see in the image below.

Code:
Server Error Log
Error Info
ErrorException: Undefined index: sideTopDiscussions - library/WidgetFramework/Helper/Conditional.php(20) : eval()'d code:2
Generated By: ***, A moment ago
Stack Trace
#0 /home/***/public_html/library/WidgetFramework/Helper/Conditional.php(20) : eval()'d code(2): XenForo_Application::handlePhpError(8, 'Undefined index...', '/home/***...', 2, Array)
#1 /home/***/public_html/library/WidgetFramework/Helper/Conditional.php(20): eval()
#2 /home/***/public_html/library/WidgetFramework/WidgetRenderer.php(594): WidgetFramework_Helper_Conditional::test('!{$visitor.cust...', '$__output = '';...', Array)
#3 /home/***/public_html/library/WidgetFramework/WidgetRenderer.php(648): WidgetFramework_WidgetRenderer->_testConditional(Array, Array)
#4 /home/***/public_html/library/WidgetFramework/Core.php(500): WidgetFramework_WidgetRenderer->render(Array, 'forum_list', Array, Object(XenForo_Template_Public), Object(_WidgetFramework_ArrayOfString))
#5 /home/***/public_html/library/WidgetFramework/Core.php(462): WidgetFramework_Core->renderWidget(Array, 'forum_list', Array, Object(XenForo_Template_Public), Object(_WidgetFramework_ArrayOfString))
#6 /home/***/public_html/library/WidgetFramework/Core.php(429): WidgetFramework_Core->renderWidgets(Array, 'forum_list', Array, Object(XenForo_Template_Public), Object(_WidgetFramework_ArrayOfString))
#7 /home/***/public_html/library/WidgetFramework/Core.php(312): WidgetFramework_Core->_renderWidgetsFor('forum_list', Array, Object(XenForo_Template_Public), '\n\t\n\n\t\n\t\t\n\t\t\t\n\n<...')
#8 /home/***/public_html/library/WidgetFramework/Listener.php(118): WidgetFramework_Core->renderWidgetsFor('forum_list', Array, Object(XenForo_Template_Public), Array)
#9 [internal function]: WidgetFramework_Listener::template_post_render('forum_list', '\n\t\n\n\n\n\t\n\t\n\n\n\n\n\n...', Array, Object(XenForo_Template_Public))
#10 /home/***/public_html/library/XenForo/CodeEvent.php(58): call_user_func_array(Array, Array)
#11 /home/***/public_html/library/XenForo/Template/Abstract.php(195): XenForo_CodeEvent::fire('template_post_r...', Array, 'forum_list')
#12 /home/***/public_html/library/XenForo/Template/Public.php(110): XenForo_Template_Abstract->render()
#13 /home/***/public_html/library/XenForo/ViewRenderer/HtmlPublic.php(124): XenForo_Template_Public->render()
#14 /home/***/public_html/library/XenForo/FrontController.php(639): XenForo_ViewRenderer_HtmlPublic->renderContainer(Object(XenForo_Template_Public), Array)
#15 /home/***/public_html/library/XenForo/FrontController.php(158): XenForo_FrontController->renderView(Object(XenForo_ControllerResponse_View), Object(XenForo_ViewRenderer_HtmlPublic), Array)
#16 /home/***/public_html/index.php(13): XenForo_FrontController->run()
#17 {main}
Request State
array(3) {
  ["url"] => string(27) "https://***.site/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}

erGU7f.png
 
Can I have a photo and the path to follow?
In case you didn't figure it out. when you click that 'here' link and see the framework and positions, there's a red link at the top right that says 'disable reveal mode' it's in the admin bar. Click taht and it goes back to normal
 
Top Bottom