itthinx / groups

Groups provides group-based user membership management, group-based capabilities and content access control. It integrates standard WordPress capabilities and application-specific capabilities along with an extensive API.
GNU General Public License v3.0
49 stars 35 forks source link

Create enhanced-shortcodes.php #15

Closed eivind1984 closed 9 years ago

eivind1984 commented 9 years ago

As discussed in the comments section (http://www.itthinx.com/plugins/groups-gravityforms/), here's my take on the shortcode file.

As far as I know, all original functinality is intact.

This edit does a couple of things:

Listing groups the user is a member of: Add an option to display a "leave group" button for each group. Use leavebutton="yes" in the shortcode to display it, e.g like this: [groups_user_groups leavebutton="1"]

Listing all groups available: Add an option to display a "join group" button for each group. Use joinbutton="yes" in the shortcode to display it, e.g. like this: [groups_groups joinbutton="1"]

Listing all groups available: Add an option to not display groups the logged in user is already a member of. Use exclude_excisting="yes" in the shortcode to enable it, e.g. like this: [[groups_groups exclude_excisting="1"]

These last two are ment to be used together, as it would make little sense in asking the user to join a group she's already a member of.

I'm no PHP expert, so there's probably improvements to be made on the actual code. Feel free to look into it.

All the best, Eivind