[bd] Widget Framework FAQ

Discussion in '[bd] Widget Framework' started by xfrocks, Apr 16, 2013.

Thread Status:
Not open for further replies.
  1. xfrocks

    xfrocks XenForo rocks!
    Staff Member

    [bd] Widget Framework FAQ

    Q: I've installed the add-on and got Widget Framework menu under Appearance section in the AdminCP. How do I actually get any of the widgets to appear on the forum?
    A: You can start by click "Add Widget" and select a renderer (e.g. Threads or Users). Then you must put a position: if you want the widget to show up in the forum index, enter "forum_list". The rest of the fields can be left with their default values, click "Save all changes". The new widget should show up.

    Q: Any idea why could it be that the Widget Framework isn't displaying the custom widgets at all? Basically it shows only the default XenForo widgets like if the add-on wasn't working.
    A: If you have just installed this add-on, it will replace the default sidebar with its own widgets. However, the default set of widgets mimics XenForo's. You will need to go to AdminCP > Appearances > Widgets to configure: add new, modify, reorder, etc.

    Q: I see a folder named "xml-to-import" which includes a file named "TaigaChat.xml". Do I also need to upload this file onto my server if I do not want to use the "Taiga Chat feature"?
    A: No. Only import it if you need Taiga Chat widget.
    Walter and DRE like this.
  2. xfrocks

    xfrocks XenForo rocks!
    Staff Member

    Q: How can I hide the 'Signed in' widget?
    A: Create a widget with "Clear Sidebar" renderer and check the box "hide visitor panel too?".
    Screen Shot 2013-05-03 at 7.49.17 AM.png

    Q: Is there a recent posts widget for this that follows permissions?
    A: Yes, create a widget with "Threads" renderer and select the "New Replies" as type.
    Screen Shot 2013-05-03 at 7.47.18 AM.png

    Q: Are there options for a block showing "latest" and/or "newest" members included?
    A: Yes, create a widget with "Users" renderer and configure it as below:
    Screen Shot 2013-05-03 at 8.12.28 AM.png

    Q: Is there a way to make the Online Users area show the corresponding usergroup colours? So admins would show up as the colour of that usergroup etc.?
    A: Yes, check the box "Show rich usernames" when you edit the widget.

    Q: Is it possible now to have a plain html block? I want to put a 300x250 banner on the sidebar without border, frame, etc.
    A: Yes, create a widget with "HTML (without wrapper)" renderer.

    Q: Does anyone know how I might go about creating a recent threads widget that grabs recent threads from a different installation of XF?
    A: Use "Feed Reader" renderer.
    DRE likes this.
  3. xfrocks

    xfrocks XenForo rocks!
    Staff Member

    Q: Is there a way to get widgets on the Recent Threads page (the page guests see when they click "Whats New")? And on search results?
    A: For the "What's New" page, use position "find_new_threads". For search results page, use position "search_results".

    Q: I'm using Jake Bunce's use nodes as tabs, each category is a tab and I've set the option in Node & Forum list to create pages for Categories so when you click on a tab it will will only show the category and forums for it. That's where I can't seem to get the framework working.
    A: You can use "category_view" as one of your positions.

    Q: How do I add a widget so it shows on a members profile page?
    A: You can use "member_view" as one of your positions.

    Q: How do I hide a widget from members - so just display it to guests?
    A: Use this in the Expression field:
    $visitor['user_id'] == 0
    Q: What expression do I use to achieve the opposite? Only members/ logged-in users can see the block?
    A: You can use this:
    $visitor['user_id'] != 0
    Q: Currently, new users with unconfirmed email addresses can see the widgets. Would it be best to check for the user state to be "Valid"? If so, what would the expression for that be? Thanks!
    A: You can use this:
    $visitor['user_state'] == 'valid'
    Q: I see that you leaves this note "XenForo_Template_Helper_Core::helperIsMemberOf($visitor, 3) -- means: show the widget for users of user group #3 only." What if I want a negate of that, show the widget if they are not in usergroup #3 only?
    A: You can use this:
    XenForo_Template_Helper_Core::helperIsMemberOf($visitor3) == false
    Q: And how to show widgets only to usergroups x,y,z only?
    A: You can use this:
    Q: How to display a widget on forumid x, y, z?
    A: You can use this with "forum_view" position or similar:
    in_array($forum['node_id'], array(xyz))
    Q: How to display a widget if they are not under X, Y, Z?
    A: You can use this with "forum_view" position or similar:
    in_array($forum['node_id'], array(xyz)) == false
    Q: Can we use category id instead? That way, show widget under category X would cover all the forums under this category.
    A: Yes, you can use this with "forum_view" position or similar:
    $forum['parent_node_id'] == <category-id>
    Q: How would I go about adding a sidebar just to one page and modifying it using the widget framework? I found out that pages use pagenode_container, but if I set that as my position all pages will have the added sidebar which I am not interested in.
    A: You can use this with "pagenode_container" position:
    $page['node_id'] == <page-node-id>
    Q: If I want to add a widget in only one resource category, say,http://domain.com/xenforo/resources/categories/something.34/, what do I need to put in the Expression box?
    A: You can use this with "resource_category" position:
    $category['resource_category_id'] == 34
    Q: Is it possible to add a widget for each resource? What expression we can use so that a widget only appears under resource id = x?
    A: You can use this with "resource_view" position:
    $resource['resource_id'] == x
    semprot and DRE like this.
  4. xfrocks

    xfrocks XenForo rocks!
    Staff Member

    Q: Is there a reason some renderers do not have a "Tab Group"?
    A: Only renderer that is configured to use the wrapper can be included in the tabs interface. Hence some renderers will not have the "Tab Group" option.

    Q: How do I add that New/Recent/Popular widget that you have in the photos... there doesn't seem to be an option... there's a "tab group" but it's a little hard to understand what I need to do.
    A: You do that by creating 3 widgets as you like (e.g. New, Recent and Popular) and just enter the same tab name for all of them.

    Q: Is there a way to display the widget before the contents of a template hook?
    A: You can use a negative display order.

    Q: I have all my widgets set up as I want them in development. Is there a way to export widgets? I'd like to be able to duplicate my set up on another board. Is this possible?
    A: Yes. There is a export button in AdminCP > Appearances > Widget Framework >List Widgets. Click the button and you will get an XML file of your widget configurations. After installing [bd] Widget Framework on your other server, go to AdminCP > Appearances > Widget Framework > Import Widgets to import it back.
    Screen Shot 2013-05-03 at 8.05.43 AM.png
    DRE likes this.
  5. xfrocks

    xfrocks XenForo rocks!
    Staff Member

    Q: For some reason my User Status Updates takes like 10 minutes to update. Any reason why?
    A: It's by design. The widget result will be cached for performance reason. Actually, the "User Recent Status" renderer is set to refresh its data once per hour. If you really want to change that, you can open the file xenforo/library/WidgetFramework/WidgetRenderer/RecentStatus.php, update line number 13
    'cacheSeconds' => 3600// cache for 1 hour
    Change it to update every minute for example:
    'cacheSeconds' => 60,
    Q: What is the refresh circle of renderer X?
    List of renderers and their cache time:
    • Clear Sidebar: no caching
    • Birthday: 1 hour
    • Feed Reader: 1 hour
    • Forum Statistics: no caching
    • Share This Page: no caching
    • Thread with Poll: 5 minutes
    • Threads: 5 minutes
    • User Recent Status: 1 hour
    • Users: 30 minutes
    • User Online Now: no caching
    • Users: Find: no caching
    • Visitor Panel: no caching
    • XFRM: Resources: 5 minutes
    • HTML: no caching
    • PHP Callback: no caching
    • Template: no caching
    Shree, yavuz, sami simo and 1 other person like this.