[resolved] Shortcode boolean (2 posts)

  1. jeffryf
    Posted 3 years ago #

    I need to perform some simple boolean logic with shortcodes--specifically [group_member group="Group Name"].

    I have 5 products: 2 simple, single-purchase products and 3 subscription products. I've assigned each a unique Group identity. I want each purchase to have a distinct message on the landing page after purchase.

    One subscription is a follow-on to one of the two simple products. So when the customer "upgrades," she is in two Group: one of the simple product Groups and the subscription Group.


    Products 1, 2, 3, 4, 5

    Corresponding Groups A, B, C, D, E

    I need to be able to designate (A & not C) and (A & C) for the shortcode.

    The [group_member group="Group Name"] shortcode works perfectly for the 2 simple products and 2 of the subscriptions, but when someone purchases the follow-on product, they see both the simple product message and the subscription message.


  2. itthinx
    Plugin Author

    Posted 3 years ago #

    Member of A but not of C can be done like this:

    [groups_member group="A"]
    [groups_non_member group="C"]
    You are a member of group A but you're not in group C.

    Member of A and C cannot be expressed currently and nesting the same shortcode within itself unfortunately isn't an option due to limitations of WordPress' shortcode parser.

    But a solution to the above would be to allow unary negation and binary conjunction of group names (disjunction is already implemented) within the shortcodes' group attribute - if that were implemented, the shortcodes could be used interchangeably. I see the worth of it and am adding this as a feature request.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Groups
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.