New extension don't work
-
I want to detect when a new user register in my web by the pluggin Nextend Facebook Connect. For that, I made a new extension, but it don’t shows in the event list. I need to do something more?
<?php /** * Extension for nextend facebook conect * This file extends Achievements to support actions from Nextend facebook conect. * * @package Achievements * @subpackage ExtensionNextendFacebookConnect */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) exit; /** * Extends Achievements to support actions from WordPress (core). * * @since Achievements (3.0) */ function dpa_init_nextend_facebook_connect_extension() { achievements()->extensions->nextend_facebook_connect = new DPA_Nextend_Facebook_Connect_Extension; // Tell the world that the WordPress extension is ready do_action( 'dpa_init_nextend_facebook_connect_extension' ); } add_action( 'dpa_ready', 'dpa_init_nextend_facebook_connect_extension' ); /** * Extension to add WordPress support to Achievements * * @since Achievements (3.0) */ class DPA_Nextend_Facebook_Connect_Extension extends DPA_Extension { /** * Constructor * * Sets up extension properties. See class phpdoc for details. * * @since Achievements (3.0) */ public function __construct() { $this->actions = array( 'nextend_fb_user_registered' => __( 'A new user register by Facebook.', 'dpa' ), 'nextend_fb_user_logged_in' => __( 'A user logins by Facebook.', 'dpa' ), 'nextend_fb_user_account_linked' => __( 'A user links his Facebook account.', 'dpa' ) ); $this->contributors = array( array( 'name' => 'Vishkey', 'gravatar_url' => 'https://www.gravatar.com/avatar/24e481cf69e3db980e2aa83a086a5a4a.png', 'profile_url' => 'https://profiles.www.ads-software.com/vishkey' ) ); $this->description = __( 'Provides events to Achiviemets with Nextend Facebook Connect.', 'dpa' ); $this->id = 'NextendFacebookConnect'; $this->image_url = trailingslashit( achievements()->includes_url ) . 'admin/images/nextend.png'; $this->name = __( 'Nextend Facebook Connect', 'dpa' ); $this->rss_url = 'https://www.ads-software.com/news/feed/'; $this->small_image_url = trailingslashit( achievements()->includes_url ) . 'admin/images/nextend-small.png'; $this->version = 3; $this->wporg_url = 'https://www.ads-software.com/plugins/nextend-facebook-connect/'; add_filter( 'dpa_handle_event_user_id', array( $this, 'event_user_id'), 10, 3 ); } /** * For the comment_post and post publish events, swap the logged in user's ID * for the post's author's ID. This is to support post moderation and publishing * by other users. * * @param int $user_id * @param string $action_name * @param array $action_func_args The action's arguments from func_get_args(). * @return int|false New user ID or false to skip any further processing * @since Achievements (3.0) */ public function event_user_id( $user_id, $action_name, $action_func_args ) { // Only deal with events added by this extension. if ( ! in_array( $action_name, array('nextend_fb_user_registered') ) ) return $user_id; // New user registration if ( 'nextend_fb_user_registered' === $action_name ) { return $action_func_args[0]; } } }
Viewing 12 replies - 1 through 12 (of 12 total)
Viewing 12 replies - 1 through 12 (of 12 total)
- The topic ‘New extension don't work’ is closed to new replies.