Voting starts in March for the Drupal Association Board election.
Before all, thanks for this very great and powerful module !
I'm looking for a solution to my need, which is to display a user social widget, only in the case he has configured his concerned social profile. I don't want the site-wide widget by default, nor a error box...
Let's take this example : I wish to add the "Facebook like box" for the author of a node in the full node display. If the user did not set any Facebook profile (in his "Social profiles" tab), I wish nothing to be produced.
I followed these steps :
- Add a new widget set through admin/structure/widgets/sets/add
- Add an element (widget) "Facebook like box"
- In the widget form, I typed the token "[user:sm-facebook_url]" for the "Facebook page url" input, I think it's the way to only get the user widget and not the site one by default ; I suppose I can do this since I've seen that the socialmedia module added tokens that I suppose to correspond to the user inputs in his "Social profiles" tab [see note below]
- After adding this element, check block in Visibility and Cache by node author, then Update set
- Note that the preview says "There was an error fetching the like box for the specified page.", which is normal here because of the lack of a user context
- In admin/structure/block, make the corresponding block visible somewhere
- When you display something with a user context (content written by a user, or a user page), if the user has set a Facebook page, the block displays as expected (cool!) ; if not, the block displays "There was an error fetching the like box for the specified page." (normal but I would prefer the block not produced!). In this last case, the used token "[user:sm-facebook_url]" is probably null, but the widget seems to be systematically produced ; I think the concerned code is theme_widgets_set_view() in widgets.module; how to correct it in order not to generate any block content when the social parameter (here the facebook url) is not available? Can anyone help me for this?
[note] In admin/help/token we can see three very similar token families : [socialmedia:sm-facebook_url] (default value in the widget configuration form), [user:sm-facebook_url] and [site:sm-facebook_url]... Can you confirm that [socialmedia:sm-facebook_url] toggles between the user or the site range depending on the context (what I've noticed)? Is this usage suitable? Is there a documentation about the use of these tokens and the way to tune the cache settings accordingly?
Thanks for your help.