myCred User Badges

Estimated reading: 3 minutes 752 views

myCred User Badges

Description: This shortcode will render the badges that the user has earned if the user_id is provided, then it will show only to that user. If user_id is not given, this shortcode will show earned badges of the current user.
Shortcode: mycred_user_badges

Shortcode Attributes:

Attribute

Type

Required

Default

Description

user_id

INT

Optional

current

By default, it will show you the “current” user-earned badges which are looking at the page. You can see others’ user badges by assigning the user id. If you set this attribute value to empty, nothing will appear.

type_id

INT

Optional

Specifying the “type_id” attribute will only show you the badge associated with the defined type_id.


Note: Many badges can have the same type_id. Do not be confused if you see many badges.

title

INT

Optional

1

Either set 0 to hide the title or 1 to show the title.

title_link

INT

Optional

1

Set the attribute value 0 to remove the anchor from the link.

image

INT

Optional

1

Set the attribute value 0 for hiding the badge image/logo.

image_size

INT

Optional

Set the value for resizing the image from the default dimension to the defined one. The value you’ll define will be considered, like the width and height of the image/logo.


e.g. image_size=110 or image_size=330 etc.

excerpt

INT

Optional

0

Set attribute value 1 to show the excerpt.

requirements

INT

Optional

0

Set the attribute value 1 to display the defined badge requirements on the front end.

earners

INT

Optional

0

Set the attribute value 1 to show the earned users who earned that badge.

earners_limit

INT

Optional

10

To change the limit of the number of earners.


e.g. earners_limit=7 or earners_limit=30

display

STRING

Optional

horizontal

To display the content in different styles, either use vertical or inline  values.


Note: If you’ve used inline, it will only show the badge image and title.

Example 01:[mycred_user_badges]

Example 02:  [mycred_user_badges title_link=0 display=”inline”]

Example 03: [mycred_user_badges title_link=0 image=0 excerpt=1 earners=1 requirements=1 display=”vertical”]

Example 04:  [mycred_user_badges type_id=10 excerpt=1 earners=1 requirements=1 display=”horizontal”]

Example 05:  [mycred_user_badges user_id=4 type_id=10 requirements=1 display=”vertical”]