I want to display a message in a block for unauthenticated users and a different message for authenticated users.
Does anyone know of a module or method to solve this fairly common use case with ony ONE block.
I think the obvious solution for this is to create two blocks with two different visibility rules. I've had to do this in a number of cases. But, it seems a bit hacky. In Backdrop layouts can quickly get cluttered with conditional blocks and I think the opportunity to reduce the number of blocks needed would be worth it.
This seems like a common enough use case and potentially not that had to create.
Does such a module exist for Backdrop or Drupal?
I did find this interesting idea, which might be better, because this could work in a block or a regular node page.
https://www.drupal.org/project/conditional_text
Comments
Sounds interesting...
If you could post a "Port request" on the github page for contributed modules someone will look at it and possibly port it to Backdrop.
https://github.com/backdrop-ops/contrib/issues
Hope this helps.
So I took the basic idea for this module and created a brand new contrib module. https://github.com/backdrop-contrib/conditional_content_block
This module works, but I'm not that at experienced at creating modules from scratch so I would love help and feedback pointing out:
1) What kinds of things does a contrib module need to think about that a simple custom module for private use doesn't.
2) Feature ideas.
Right now, it's very simple. The module provides a block with two text fields. One text field displays to authenticated users and one to unauthenticated users.
I would like to provide additional "conditions" as well. Also, I would like to allow the block to use existing content.
What else should a block like this do?
Current Title: Conditional Content Block
I'm not excited about the name of the module. Suggestions?
Making progress on this module. Any thoughts on a better name than Conditional Content Block?
https://github.com/backdrop-contrib/conditional_content_block/issues/7