Skip to:
Content
Pages
Categories
Search
Top
Bottom

Show content if invites are enabled (for groups)

  • Avatar of billzy
    billzy
    Participant

    @billzy

    Hi,

    I am looking for a small snippet of code that will allow me to display a link in my theme on the condition that invites are enabled for that user of a group?

    My last attempts was something like

    if(bp_group_has_invites ()){
    content
    }

    Any reason why this would not be working?

    Many Thanks,

    Billy

Viewing 2 replies - 1 through 2 (of 2 total)
  • Avatar of Paul Gibbs
    Paul Gibbs
    Keymaster

    @djpaul

    bp_group_has_invites() starts the entire template loop. You don’t want that if you’re after a simple ‘are invites enabled for this group’ check.

    Use bp_groups_user_can_send_invites(). It defaults to the current logged in user, so also check is_user_logged_in().

    Avatar of billzy
    billzy
    Participant

    @billzy

    Hey Paul,

    Thank you very much for your prompt reply, that snippet worked a treat … =)

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.