• Hi, congratulations for the plugin!

    I’d like to share with you some changes I made in order to support notifications for buddypress activity.

    Maybe you are interested in including this feature in future releases.

    includes/class-telefication.php (LINE 385+):

    		if ( isset( $this->options['new_user_notification'] ) ) {
    			$new_user_notification_checked = checked( 1, $this->options['new_user_notification'], false );
    		}
    		/* ETATUS CHANGES >>>>> */
    		if ( isset( $this->options['bp_activity_notification'] ) ) {
    			$bp_activity_notification_checked = checked( 1, $this->options['bp_activity_notification'], false );
    		}
    		/* <<<<< ETATUS CHANGES */		
    		
    		/*
    		 * Notify for emails
    		 */

    includes/class-telefication.php (LINE 490+):

    		/* ETATUS CHANGES >>>>> */
    		// Notify for buddypress activity
    		error_log("if( bp_is_active( 'activity' ): ". bp_is_active( 'activity' ));
    		if( ! bp_is_active( 'activity' ) ) {
    			$buddypress_is_active = '<p>' . __( ' Buddypress is not active!', 'telification' ) . '</p>';			
    		}
    		printf(
    			'<input class="%s" type="checkbox" id="bp_activity_notification" name="telefication[bp_activity_notification]" value="1" %s/>' .
    			'<label class="%s" for="bp_activity_notification"><b>' . __( 'Buddypress activity:',
    															 'telefication' ) . '</b> ' . __( 'Enable this to get notified for buddypress activity',
    																							 'telefication' ) . '</label><br> ',
    			isset( $buddypress_is_active ) ? 'disable' : '',
    			isset( $bp_activity_notification_checked ) ? $bp_activity_notification_checked : '',
    			isset( $buddypress_is_active ) ? 'disable' : ''
    		);
    		
    		/* <<<<< ETATUS CHANGES */
    
    	}
    
    	// Own Bot Setting Page

    admin/class-telefication-admin.php (LINE 182+):

    
    		// New user action
    		if ( isset( $this->options['new_user_notification'] ) && '1' == $this->options['new_user_notification'] ) {
    
    			$this->loader->add_action( 'user_register', $this, 'telefication_action_user_register', 10 );
    		}
    		
    
    		/* ETATUS CHANGES >>>>> */
    
    		// Notify for Buddypress activity - Filter
    		if ( isset( $this->options['bp_activity_notification'] ) && '1' == $this->options['bp_activity_notification'] ) {
    			$this->loader->add_filter( 'bp_activity_add', $this, 'telefication_bp_activity_admin_notify', 10, 3 );			
    		}
    		
    		/* <<<<< ETATUS CHANGES */
    	}
    	
    	/* ETATUS CHANGES >>>>> */
    	function telefication_bp_activity_admin_notify( $activity_array, $activity_id ) {
    		$message 				  = $activity_array['action'];
    		
    		$telefication_service = new Telefication_Service( $this->options );
    
    		if ( $telefication_service->create_url( $message ) ) {
    			$telefication_service->send_notification();
    		}		
    	}
    	
    	/* <<<<< ETATUS CHANGES */
    • This topic was modified 5 years, 5 months ago by etatus. Reason: deleted useless lines
    • This topic was modified 5 years, 5 months ago by etatus. Reason: deleted useless comments
    • This topic was modified 5 years, 5 months ago by etatus. Reason: renamed function
  • The topic ‘Buddypress activity support’ is closed to new replies.