Mycred Badges and Points with anspress

6.70K viewsUpdates
1

Hello, I would want to know how to make an integration mycred and anspress.
Example: an answer messenger = badges of mycred and 10pts …

0

<?php

/**
* To view theme functions, navigate to /buddyboss-inc/theme.php
*
*@package Boss
*@since Boss 1.0.0
*/
$init_file = get_template_directory() . '/buddyboss-inc/init.php';

if ( !file_exists( $init_file ) ) {
$err_msg = __( 'BuddyBoss cannot find the starter file, should be located at: *wp root*/wp-content/themes/buddyboss/buddyboss-inc/init.php', 'boss' );

wp_die( $err_msg );
}

require_once( $init_file );

edited comment on answer

I puts or your code in the function @yehonal

1

Following@Rahul suggestion, i’ve created an example of mycred hook:

add_action(‘ap_publish_comment’, function($comment) {<br />
$points=5;<br />
mycred_add(‘ap_comment’,$comment->user_id,$points,”Points for comment sent”);<br />
}, 10, 1);

it can be done for all other hooks.

commented on answer

Hello, thank you for your answer! I have a question the code, I put him where?
You have an idea for badge

the easiest way is putting it in function.php of your theme (but it will be removed by theme updates if 3rd party). if you want a clean way i suggest you to inform about wordpress child themes (search on google)

about badges i dunno, but mycred codex is awesome: http://codex.mycred.me/ , Chapter VI contains all functions you need that you can call in reputations hooks that Rahul linked.

ofc it requires some skills with wordpress programming 🙂

I have problem : Parse error: syntax error, unexpected ‘<' in /home/web12638/web/wp-content/themes/boss/functions.php on line 19

1

Hello Ridan,
You can inspire from our existing reputation hooks:
https://github.com/anspress/anspress/blob/master/addons/free/reputation.php#L39-L66

commented on answer

How to add the codes in mycred?How can it be done?

Hi, Rahul Aryan ?? Help me please!

Please consult with mycred author, I am not sure how mycreed works.

Hi ! Link : https://mycred.me/support/forums/topic/mycred-badges-and-points-with-anspress-2/
I sent, but always no answers. I have a question he will be when the new version of Anspress