Permalink
Browse files

seeding

  • Loading branch information...
etivite committed Jan 7, 2012
0 parents commit 83c8169486f3dd18302c4ad9c3116ae827ac896b
Showing with 312 additions and 0 deletions.
  1. +90 −0 admin/bp-groups-directory-admin.php
  2. +68 −0 bp-groups-directory-loader.php
  3. +102 −0 bp-groups-directory.php
  4. +52 −0 readme.txt
@@ -0,0 +1,90 @@
<?php
function etivite_bp_groups_directory_admin() {
global $bp;
/* If the form has been submitted and the admin referrer checks out, save the settings */
if ( isset( $_POST['submit'] ) && check_admin_referer('etivite_bp_groups_directory_admin') ) {
if( isset($_POST['gd_activity'] ) && !empty($_POST['gd_activity']) && (int)$_POST['gd_activity'] == 1 ) {
$s = (int)$_POST['gd_activity_items'];
$enabled = true;
if ( !$s || $s < 1 ) {
$s = 0;
$enabled = false;
}
$new['activity'] = array( 'enabled' => $enabled, 'count' => $s);
} else {
$new['activity'] = array( 'enabled' => false, 'count' => 0 );
}
if( isset($_POST['gd_forum_link'] ) && !empty($_POST['gd_forum_link']) && (int)$_POST['gd_forum_link'] == 1 ) {
$new['forum_link'] = true;
} else {
$new['forum_link'] = false;
}
update_option( 'etivite_bp_groupsdirectory', $new);
$updated = true;
}
$data = maybe_unserialize( get_option( 'etivite_bp_groupsdirectory' ) );
// Get the proper URL for submitting the settings form. (Settings API workaround) - boone
$url_base = function_exists( 'is_network_admin' ) && is_network_admin() ? network_admin_url( 'admin.php?page=bp-groups-directory-settings' ) : admin_url( 'admin.php?page=bp-groups-directory-settings' );
?>
<div class="wrap">
<h2><?php _e( 'Groups Directory Extras', 'bp-groups-directory' ); ?></h2>

<?php if ( isset($updated) ) : echo "<div id='message' class='updated fade'><p>" . __( 'Settings Updated.', 'bp-groups-directory' ) . "</p></div>"; endif; ?>

<form action="<?php echo $url_base; ?>" name="bp-groups-directory-settings-form" id="bp-groups-directory-settings-form" method="post">

<h4><?php _e( 'Items:', 'bp-groups-directory' ); ?></h4>

<table class="form-table">
<tr>
<th><label for="gd_forum_link"><?php _e('Display forum link?','bp-groups-directory') ?></label></th>
<td><input type="checkbox" name="gd_forum_link" id="gd_forum_link" value="1"<?php if ( $data['forum_link'] ) { ?> checked="checked"<?php } ?> /></td>
</tr>
<tr>
<th><label for="gd_activity"><?php _e('Display latest activity?','bp-groups-directory') ?></label></th>
<td><input type="checkbox" name="gd_activity" id="gd_activity" value="1"<?php if ( $data['activity']['enabled'] ) { ?> checked="checked"<?php } ?> /> # of Items: <input type="text" value="<?php echo $data['activity']['count']; ?>" name="gd_activity_items" id="gd_activity_items" /> </td>
</tr>
</table>

<?php wp_nonce_field( 'etivite_bp_groups_directory_admin' ); ?>

<p class="submit"><input type="submit" name="submit" value="Save Settings"/></p>

</form>

<h3>About:</h3>
<div id="plugin-about" style="margin-left:15px;">

<p>
<a href="http://etivite.com/wordpress-plugins/buddypress-groups-directory-extras/">BuddyPress Groups Directory Extras - About Page</a><br/>
</p>

<div class="plugin-author">
<strong>Author:</strong> <a href="http://profiles.wordpress.org/users/etivite/"><img style="height: 24px; width: 24px;" class="photo avatar avatar-24" src="http://www.gravatar.com/avatar/9411db5fee0d772ddb8c5d16a92e44e0?s=24&amp;d=monsterid&amp;r=g" alt=""> rich @etivite</a><br/>
<a href="http://twitter.com/etivite">@etivite</a>
</div>

<p>
<a href="http://etivite.com">Author's site</a><br/>
<a href="http://etivite.com/api-hooks/">Developer Hook and Filter API Reference</a><br/>
<a href="http://etivite.com/wordpress-plugins/">WordPress Plugins</a><br/>
</p>
</div>

</div>
<?php
}
?>
@@ -0,0 +1,68 @@
<?php
/*
Plugin Name: BuddyPress Groups Directory Extras
Plugin URI: http://wordpress.org/extend/plugins/buddypress-groups-directory-extras/
Description: Display additional information for each group on the groups directory page/loop
Author: rich @etiviti
Author URI: http://etivite.com
License: GNU GENERAL PUBLIC LICENSE 3.0 http://www.gnu.org/licenses/gpl.txt
Version: 0.1.1
Text Domain: bp-groups-directory
Network: true
*/
function etivite_bp_groups_directory_init() {
if ( file_exists( dirname( __FILE__ ) . '/languages/' . get_locale() . '.mo' ) )
load_textdomain( 'bp-groups-directory', dirname( __FILE__ ) . '/languages/' . get_locale() . '.mo' );
require( dirname( __FILE__ ) . '/bp-groups-directory.php' );
$data = maybe_unserialize( get_option( 'etivite_bp_groupsdirectory' ) );
if ( $data['forum_link'] )
add_action( 'etivite_action_groups_directory_actions', 'etivite_bp_groups_directory_loop_forum_link' );
if ( $data['activity']['enabled'] )
add_action( 'etivite_action_groups_directory_groups_item', 'etivite_bp_groups_directory_loop_activity_item' );
add_action( bp_core_admin_hook(), 'etivite_bp_groups_directory_admin_add_admin_menu' );
}
add_action( 'bp_include', 'etivite_bp_groups_directory_init', 88 );
//add_action( 'bp_init', 'etivite_bp_groups_directory_init', 88 );
//add admin_menu page
function etivite_bp_groups_directory_admin_add_admin_menu() {
global $bp;
if ( !is_super_admin() )
return false;
require( dirname( __FILE__ ) . '/admin/bp-groups-directory-admin.php' );
add_submenu_page( 'bp-general-settings', __( 'Group Directory Admin', 'bp-groups-directory' ), __( 'Group Directory', 'bp-groups-directory' ), 'manage_options', 'bp-groups-directory-settings', 'etivite_bp_groups_directory_admin' );
//set up defaults
}
/* Stolen from Welcome Pack - thanks, Paul! then stolen from boone*/
function etivite_bp_groups_directory_admin_add_action_link( $links, $file ) {
if ( 'buddypress-groups-directory-extras/bp-groups-directory-loader.php' != $file )
return $links;
if ( function_exists( 'bp_core_do_network_admin' ) ) {
$settings_url = add_query_arg( 'page', 'bp-groups-directory-settings', bp_core_do_network_admin() ? network_admin_url( 'admin.php' ) : admin_url( 'admin.php' ) );
} else {
$settings_url = add_query_arg( 'page', 'bp-groups-directory-settings', is_multisite() ? network_admin_url( 'admin.php' ) : admin_url( 'admin.php' ) );
}
$settings_link = '<a href="' . $settings_url . '">' . __( 'Settings', 'bp-groups-directory' ) . '</a>';
array_unshift( $links, $settings_link );
return $links;
}
add_filter( 'plugin_action_links', 'etivite_bp_groups_directory_admin_add_action_link', 10, 2 );
?>
@@ -0,0 +1,102 @@
<?php
if ( !defined( 'ABSPATH' ) ) exit;
function etivite_bp_groups_directory_groups_actions() {
echo '<div class="meta group-extras-meta">';
do_action( 'etivite_action_groups_directory_actions' );
echo '</div>';
}
add_action( 'bp_directory_groups_actions', 'etivite_bp_groups_directory_groups_actions',1 );
function etivite_bp_groups_directory_groups_item() {
echo '<div class="group-extras-item">';
do_action( 'etivite_action_groups_directory_groups_item' );
echo '</div>';
}
add_action( 'bp_directory_groups_item', 'etivite_bp_groups_directory_groups_item',1 );
function etivite_bp_groups_directory_loop_forum_link() {
if ( !bp_group_is_forum_enabled() )
return;
if ( !bp_group_is_visible() )
return;
echo '<a href="'. bp_get_group_forum_permalink() .'/">'. __( 'Forum', 'bp-groups-directory' ) .' &rarr;</a>';
}
function etivite_bp_groups_directory_loop_activity_item() {
global $bp, $activities_template;
if ( !bp_is_active( 'activity' ) )
return;
if ( !bp_group_is_visible() )
return;
$show_hidden = false;
/* Group filtering */
$object = $bp->groups->id;
$primary_id = bp_get_group_id();
if ( 'public' != bp_get_group_status() && ( groups_is_user_member( $bp->loggedin_user->id, $primary_id ) || $bp->loggedin_user->is_super_admin ) )
$show_hidden = true;
$data = maybe_unserialize( get_option( 'etivite_bp_groupsdirectory' ) );
$count = $data['activity']['count'];
if ( !$count || empty($count) )
$count = 3;
/* Note: any params used for filtering can be a single value, or multiple values comma separated. */
$defaults = array(
'display_comments' => false, // false for none, stream/threaded - show comments in the stream or threaded under items
'sort' => 'DESC', // sort DESC or ASC
'page' => 1, // which page to load
'per_page' => false, // number of items per page
'max' => $count, // max number to return
'include' => false, // pass an activity_id or string of ID's comma separated
'show_hidden' => $show_hidden, // Show activity items that are hidden site-wide?
/* Filtering */
'object' => $object, // object to filter on e.g. groups, profile, status, friends
'primary_id' => $primary_id, // object ID to filter on e.g. a group_id or forum_id or blog_id etc.
'action' => false, // action to filter on e.g. activity_update, new_forum_post, profile_updated
'secondary_id' => false, // secondary object ID to filter on e.g. a post_id
/* Searching */
'search_terms' => false // specify terms to search on
);
extract( $defaults );
$filter = array( 'user_id' => false, 'object' => $object, 'action' => $action, 'primary_id' => $primary_id, 'secondary_id' => $secondary_id );
$activities_template = new BP_Activity_Template( $page, $per_page, $max, $include, $sort, $filter, $search_terms, $display_comments, $show_hidden );
if ( bp_activities() ) {?>
<div class="latest-group-activity-desc">
<p><b><?php _e( 'Recent group activity', 'bp-restrictgroups' ) ?></b></p>
</div>
<div class="latest-group-activity">
<?php while ( bp_activities() ) : bp_the_activity(); ?>
<div class="item-desc" id="activity-<?php bp_activity_id() ?>">
<div class="activity-avatar">
<a href="<?php bp_activity_user_link() ?>">
<?php bp_activity_avatar( 'type=full&width=25&height=25' ) ?>
</a>
</div>
<div class="activity-content">
<div class="activity-header">
<?php bp_activity_feed_item_title() ?>
</div>
</div>
</div>
<?php endwhile; ?>
</div>
<?php
}
}
?>
@@ -0,0 +1,52 @@
=== Plugin Name ===
Contributors: nuprn1, etivite
Donate link: http://etivite.com/wordpress-plugins/donate/
Tags: buddypress, groups, groups directory
Requires at least: PHP 5.2, WordPress 3.2.1, BuddyPress 1.5.1
Tested up to: PHP 5.2.x, WordPress 3.2.1, BuddyPress 1.5.1
Stable tag: 0.1.1

This plugin will display the latest activity items (excerpt used from rss feed), a forum link, (open to suggestions).

== Description ==

This plugin will display the latest activity items (excerpt used from rss feed), a forum link, (open to suggestions).


= Related Links: =

* <a href="http://etivite.com" title="Plugin Demo Site">Author's Site</a>
* <a href="http://etivite.com/wordpress-plugins/buddypress-groups-directory-extras/">BuddyPress Groups Directory Extras - About Page</a>
* <a href="http://etivite.com/api-hooks/">BuddyPress and bbPress Developer Hook and Filter API Reference</a>
* <a href="http://twitter.com/etivite">@etivite</a> <a href="https://plus.google.com/114440793706284941584?rel=author">etivite+</a>

== Installation ==

1. Upload the full directory into your wp-content/plugins directory
2. Activate the plugin at the plugin administration page
3. Enable counts and widget via wp-admin page

== Frequently Asked Questions ==

= My question isn't answered here =

Please contact me on http://etivite.com


== Changelog ==

= 0.1.1 =

* BUG: tidy up php notices

= 0.1.0 =

* First release

== Upgrade Notice ==



== Extra Configuration ==


0 comments on commit 83c8169

Please sign in to comment.