ap_register_reputation_event( string $event_slug, array $args )

Description #

Register reputation event.

Parameters #

  • $event_slug
    string (Required) Event slug.
  • $args
    array (Required) Points to award for this reputation.

Source #

File: includes/reputation.php

function ap_register_reputation_event( $event_slug, $args ) {
	$args = wp_parse_args(
		$args,
		array(
			'icon'   => 'apicon-reputation',
			'parent' => 'post',
		)
	);

	$event_slug          = sanitize_title( $event_slug );
	$args['label']       = esc_attr( $args['label'] );
	$args['description'] = esc_html( $args['description'] );
	$args['icon']        = esc_attr( $args['icon'] );

	$custom_points                               = get_option( 'anspress_reputation_events' );
	$args['points']                              = isset( $custom_points[ $event_slug ] ) ? (int) $custom_points[ $event_slug ] : (int) $args['points'];
	anspress()->reputation_events[ $event_slug ] = $args;
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment