Support » Plugin: Achievements for WordPress » multiple event names?

  • Resolved Stephanie Leary


    I’m working on a site that has per-category achievements. This has been tricky to set up. Right now, I’m manually creating new actions for each category in addition to the first action, which occurs any time someone posts to this CPT:

    $this->actions = array(
    'lettermo_new_letter' => __( 'The user sends a letter', 'dpa' ),
    'lettermo_new_package' => __( 'The user sends a package', 'dpa' ),
    'lettermo_new_intl' => __( 'The user sends international mail', 'dpa' ),

    … and then mapping them to event names like so:

    if ( 'letter' !== $func_args[0]->post_type )
    	return $event_name;
    $postid = $func_args[0]->ID;
    // Switch the event names for Letters
    if ( has_term( 'package', 'extras', $postid ) )
    	return 'lettermo_new_package';
    if ( has_term( 'international', 'extras', $postid ) )
    	return 'lettermo_new_intl';
    return 'lettermo_new_letter';

    (Full code here:

    That is, if the post has a term from the ‘extras’ taxonomy, return that event name; otherwise use the default.

    This works as long as I have only one term selected per post. I’m going to be in trouble as soon as someone tries to mix them — e.g. sending an international package.

    Is there a way to return multiple event names? I tried an array and it didn’t appear to work.

Viewing 1 replies (of 1 total)
  • Plugin Author Paul Gibbs


    BuddyPress Lead Developer

    Hi Stephanie,

    I don’t mean for this to sound abrupt, but no; it needs to be a string. 🙂

Viewing 1 replies (of 1 total)
  • The topic ‘multiple event names?’ is closed to new replies.