WP Manifestindependent plugin directory
manifest / ecommerce / animal-sponsorship

4H Animal Sponsorship

A WordPress plugin for managing animal sponsorships at 4H farms in Sweden. Allows visitors to sponsor animals with SWISH payments.

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/johanneswilm/animal-sponsorship/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

4H Animal Sponsorship WordPress Plugin

A comprehensive WordPress plugin for managing animal sponsorships at 4H farms in Sweden. This plugin allows visitors to sponsor animals with SWISH payments and provides farm administrators with tools to manage sponsorships, verify payments, and track statistics.

Features

🐾 Animal Management

  • Custom post type for animals with detailed information
  • Photo uploads and galleries
  • Species, age, and pricing management
  • Sponsorship status tracking

💳 SWISH Payment Integration

  • QR code generation for SWISH payments
  • Mobile-friendly payment links
  • Manual payment verification
  • Payment timeout handling

👥 Sponsorship Types

  • Individual sponsorships
  • Family sponsorships
  • Corporate sponsorships
  • Custom sponsor information display

📊 Admin Dashboard

  • Real-time statistics
  • Payment verification tools
  • Sponsorship management
  • Export functionality
  • Email notifications

🌍 Swedish Localization

  • Complete Swedish translation
  • Swedish phone number validation
  • SEK currency formatting
  • SWISH integration optimized for Sweden

Installation

Requirements

  • WordPress 5.0 or higher
  • PHP 7.4 or higher
  • MySQL 5.6 or higher
  • SWISH account for payment processing

Manual Installation

  1. Download the plugin

    git clone https://github.com/4h-sweden/animal-sponsorship.git
  2. Upload to WordPress

    • Upload the animal-sponsorship folder to /wp-content/plugins/
    • Activate the plugin through the 'Plugins' menu in WordPress
  3. Configure settings

    • Go to Animals > Settings in your WordPress admin
    • Enter your SWISH phone number
    • Configure email settings
    • Set farm information

Configuration

Basic Setup

  1. SWISH Configuration

    • Navigate to Animals > Settings > Payment Settings
    • Enter your SWISH phone number (format: 070-123 45 67)
    • Test with small amounts first
  2. Email Settings

    • Set admin email for notifications
    • Configure email from name and address
    • Enable/disable email notifications
  3. General Settings

    • Set farm name
    • Configure sponsorship year (default: 2026)
    • Set currency symbol

Adding Animals

  1. Go to Animals > Add New

  2. Fill in animal information:

    • Name and description
    • Species and age
    • Sponsorship price
    • Upload photos
  3. Publish the animal to make it available for sponsorship

Usage

Display Animals on Your Website

Use these shortcodes to display animals on your pages:

Animals Grid

[animal_sponsorship_list per_page="12" show_sponsored="yes"]

Parameters:

  • per_page: Number of animals per page (default: 12)
  • show_sponsored: Show sponsored animals (yes/no, default: yes)

Sponsorship Form

[animal_sponsorship_form animal_id="123"]

Parameters:

  • animal_id: ID of the specific animal to sponsor

Managing Sponsorships

  1. View Sponsorships

    • Go to Animals > Sponsorships
    • Filter by status, sponsor type, or date
    • Export data to CSV
  2. Verify Payments

    • Check your SWISH app for incoming payments
    • Match payment details with sponsorship requests
    • Click "Verify Payment" to confirm sponsorship
  3. Cancel Sponsorships

    • Use the "Cancel" button for invalid or duplicate requests
    • Cancelled sponsorships free up the animal for other sponsors

SWISH Integration

How It Works

  1. Visitor selects an animal to sponsor
  2. Fills out sponsorship form
  3. Receives QR code for SWISH payment
  4. Makes payment using SWISH app
  5. Admin verifies payment manually
  6. Sponsorship is confirmed and displayed

Payment Verification

Important: This plugin does not automatically verify SWISH payments. You must:

  1. Check your SWISH app for incoming payments
  2. Match payment amount and reference number
  3. Manually verify payments in the admin panel

Security Notes

  • Never share your SWISH login credentials
  • Regularly check for suspicious payment requests
  • Keep the plugin updated for security patches

Customization

Styling

The plugin includes comprehensive CSS that can be customized:

  • Frontend: assets/css/public.css
  • Admin: assets/css/admin.css

Templates

Override templates by copying them to your theme:

your-theme/animal-sponsorship/animals-grid.php
your-theme/animal-sponsorship/sponsorship-form.php

Hooks and Filters

Actions

// Before sponsorship creation
do_action('animal_sponsorship_before_create', $sponsorship_data);

// After sponsorship confirmation
do_action('animal_sponsorship_confirmed', $sponsorship_id);

// Before sending emails
do_action('animal_sponsorship_before_email', $email_type, $sponsorship_id);

Filters

// Modify sponsorship data
$data = apply_filters('animal_sponsorship_data', $data);

// Customize email content
$message = apply_filters('animal_sponsorship_email_message', $message, $type);

// Modify QR code settings
$qr_settings = apply_filters('animal_sponsorship_qr_settings', $settings);

Translation

The plugin is fully translatable and includes Swedish translation files:

  • languages/animal-sponsorship-sv_SE.po
  • languages/animal-sponsorship-sv_SE.mo

To create additional translations:

  1. Use a tool like Poedit
  2. Load the .pot file from the languages directory
  3. Translate all strings
  4. Save as animal-sponsorship-{locale}.po and .mo

Troubleshooting

Common Issues

SWISH QR Codes Not Working

  • Verify your SWISH phone number is correct
  • Test QR codes with the SWISH app
  • Check that your website is accessible via HTTPS

Email Notifications Not Sending

  • Verify SMTP settings in WordPress
  • Check spam folders
  • Test with a simple email plugin first

Animals Not Displaying

  • Check that animals are published
  • Verify shortcode syntax
  • Clear any caching plugins

Payment Verification Issues

  • Ensure you have admin privileges
  • Check browser console for JavaScript errors
  • Verify AJAX requests are working

Debug Mode

Enable debugging by adding to wp-config.php:

define('ANIMAL_SPONSORSHIP_DEBUG', true);

This will log additional information to help diagnose issues.

Getting Help

  1. Check the Issues page
  2. Search existing issues before creating new ones
  3. Include WordPress version, PHP version, and error messages
  4. Provide steps to reproduce the problem

Contributing

We welcome contributions! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

Development Setup

# Clone the repository
git clone https://github.com/4h-sweden/animal-sponsorship.git

# Install dependencies (if any)
cd animal-sponsorship
npm install  # For any build tools

# Set up local WordPress environment
# Use Local, XAMPP, or Docker

Code Standards

  • Follow WordPress coding standards
  • Use proper sanitization and validation
  • Add inline documentation
  • Include translation strings

License

This plugin is licensed under the GPL v2 or later.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

Credits

  • Developed for 4H Sweden
  • SWISH integration for Swedish payments
  • Built with WordPress best practices
  • Uses modern PHP and JavaScript

Changelog

Version 1.0.0

  • Initial release
  • Animal management system
  • SWISH payment integration
  • Swedish localization
  • Admin dashboard
  • Email notifications
  • Export functionality

Support

For support and questions:


Note: This plugin requires manual payment verification through the SWISH app. It does not automatically process payments or connect to banking APIs for security reasons.